/* jQuery jqEasyCharCounter plugin
 * Examples and documentation at: http://www.jqeasy.com/
 * Version: 1.0 (05/07/2010)
 * No license. Use it however you want. Just keep this notice included.
 * Requires: jQuery v1.3+
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
(function(b){b.fn.extend({jqEasyCounter:function(g){return this.each(function(){function e(){var b=c.val(),f=b.length;f>=a.maxChars&&(b=b.substring(0,a.maxChars));if(f>a.maxChars){var e=c.scrollTop();c.val(b.substring(0,a.maxChars));c.scrollTop(e)}f>=a.maxCharsWarning?d.css({color:a.msgWarningColor}):d.css({color:a.msgFontColor});d.html("Karakter: "+c.val().length)}var c=b(this),a=b.extend({maxChars:100,maxCharsWarning:80,msgFontSize:"12px",msgFontColor:"#000000",msgFontFamily:"Arial",msgTextAlign:"right", msgWarningColor:"#F00",msgAppendMethod:"insertAfter"},g);if(!(a.maxChars<=0)){var d=b('<div class="jqEasyCounterMsg">Maksimal Karakter</div>');d.css({"font-size":a.msgFontSize,"font-family":a.msgFontFamily,color:a.msgFontColor,"text-align":a.msgTextAlign,width:"90%","float":"left",opacity:1});d[a.msgAppendMethod](c);c.bind("keydown keyup keypress",e).bind("focus paste",function(){setTimeout(e,10)})}})}})})(jQuery);
