/*
 *  Html5 Form Plugin - jQuery plugin
 *  HTML5 form Validation form Internet Explorer & Firefox
 *  Version 1.2  / English
 *  
 *  written by Matias Mancini http://www.matiasmancini.com.ar
 * 
 *  Copyright (c) 2010 Matias Mancini (http://www.matiasmancini.com.ar)
 *  Dual licensed under the MIT (MIT-LICENSE.txt)
 *  and GPL (GPL-LICENSE.txt) licenses.
 *
 *  Built for jQuery library
 *	http://jquery.com
 *
 */
 
(function(a){a.fn.html5form=function(g){a(this).each(function(){function f(a){a.attr("placeholder")&&a.attr("type")!="password"?(a.val(a.attr("placeholder")),a.css("color",b.colorOff)):(a.data("value")?a.val(a.data("value")):a.val()!=""&&a.data("value",a.val()),a.css("color",b.colorOn))}var k={async:true,method:a(this).attr("method"),responseDiv:null,labels:"show",colorOn:"#333333",colorOff:"#a1a1a1",action:a(this).attr("action"),messages:false,emptyMessage:false,emailMessage:false,allBrowsers:false}, b=a.extend({},k,g);if(!b.allBrowsers){if(a.browser.webkit&&parseInt(a.browser.version)>=533)return false;if(a.browser.mozilla&&parseInt(a.browser.version)>=2)return false}var e=a(this),h=[],i=[];b.labels=="hide"&&a(this).find("label").hide();a.each(a(":input:visible:not(:button, :submit, :radio, :checkbox, select)",e),function(c){f(a(this));this.getAttribute("required")!=null&&(h[c]=a(this));this.getAttribute("type")=="email"&&(i[c]=a(this));a(this).bind("focus",function(d){d.preventDefault();this.value== a(this).attr("placeholder")&&this.getAttribute("type")!="url"&&a(this).attr("value","");a(this).css("color",b.colorOn)});a(this).bind("blur",function(b){b.preventDefault();this.value==""?f(a(this)):this.getAttribute("type")=="url"&&a(this).val()==a(this).attr("placeholder")&&f(a(this))});a("textarea").filter(this).each(function(){a(this).attr("maxlength")>0&&a(this).keypress(function(b){b=b.charCode||b.keyCode;return b==37||b==39?true:b==8||b==46?true:this.value.length>=a(this).attr("maxlength")? false:true})})});a.each(a(":submit",this),function(){a(this).bind("click",function(){var c=null,d=null,j=a(":input:visible:not(:button, :submit, :radio, :checkbox, select)",e);a(h).each(function(e,d){if(d==void 0)return true;return a(this).val()==a(this).attr("placeholder")||a(this).val()==""?(c=a(this),a(b.responseDiv).removeClass("success"),b.emptyMessage?a(b.responseDiv).html("<p>"+b.emptyMessage+"</p>"):b.messages=="es"?a(b.responseDiv).html("<p>El campo "+a(this).attr("title")+" es requerido.</p>"): b.messages=="en"?a(b.responseDiv).html("<p>The "+a(this).attr("title")+" field is required.</p>"):b.messages=="it"?a(b.responseDiv).html("<p>Il campo "+a(this).attr("title")+" \u00e9 richiesto.</p>"):b.messages=="de"?a(b.responseDiv).html("<p>"+a(this).attr("title")+" ist ein Pflichtfeld.</p>"):b.messages=="fr"?a(b.responseDiv).html("<p>Le champ "+a(this).attr("title")+" est requis.</p>"):(b.messages=="nl"||b.messages=="be")&&a(b.responseDiv).html("<p>"+a(this).attr("title")+" is een verplicht veld.</p>"), false):c});a(i).each(function(b,c){if(c==void 0)return true;return a(this).val().search(/[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/i)?(d=a(this),false):d});if(!c&&!d)if(a(j).each(function(){a(this).val()==a(this).attr("placeholder")&&a(this).val("")}),b.async){var g=a(e).serialize();a.ajax({url:b.action,type:b.method,data:g,success:function(c){b.responseDiv&&a(b.responseDiv).html(c).addClass("success");a(j).val("");a.each(e[0],function(){f(a(this).not(":hidden, :button, :submit, :radio, :checkbox, select")); a("select",e).each(function(){a(this).css("color",b.colorOff);a(this).children("option:eq(0)").attr("selected","selected")});a(":radio, :checkbox",e).removeAttr("checked")})}})}else a(e).submit();else c?a(c).focus().select():d?(a(b.responseDiv).removeClass("success"),b.emailMessage?a(b.responseDiv).html("<p>"+b.emailMessage+"</p>"):b.messages=="es"?a(b.responseDiv).html("<p>Ingrese una direcci&oacute;n de correo v&aacute;lida por favor.</p>"):b.messages=="en"?a(b.responseDiv).html("<p>Please type a valid email address.</p>"): b.messages=="it"?a(b.responseDiv).html("<p>L'indirizzo e-mail non &eacute; valido.</p>"):b.messages=="de"?a(b.responseDiv).html("<p>Bitte eine g&uuml;ltige E-Mail-Adresse eintragen.</p>"):b.messages=="fr"?a(b.responseDiv).html("<p>Entrez une adresse email valide s&rsquo;il vous plait.</p>"):(b.messages=="nl"||b.messages=="be")&&a(b.responseDiv).html("<p>Voert u alstublieft een geldig email adres in.</p>"),a(d).select()):alert("Unknown Error");return false})})})}})(jQuery);
