(function(a){a.fn.html5form=function(b){a(this).each(function(){var f={async:true,method:a(this).attr("method"),responseDiv:null,labels:"show",colorOn:"#000000",colorOff:"#a1a1a1",action:a(this).attr("action"),messages:false,emptyMessage:false,emailMessage:false,allBrowsers:false};var e=a.extend({},f,b);if(!e.allBrowsers){if(a.browser.webkit&&parseInt(a.browser.version)>=533){return false}}var d=a(this);var g=new Array();var c=new Array();function h(i){if(i.attr("placeholder")){i.val(i.attr("placeholder"));i.css("color",e.colorOff);if(a.browser.mozilla){i.css("-moz-box-shadow","none")}}else{if(!i.data("value")){if(i.val()!=""){i.data("value",i.val())}}else{i.val(i.data("value"))}i.css("color",e.colorOn)}}if(e.labels=="hide"){a(this).find("label").hide()}a.each(a("select",this),function(){a(this).css("color",e.colorOff);a(this).change(function(){a(this).css("color",e.colorOn)})});a.each(a(":input:visible:not(:button, :submit, :radio, :checkbox, select)",d),function(j){h(a(this));if(this.getAttribute("required")!=null){g[j]=a(this)}if(this.getAttribute("type")=="email"){c[j]=a(this)}a(this).bind("focus",function(i){i.preventDefault();if(this.value==a(this).attr("placeholder")){if(this.getAttribute("type")!="url"){a(this).attr("value","")}}a(this).css("color",e.colorOn)});a(this).bind("blur",function(i){i.preventDefault();if(this.value==""){h(a(this))}else{if((this.getAttribute("type")=="url")&&(a(this).val()==a(this).attr("placeholder"))){h(a(this))}}});a("textarea").filter(this).each(function(){if(a(this).attr("maxlength")>0){a(this).keypress(function(i){var k=i.charCode||i.keyCode;if(k==37||k==39){return true}if(k==8||k==46){return true}if(this.value.length>=a(this).attr("maxlength")){return false}else{return true}})}})});a.each(a(":submit",this),function(){a(this).bind("click",function(k){var l=null;var j=null;var i=a(":input:visible:not(:button, :submit, :radio, :checkbox, select)",d);a(g).each(function(n,o){if(o==undefined){return true}if((a(this).val()==a(this).attr("placeholder"))||(a(this).val()=="")){l=a(this);if(e.emptyMessage){a(e.responseDiv).html("<p>"+e.emptyMessage+"</p>")}else{if(e.messages=="es"){a(e.responseDiv).html("<p>El campo "+a(this).attr("title")+" es requerido.</p>")}else{if(e.messages=="en"){a(e.responseDiv).html("<p>The "+a(this).attr("title")+" field is required.</p>")}else{if(e.messages=="it"){a(e.responseDiv).html("<p>Il campo "+a(this).attr("title")+" ????? richiesto.</p>")}else{if(e.messages=="de"){a(e.responseDiv).html("<p>"+a(this).attr("title")+" ist ein Pflichtfeld.</p>")}else{if(e.messages=="fr"){a(e.responseDiv).html("<p>Le champ "+a(this).attr("title")+" est requis.</p>")}else{if(e.messages=="nl"||e.messages=="be"){a(e.responseDiv).html("<p>"+a(this).attr("title")+" is een verplicht veld.</p>")}}}}}}}return false}return l});a(c).each(function(n,o){if(o==undefined){return true}if(a(this).val().search(/[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/i)){j=a(this);return false}return j});if(!l&&!j){a(i).each(function(){if(a(this).val()==a(this).attr("placeholder")){a(this).val("")}});if(e.async){var m=a(d).serialize();a.ajax({url:e.action,type:e.method,data:m,success:function(n){if(e.responseDiv){a(e.responseDiv).html(n)}a(i).val("");a.each(d[0],function(){h(a(this).not(":hidden, :button, :submit, :radio, :checkbox, select"));a("select",d).each(function(){a(this).css("color",e.colorOff);a(this).children("option:eq(0)").attr("selected","selected")});a(":radio, :checkbox",d).removeAttr("checked")})}})}else{a(d).submit()}}else{if(l){a(l).focus().select()}else{if(j){if(e.emailMessage){a(e.responseDiv).html("<p>"+e.emailMessage+"</p>")}else{if(e.messages=="es"){a(e.responseDiv).html("<p>Ingrese una direcci??????n de correo v?????lida por favor.</p>")}else{if(e.messages=="en"){a(e.responseDiv).html("<p>Please type a valid email address.</p>")}else{if(e.messages=="it"){a(e.responseDiv).html("<p>L'indirizzo e-mail non ????? valido.</p>")}else{if(e.messages=="de"){a(e.responseDiv).html("<p>Bitte eine g??????ltige E-Mail-Adresse eintragen.</p>")}else{if(e.messages=="fr"){a(e.responseDiv).html("<p>Entrez une adresse email valide s??????il vous plait.</p>")}else{if(e.messages=="nl"||e.messages=="be"){a(e.responseDiv).html("<p>Voert u alstublieft een geldig email adres in.</p>")}}}}}}}a(j).select()}else{alert("Unknown Error")}}}return false})})})}})(jQuery);
