/**
 * YOU ARE FREE TO USE THIS CODE IF YOU HOLD THE REFERENCE TO THE AUTHOR
 * Plugin for jQuery that delimites the maximum of characteres in inputs and textareas
 * @author: Iván Guardado Castro
 * @email: dev.ivangc@gmail.com
 * @website: http://yensdesign.com/
 */
jQuery.fn.maxLength=function(g){this.each(function(){var d=this.tagName.toLowerCase();var f=this.type?this.type.toLowerCase():null;if(d=="input"&&f=="text"||f=="password"){this.maxLength=g}else if(d=="textarea"){this.onkeypress=function(e){var a=e||event;var b=a.keyCode;var c=document.selection?document.selection.createRange().text.length>0:this.selectionStart!=this.selectionEnd;return!(this.value.length>=g&&(b>50||b==32||b==0||b==13)&&!a.ctrlKey&&!a.altKey&&!c)};this.onkeyup=function(){if(this.value.length>g){this.value=this.value.substring(0,g)}}}})};