YAHOO.namespace("ProjectX.finals.registration");YAHOO.ProjectX.finals.registration=function(B){var V="http://"+window.location.host;var M=B.action;V+=YAHOO.ProjectX.helper.string.URL_PART_SEPARATOR+YAHOO.ProjectX.helper.string.getUrlPart(M,"kind")+YAHOO.ProjectX.helper.string.URL_PART_SEPARATOR+YAHOO.ProjectX.helper.string.getUrlPart(M,"controller")+YAHOO.ProjectX.helper.string.URL_PART_SEPARATOR+YAHOO.ProjectX.helper.string.getUrlPart(M,"action");B.action=V;var W=B.className;var K=W.split(" ");for(var T=0;T<K.length;T++){var X=K[T];var I=X.lastIndexOf(YAHOO.ProjectX.finals.registration.formClassSuffixForPrefix);if(I>0){this.sPrefix=X.substring(0,I);break}}if(this.sPrefix==undefined){throw"Cannot find class [prefix]"+YAHOO.ProjectX.finals.registration.formClassSuffixForPrefix+" on form with classes "+W}this.oPanel=new YAHOO.widget.Panel(this.sPrefix+"-panel",{width:"425px",x:140,y:90,zIndex:9999,constraintoviewport:true,underlay:"shadow",close:true,visible:false,constraintoviewport:true,draggable:true,modal:true,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.4}});var S=YAHOO.util.Dom.get(this.sPrefix+"-panelheader");if(S!=null){this.oPanel.setHeader(S.innerHTML)}this.oPanel.hideEvent.subscribe(this.onHide,null,this);var D=YAHOO.util.Dom.get(this.sPrefix+"-elem-newemail");this.oNewemailInput=D;var R=YAHOO.util.Dom.get(this.sPrefix+"-elem-newpassword");var A=YAHOO.util.Dom.get(this.sPrefix+"-elem-firstName");var P=YAHOO.util.Dom.get(this.sPrefix+"-elem-lastName");var O=new Object();O.id=this.sPrefix+"-elem-gender";var L=YAHOO.util.Dom.get(this.sPrefix+"-elem-male");var G=YAHOO.util.Dom.get(this.sPrefix+"-elem-female");var Q=YAHOO.util.Dom.get(this.sPrefix+"-elem-countryId");var N=YAHOO.util.Dom.get(this.sPrefix+"-elem-age");YAHOO.util.Event.addListener(D,"keypress",YAHOO.ProjectX.js.manipulators.input.onReturnHandler,null);YAHOO.util.Event.addListener(R,"keypress",YAHOO.ProjectX.js.manipulators.input.onReturnHandler,null);YAHOO.util.Event.addListener(A,"keypress",YAHOO.ProjectX.js.manipulators.input.onReturnHandler,null);YAHOO.util.Event.addListener(P,"keypress",YAHOO.ProjectX.js.manipulators.input.onReturnHandler,null);YAHOO.util.Event.addListener(N,"keypress",YAHOO.ProjectX.js.manipulators.input.onReturnHandler,null);var U=new YAHOO.ProjectX.forms.ValEmailAddress();YAHOO.util.Event.addListener(D,"blur",this.onBlur,U,D);var E=new YAHOO.ProjectX.forms.ValPassword();YAHOO.util.Event.addListener(R,"blur",this.onBlur,E,R);var F=new YAHOO.ProjectX.forms.ValName(false,2,25);var J=new YAHOO.ProjectX.forms.ValName(false,2,40);YAHOO.util.Event.addListener(A,"blur",this.onBlur,F,A);YAHOO.util.Event.addListener(P,"blur",this.onBlur,J,P);var C=new YAHOO.ProjectX.forms.ValExactlyOneOf(false,["male","female"]);YAHOO.util.Event.addListener(L,"click",this.onBlur,C,O);YAHOO.util.Event.addListener(G,"click",this.onBlur,C,O);YAHOO.util.Event.addListener(L,"blur",this.onBlur,C,O);YAHOO.util.Event.addListener(G,"blur",this.onBlur,C,O);var Y=new YAHOO.ProjectX.forms.ValCountryId();YAHOO.util.Event.addListener(Q,"blur",this.onBlur,Y,Q);var H=new YAHOO.ProjectX.forms.ValNumberRange(false,18,120);H.translations=YAHOO.ProjectX.data.lang.ValAge;YAHOO.util.Event.addListener(N,"blur",this.onBlur,H,N);YAHOO.ProjectX.formajax.initFormAjax(this.sPrefix);YAHOO.ProjectX.finals.registration.aInstances[this.sPrefix]=this;YAHOO.log("finished init for instance '"+this.sPrefix+"'","info","Registration")};YAHOO.ProjectX.finals.registration.prototype.sPrefix;YAHOO.ProjectX.finals.registration.prototype.oPanel;YAHOO.ProjectX.finals.registration.prototype.oNewemailInput;YAHOO.ProjectX.finals.registration.prototype.oAgeInput;YAHOO.ProjectX.finals.registration.prototype.oBirthyearSelect;YAHOO.ProjectX.finals.registration.prototype.oBirthmonthSelect;YAHOO.ProjectX.finals.registration.prototype.oBirthdaySelect;YAHOO.ProjectX.finals.registration.prototype.aBirthselectDefaultYears;YAHOO.ProjectX.finals.registration.prototype.selectedYear=0;YAHOO.ProjectX.finals.registration.prototype.oCurrentDate;YAHOO.ProjectX.finals.registration.prototype.aOldBirthYearChilds;YAHOO.ProjectX.finals.registration.prototype.show=function(A){YAHOO.util.Dom.setStyle(this.sPrefix+"-panel","display","");this.oPanel.render();this.oPanel.show();YAHOO.util.Dom.setStyle("yui-tooltip","z-index","10004");this.oNewemailInput.focus();this.oNewemailInput.select()};YAHOO.ProjectX.finals.registration.prototype.onHide=function(){YAHOO.ProjectX.js.finals.popuppanels.get("panel-"+this.sPrefix+"-whydata").cfg.setProperty("effect",null);YAHOO.ProjectX.js.finals.popuppanels.hide("panel-"+this.sPrefix+"-whydata");YAHOO.ProjectX.js.finals.popuppanels.get("panel-"+this.sPrefix+"-whydata").cfg.setProperty("effect",{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.4})};YAHOO.ProjectX.finals.registration.prototype.onBlur=function(I,A){var B=YAHOO.ProjectX.forms.ValErrorKeys.VALUE_NOT_ALLOWED;var J=false;var D=true;var E=YAHOO.util.Event.getTarget(I).value;var F=YAHOO.ProjectX.formajax.getSmileyElement(this);var C=YAHOO.ProjectX.formajax.getErrElement(this);var G=YAHOO.ProjectX.formajax.getHiddenElement(this);D=E==null||E.length==0;try{J=A.validate(E);if(J==false){J=true;D=true}}catch(H){J=false;B=H}if(J==false&&!D){YAHOO.ProjectX.formajax.displayError(C.id,A.translate(B));if(F!=undefined){YAHOO.ProjectX.formajax.displayNegativeSmiley(F.id)}if(B==YAHOO.ProjectX.forms.ValErrorKeys.NAME_SHOULD_NOT_BE_ABBREVIATED&&G!=null){G.value=true}}else{if(J==false&&D){YAHOO.ProjectX.formajax.hideError(C.id);if(F!=undefined){YAHOO.ProjectX.formajax.displayNeutralSmiley(F.id)}}else{YAHOO.ProjectX.formajax.hideError(C.id);if(F!=undefined){YAHOO.ProjectX.formajax.displayPositiveSmiley(F.id)}}}};YAHOO.ProjectX.finals.registration.prototype.onAgeChange=function(F,B){YAHOO.log("in change with "+F+" "+B.value,"info","Registration");var A=new Number(B.value);var E=new Array();selectedYear=oBirthyearSelect.options[oBirthyearSelect.selectedIndex].value;for(var C=oBirthyearSelect.options.length-1;C>0;C--){oBirthyearSelect.options[C]=null}if(!isNaN(A)&&!B.value.length==0){YAHOO.log("age is valid...setting rel to "+oCurrentDate.getFullYear(),"info","Registration");oBirthyearSelect.options[1]=new Option(oCurrentDate.getFullYear()-A,oCurrentDate.getFullYear()-A);oBirthyearSelect.options[2]=new Option(oCurrentDate.getFullYear()-A-1,oCurrentDate.getFullYear()-A-1)}else{YAHOO.log("age is INvalid..."+aBirthselectDefaultYears[0]+" "+aBirthselectDefaultYears[1],"info","Registration");for(var C=aBirthselectDefaultYears[1];C>=aBirthselectDefaultYears[0];C--){var D=false;if(selectedYear==C){D=true}oBirthyearSelect.options[oBirthyearSelect.options.length]=new Option(C,C,D,D)}}YAHOO.log("set options"+E.length,"info","Registration");YAHOO.log("end of onChange","info","Registration")};YAHOO.ProjectX.finals.registration.prototype.onAnyBirthdayFieldChange=function(G,B,D){YAHOO.log("One Birthdayfield changed","info","Registration");var E=new Number(oBirthyearSelect.options[oBirthyearSelect.selectedIndex].value);var F=new Number(oBirthmonthSelect.options[oBirthmonthSelect.selectedIndex].value);var A=new Number(oBirthdaySelect.options[oBirthdaySelect.selectedIndex].value);if(E>0&&F>0&&A>0&&oAgeInput.value.length==0){F-=1;YAHOO.log("Birthday complete","info","Registration");var C=oCurrentDate.getFullYear()-E-1;if(oCurrentDate.getMonth()>F){C+=1}else{if(oCurrentDate.getMonth()==F&&oCurrentDate.getDate()>=A){C+=1}}oAgeInput.value=C}};YAHOO.ProjectX.finals.registration.aInstances=new Object();YAHOO.ProjectX.finals.registration.initDone=false;YAHOO.ProjectX.finals.registration.defaultPrefix="registration";YAHOO.ProjectX.finals.registration.formClass="jsregistration";YAHOO.ProjectX.finals.registration.formClassSuffixForPrefix="-formid";YAHOO.ProjectX.finals.registration.show=function(A){if(A==undefined||A==null||A.length<=0){A=YAHOO.ProjectX.finals.registration.defaultPrefix}var B=YAHOO.ProjectX.finals.registration.aInstances[A];if(B!=undefined){B.show()}else{throw"Cannot find registration instance with prefix '"+A+"' to call show for"}};YAHOO.ProjectX.finals.registration.init=function(){if(YAHOO.ProjectX.finals.registration.initDone){return }YAHOO.ProjectX.finals.registration.initDone=true;var A=YAHOO.util.Dom.getElementsByClassName(YAHOO.ProjectX.finals.registration.formClass,"form",null);if(A!=undefined&&A.length>0){for(var B=0;B<A.length;B++){var C=new YAHOO.ProjectX.finals.registration(A[B])}}};YAHOO.util.Event.addListener(this,"load",YAHOO.ProjectX.finals.registration.init);