var validate=(function(){var d=YAHOO.util.Dom;var l=function(q){return(q.search(/^[\w\-\+]+(?:\.[\w\-\+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/)!=-1)};var k=function(q){return(q.search(/^[0-9-()+\s]*$/)!=-1)};var i=function(q){return document.getElementById(q)};var j=function(q){return document.getElementById(q).value};var c=function(v,w){v=d.get(v);var t=v.id;var u=t+"_errorPanel";var x=i(u);var q=new YAHOO.widget.Overlay(u,{visible:true,zIndex:50000});q.setBody(w);if(!x){q.render(v.parentNode);d.addClass(q.element,"error")}else{d.setStyle(x,"display","");q.show()}d.setStyle(q.element,"position","absolute");var s=d.getRegion(v);if(i(t+"_mode")){d.setStyle(i(t+"_mode"),"display","none")}q.cfg.setProperty("xy",GetErrorPanelPos(t,s))};var o=function(t){t=d.get(t);var q=t.id;var s=q+"_errorPanel";var u=i(s);if(u){d.setStyle(u,"display","none");if(i(q+"_mode")){d.setStyle(i(q+"_mode"),"display","")}}};var h=function(){if(!this.value){c(this,"This field is required.")}else{o(this.id)}};var g=function(){var q;if(!this.value){q="This field is required."}else{if(this.value.length<5){q="Must be at least 5 characters long."}else{if((this.id=="username"&&/^[\x21-\x2B\x2D-\x39\x3B\x3D\x3F-\x7E]+$/.test(this.value)===false)||(this.id=="password"&&/^[\x21-\x3B\x3D-\x3D\x3F-\x7E]+$/.test(this.value)===false)){q="International characters & spaces are not allowed."}else{if(j("email")==j("password")){q="Should not match email."}}}}if(q){c(this,q)}else{o(this.id)}};var f=function(){var q;if(!this.value){q="This field is required."}else{if(this.value!=j("password")){q="Password doesn't match."}else{o(this.id);return}}c(this,q)};var e=function(){if(!l(this.value)){c(this,"Email invalid.")}else{o(this.id)}};var b=function(){if(!i("agree").checked){c(this,"You must agree to the Terms of Use & Privacy Policy in order to submit.")}else{o(this.id)}};var a=function(){if((this.getAttribute("required")=="true")&&(!this.value)){c(this,"This field is required.")}else{if(!k(this.value)){c(this,"Phone invalid.")}else{o(this.id)}}};var n={agree:b,name:h,email:e,username:g,password:g,password2:f,phone:a};YAHOO.util.Event.onDOMReady(function(){var q=YAHOO.util.Event;if(document.location.href.search("account2")==-1){page2=false}else{page2=true}var s=i("name");if(s){s.focus()}q.addListener(["name"],"blur",n.name);q.addListener(["password"],"blur",function(){n.password.call(i("password"));if(j("password2")){n.password2.call(i("password2"))}});q.addListener("password2","blur",function(){n.password2.call(this);if(j("password")){n.password.call(i("password"))}});q.addListener("email","blur",e);q.addListener("agree","blur",b);if(i("phone")){q.addListener("phone","blur",a)}q.addListener(["name","password","password2","email","agree"],"focus",function(t){})});var p=function(q){if(window.ClickTaleTag){ClickTaleTag(q)}};return function m(u){var x="";var q=[];if(!j("name")){q.push("name");x+="* Full name\n";p("must_field_empty")}var t=j("email");if(!l(t)){q.push("email");x+="* Email address\n";p("email_invalid")}var v=j("password");if(v.length<5){x+="* Password\n";q.push("password");p("username_pass_short")}if(!j("password2")||j("password2")!=v){x+="* Password confirmation\n";q.push("password2");p("pass_mismatch")}if((v&&/^[\x21-\x3B\x3D-\x3D\x3F-\x7E]+$/.test(v)===false)){x+="\n- Password must contain simple characters only.\n  International or accented characters are not allowed.";p("username_pass_i18n")}if(t&&t==v){x+="\n- Email and Password must be different.\n";p("username_eq_pass")}if(i("phone")){var w=j("phone");if(((i("phone").getAttribute("required")=="true")&&(!w))||(!k(w))){q.push("phone");x+="* Phone\n";p("phone_invalid")}}if(!i("agree").checked){x+="* Terms of Use\n";q.push("agree");p("agree_notchecked")}if(x!==""){x="The following fields have not been filled in properly:\n"+x;for(var s in q){n[q[s]].call(i(q[s]))}alert(x);return false}r=location.search.match(/p=([^&]+)/);if(r){i("plan").value=r[1]}r=location.search.match(/planpass=([^&]+)/);if(r){i("planpass").value=r[1]}if(readCookie("AID")&&readCookie("AD")){i("AID").value=readCookie("AID");i("AD").value=readCookie("AD")}i("submit").disabled=true;i("loadBar").style.display="block";p("u:"+t);return true}})();
