HabboView.add(function(){HabboEditor.addCallback("setGender",function(A){$("register-gender").value=A});HabboEditor.addCallback("setFigure",function(A){$("register-figure").value=A});HabboEditor.addCallback("setEditorState",function(A){$("register-editor-state").value=A});window.refreshingAvatars=false;
if($("register-avatars-refresh")){Event.observe($("register-avatars-refresh"),"click",function(A){window.refreshingAvatars=true})}RegistrationForm.createAcceptTermsTooltip();Event.observe($("register-terms-check"),"click",function(){if(Tips.get("register-terms-content")){$("register-terms-content").removeClassName("error");
Tips.get("register-terms-content").hideTip()}});if(!!$("register-birthday")){RegistrationForm.createEnterValidBirthdayTooltip();Event.observe($("register-birthday"),"click",function(){if(Tips.get("register-birthday")){$("register-birthday").removeClassName("error");Tips.get("register-birthday").hideTip()
}})}if(!!$("register-name")){RegistrationForm.createCheckButtonTooltip();RegistrationForm.createNameTooltip();RegistrationForm.previousName=$F("register-name");Event.observe($("register-name"),"keydown",function(B){if(B.keyCode==Event.KEY_TAB||B.keyCode==Event.KEY_RETURN){Event.stop(B);RegistrationForm.Validator._checkName()
}else{var A=$F("register-name");if(A!=RegistrationForm.previousName){RegistrationForm.Validator._resetErrorState($("register-name"));RegistrationForm.previousName=A;RegistrationForm.Validator._lastCheckedName="";$("registration-overlay").style.display="block";RegistrationForm._toggleFormSection("register-section-3",true);
if(RegistrationForm.nameTooltipState!="create"){RegistrationForm.nameTooltipState="create";RegistrationForm.createNameTooltip();Tips.get($("register-name")).showTip()}}RegistrationForm.Validator._nameCheckNeeded=true}});Event.observe($("register-name-check"),"click",function(A){Event.stop(A);RegistrationForm.Validator._checkName()
});$("register-name-check-container").show();Event.observe($("register-name"),"blur",function(A){if($F("register-name")!=""&&RegistrationForm.Validator._nameCheckNeeded){if(!RegistrationForm.nameSuggestionEnabled){Tips.get("register-name-check").showTip()}RegistrationForm.Validator._showErrorState($("register-name"))
}});Event.observe($("register-name"),"focus",function(A){Tips.get("register-name-check").hideTip()})}if(!!$("register-password")){RegistrationForm.createPasswordTooltip();new Form.Element.Observer($("register-password"),0.5,RegistrationForm.Validator.checkPasswordValidity);Event.observe($("register-password"),"keyup",function(C){var A=$("register-password");
var B=$F("register-password");RegistrationForm.Validator._lastCheckedPassword="";Tips.get(A).hideTip();if(B!=""&&B.length<6){RegistrationForm.Validator._showErrorState(A,true);if(RegistrationForm.passwordTooltipState!="tooshort"){RegistrationForm.passwordTooltipState="tooshort";RegistrationForm.createPasswordTooShortTooltip()
}}else{if(B==""){RegistrationForm.Validator._resetErrorState(A);RegistrationForm.Validator._resetErrorState($("register-password2"));$("register-password2").value="";if(RegistrationForm.passwordTooltipState!="create"){RegistrationForm.passwordTooltipState="create";RegistrationForm.createPasswordTooltip()
}}}Tips.get(A).showTip()});Event.observe($("register-password2"),"focus",function(A){if($F("register-password")==""){$("register-password").focus()}Tips.get("register-password").showTip()});Event.observe($("register-password2"),"blur",function(A){Tips.get("register-password").hideTip()});Event.observe($("register-password2"),"keyup",function(C){var A=$("register-password2");
var B=$F("register-password2");if(B!=""){if($("register-password").hasClassName("error")){if(RegistrationForm.passwordTooltipState!="invalid"){RegistrationForm.passwordTooltipState="invalid";RegistrationForm.createPasswordInvalidTooltip()}}else{if(B==$F("register-password")){RegistrationForm.Validator._showSuccessState(A);
if(RegistrationForm.passwordTooltipState!="success"){RegistrationForm.passwordTooltipState="success";RegistrationForm.createPasswordSuccessTooltip()}}else{RegistrationForm.Validator._showErrorState(A,true);if(RegistrationForm.passwordTooltipState!="notsame"){RegistrationForm.passwordTooltipState="notsame";
RegistrationForm.createRetypedPasswordNotSameTootip()}}}}else{if($F("register-password")!=""){RegistrationForm.Validator._resetErrorState(A);if(RegistrationForm.passwordTooltipState!="retype"){RegistrationForm.passwordTooltipState="retype";RegistrationForm.createRetypePasswordTooltip()}}}Tips.get("register-password").showTip()
})}Event.observe($("register-terms-link"),"click",function(B){Event.stop(B);var A=Event.element(B);window.open(A.href,A.target,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=820,height=500")});if($("register-name-other")){RegistrationForm.Validator._waitingForValidName=true;
Event.observe($("register-name"),"focus",function(A){$("register-name-other").checked=true});$$(".register-name-suggestion").each(function(A){Event.observe(A,"change",function(B){if(Event.element(B).checked){RegistrationForm.Validator._waitingForValidName=false}})})}if(!!$("register-email")){RegistrationForm.createEmailToolTip();
new Form.Element.Observer($("register-email"),0.5,RegistrationForm.Validator.checkEmailValidity);Event.observe($("register-email"),"keyup",function(C){var B=$F("register-email");var A=$("register-email");RegistrationForm.Validator._lastCheckedEmail="";Tips.get(A).hideTip();if(B==""){RegistrationForm.Validator._resetErrorState(A);
RegistrationForm.Validator._resetErrorState($("register-email2"));$("register-email2").value="";if(RegistrationForm.emailTooltipState!="create"){RegistrationForm.emailTooltipState="create";RegistrationForm.createEmailToolTip()}}else{if(!RegistrationForm.Validator.validateEmail(B)){RegistrationForm.Validator._showErrorState(A,true);
if(RegistrationForm.emailTooltipState!="invalid"){RegistrationForm.emailTooltipState="invalid";RegistrationForm.createInvalidEmailTooltip()}}}Tips.get(A).showTip()});Event.observe($("register-email2"),"keyup",function(C){var A=$("register-email2");var B=$F("register-email2");if(B!=""){if($("register-email").hasClassName("error")){if(RegistrationForm.emailTooltipState!="invalid"){RegistrationForm.emailTooltipState="invalid";
RegistrationForm.createInvalidEmailTooltip()}}else{if(B==$F("register-email")){RegistrationForm.Validator._showSuccessState(A);if(RegistrationForm.emailTooltipState!="success"){RegistrationForm.emailTooltipState="success";RegistrationForm.createEmailSuccessTooltip()}}else{RegistrationForm.Validator._showErrorState(A,true);
if(RegistrationForm.emailTooltipState!="notsame"){RegistrationForm.emailTooltipState="notsame";RegistrationForm.createRetypedEmailNotSameTootip()}}}}else{if($F("register-email")!=""){RegistrationForm.Validator._resetErrorState(A);if(RegistrationForm.emailTooltipState!="retype"){RegistrationForm.emailTooltipState="retype";
RegistrationForm.createRetypeEmailTooltip()}}}Tips.get("register-email").showTip()});Event.observe($("register-email2"),"focus",function(A){if($F("register-email")==""){$("register-email").focus()}Tips.get("register-email").showTip()});Event.observe($("register-email2"),"blur",function(A){Tips.get("register-email").hideTip()
})}Event.observe($("registerform"),"submit",RegistrationForm.handleSubmit)});RegistrationForm={ageLimit:-1,banHours:-1,parentEmailAgeLimit:-1,previousName:null,passwordTooltipState:null,emailTooltipState:null,nameTooltipState:null,elementFocused:null,isCaptchaEnabled:false,personalInfoDisabled:false,nameSuggestionEnabled:false,captchaPublicKey:"none",registrationTipStyle:{className:"bubbletip left",title:" ",hook:{target:"topRight",tip:"bottomRight"},fixed:true,startEvent:"focus",endEvent:"blur"},defaultPos:{offset:{x:40,y:-6}},init:function(A){if(A){$("registration-overlay").style.display="block";
RegistrationForm._toggleFormSection("register-section-3",true);RegistrationForm.personalInfoDisabled=true;RegistrationForm.createPersonalInfoDisabledTooltip();if($("register-name")){$("register-name").focus()}}},handleSubmit:function(A){if(!window.refreshingAvatars){if(!RegistrationForm.Validator.validate()){Event.stop(A);
Element.show("form-validation-error-box")}else{if(!RegistrationForm.isRegistrationAllowed()){Event.stop(A);Cookie.set("rb",1,RegistrationForm.banHours/24);RegistrationForm.showAgeLimitMessage()}else{if(!RegistrationForm.Validator._parentEmailOk&&RegistrationForm.isParentEmailNeeded()){Event.stop(A);RegistrationForm.showParentEmailCaptchaField();
$("register-parentEmail-bubble").focus()}else{if(!RegistrationForm.Validator._captchaOk&&RegistrationForm.isCaptchaEnabled){Event.stop(A);RegistrationForm.showParentEmailCaptchaField();if($("register-captcha-bubble")){$("register-captcha-bubble").focus()}else{if($("recaptcha_response_field")){$("recaptcha_response_field").focus()
}}}else{Event.stopObserving($("registerform"),"submit",RegistrationForm.handleSubmit);Event.observe($("registerform"),"submit",function(B){return false})}}}}}},cancel:function(A){location.href=habboReqPath+"index.php"+(A||"")},isParentEmailNeeded:function(){if(RegistrationForm.parentEmailAgeLimit>-1&&!!$("register-birthday")){var A=RegistrationForm._calculateAge();
if(A!=-1){return A<=RegistrationForm.parentEmailAgeLimit}}return false},showParentEmailCaptchaField:function(){if(!$("register-parent-email")){Element.hide("form-validation-error-box");var A="";if(RegistrationForm.isParentEmailNeeded()){A=A.concat(L10N.get("register.message.parent_email_js_form"))}if(RegistrationForm.isCaptchaEnabled){A=A.concat(L10N.get("register.message.captcha_js_form"))
}RegistrationForm._showErrorBubble("register-parent-email",A,function(){RegistrationForm._disableFormFields(true,["register-button-continue","register-parentEmail-bubble","register-captcha-bubble","register-permission-bubble","recaptcha_response_field"]);if($("captcha-reload")){Event.observe($("captcha-reload"),"click",function(B){Event.stop(B);
Utils.reloadCaptcha()})}else{if($("recaptcha-reload")){Event.observe($("recaptcha-reload"),"click",function(B){Event.stop(B);Recaptcha.reload()});Utils.showRecaptcha("recaptcha_challenge",RegistrationForm.captchaPublicKey)}}});if($("register-captcha-bubble")){Event.observe($("register-captcha-bubble"),"keyup",RegistrationForm.Validator.checkCapchaValidity)
}if($("recaptcha_response_field")){Event.observe($("recaptcha_response_field"),"keyup",RegistrationForm.Validator.checkCapchaValidity)}if($("register-parentEmail-bubble")){if(Prototype.Browser.IE){$("bean_month").setStyle({visibility:"hidden"});$("bean_year").setStyle({visibility:"hidden"})}Rounder.addCorners($("parentEmail-error-box-container"),4,4,"rounded-container");
Event.observe($("register-parentEmail-bubble"),"keypress",function(B){if(B.keyCode==Event.KEY_TAB||B.keyCode==Event.KEY_RETURN){RegistrationForm.Validator.checkParentEmailValidity()}else{RegistrationForm.Validator._lastCheckedParentEmail="";RegistrationForm.Validator._parentEmailOk=false;RegistrationForm.Validator._resetErrorState($("register-parentEmail-bubble"));
$("parentEmail-error-box-content").innerHTML=L10N.get("register.tooltip.enteremail")}});RegistrationForm._track("parentEmail")}}else{if(RegistrationForm.isParentEmailNeeded()){RegistrationForm.Validator.checkParentEmailValidity()}}},showAgeLimitMessage:function(){RegistrationForm._showErrorBubble("register-ageLimit",L10N.get("register.message.age_limit_ban"),function(){RegistrationForm._disableFormFields(false,["register-parentEmail-cancel"])
});RegistrationForm._track("ageLimit")},isRegistrationAllowed:function(){if(RegistrationForm.ageLimit>-1){var A=RegistrationForm._calculateAge();if(A!=-1){return A>=RegistrationForm.ageLimit}}return true},createNameTooltip:function(){new Tip("register-name",L10N.get("register.tooltip.name"),Object.extend({target:$("register-section-2"),offset:{x:155,y:3}},RegistrationForm.registrationTipStyle))
},createPasswordTooltip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.password")},createRetypePasswordTooltip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.retypepassword")},createCheckButtonTooltip:function(){new Tip("register-name-check",L10N.get("register.tooltip.namecheck"),{className:"bubbletip left",title:" ",hook:{target:"topRight",tip:"bottomRight"},offset:{x:130,y:-3},startEvent:"focus",endEvent:"blur"})
},createPersonalInfoDisabledTooltip:function(){new Tip("registration-overlay",L10N.get("register.tooltip.personalinfo.disabled"),{className:"bubbletip left",title:" ",hook:{target:"topRight",tip:"bottomRight"},fixed:true,offset:{x:20,y:150}})},createNameSuccessTooltip:function(){new Tip("register-name",L10N.get("register.tooltip.namechecksuccess"),Object.extend({offset:{x:85,y:-6}},RegistrationForm.registrationTipStyle))
},createPasswordSuccessTooltip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.passwordsuccess")},createPasswordTooShortTooltip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.passwordtooshort")},createRetypedPasswordNotSameTootip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.passwordnotsame")
},createPasswordInvalidTooltip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.invalidpassword")},createEmailToolTip:function(){RegistrationForm._createTooltip("register-email","register.tooltip.email")},createRetypeEmailTooltip:function(){RegistrationForm._createTooltip("register-email","register.tooltip.retypeemail")
},createInvalidEmailTooltip:function(){RegistrationForm._createTooltip("register-email","register.tooltip.invalidemail")},createEmailSuccessTooltip:function(){RegistrationForm._createTooltip("register-email","register.tooltip.emailsuccess")},createRetypedEmailNotSameTootip:function(){RegistrationForm._createTooltip("register-email","register.tooltip.emailnotsame")
},createEnterPasswordTooltip:function(){RegistrationForm._createTooltip("register-password","register.tooltip.enterpassword")},createEnterNameToolTip:function(){RegistrationForm._createTooltip("register-name","register.tooltip.entername")},createEnterEmailTooltip:function(){RegistrationForm._createTooltip("register-email","register.tooltip.enteremail")
},createEnterBirthdayTooltip:function(){RegistrationForm._createTooltip("register-birthday","register.tooltip.enterbirthday")},createAcceptTermsTooltip:function(){RegistrationForm._createTooltip("register-terms-content","register.tooltip.acceptterms")},createEnterValidBirthdayTooltip:function(){RegistrationForm._createTooltip("register-birthday","register.tooltip.invalidbirthday")
},_createTooltip:function(B,A){new Tip(B,L10N.get(A),Object.extend(RegistrationForm.defaultPos,RegistrationForm.registrationTipStyle))},updateNameFromBubble:function(A){var B=$("register-name");B.value=A;B.removeClassName("error");B.addClassName("register-ok");RegistrationForm.Validator._lastCheckedName=A;
RegistrationForm.Validator._nameCheckNeeded=false;if(RegistrationForm.nameTooltipState!="success"){RegistrationForm.nameTooltipState="success";RegistrationForm.createNameSuccessTooltip();Tips.get("register-name-check").hideTip()}$("registration-overlay").style.display="none";RegistrationForm._toggleFormSection("register-section-3",false);
RegistrationForm.personalInfoDisabled=false;RegistrationForm.nameSuggestionEnabled=false;$("register-password").focus()},_showErrorBubble:function(G,B,E){var A=$("register-buttons");var C=Builder.node("div",{id:G,className:"bubbletip"},[Builder.node("div",{className:"title"}),Builder.node("div",{id:"error-bubble-content",className:"content"})]);
A.appendChild(C);$("error-bubble-content").innerHTML=B;Element.hide(C);if(E){E()}var F=Element.getDimensions(C);var D=Element.getDimensions(A);C.style.left=(D.width-F.width/2-50)+"px";C.style.top=($("register-button-continue").offsetTop-F.height-50)+"px";Element.show(C)},_calculateAge:function(){var E=$F("bean_year");
var F=$F("bean_month");var C=$F("bean_day");if(E&&F&&C){var D=new Date();var A=new Date();A.setFullYear(E,F-1,C);var B=D.getFullYear()-A.getFullYear();if((A.getMonth()>D.getMonth())||(A.getMonth()==D.getMonth()&&A.getDate()>D.getDate())){B--}if(B>=0){return B}}return -1},_disableFormFields:function(D,C){var B=$("registerform");
var A=B.getElementsByTagName("*");$A(A).each(function(F){if((F.tagName.toLowerCase()=="select"||F.tagName.toLowerCase()=="input")&&F.type!="hidden"&&C.indexOf(F.id)==-1){F.disabled=true;if(D){if(F.type!="button"&&F.type!="submit"){var G=F.value;var E=F.name;if((F.type!="radio"&&F.type!="checkbox")||(F.type=="radio"&&F.checked)||(F.type=="checkbox"&&F.checked)){B.appendChild(Builder.node("input",{type:"hidden",name:E,value:G}))
}F.name=E+"Disabled"}}}})},_toggleFormSection:function(B,A){var D=$(B);var C=D.getElementsByTagName("*");$A(C).each(function(E){if(E.tagName.toLowerCase()=="select"||E.tagName.toLowerCase()=="input"){E.disabled=A}})},_track:function(A){if(window.pageTracker){pageTracker._trackPageview("/register/"+A)
}}};RegistrationForm.Validator={_lastCheckedName:null,_lastCheckedPassword:null,_lastCheckedEmail:null,_lastCheckedParentEmail:null,_lastCheckedCaptcha:null,_nameCheckNeeded:true,_captchaOk:false,_parentEmailOk:false,validate:function(){var B=true;var A=function(C,D){if(!D()){B=false;RegistrationForm.Validator._showErrorState($(C),true);
RegistrationForm.elementFocused=C}};RegistrationForm.elementFocused="";if(!RegistrationForm.personalInfoDisabled){A("register-terms-content",function(){return !!$F("register-terms-check")});if(!!$("register-birthday")){A("register-birthday",function(){if(!$F("bean_year")||!$F("bean_month")||!$F("bean_day")){return false
}else{if(new Date().setFullYear($F("bean_year"),$F("bean_month")-1,$F("bean_day"))>new Date()){return false}}return true})}if(!!$("register-email")){A("register-email",function(){if($F("register-email")==""){RegistrationForm.emailTooltipState="enter"}return RegistrationForm.Validator.validateEmail($F("register-email"))&&!$("register-email").hasClassName("error")
});A("register-email2",function(){if(!$("register-email").hasClassName("error")){if($F("register-email2")==""){RegistrationForm.emailTooltipState="retype"}else{if($F("register-email")!=$F("register-email2")){RegistrationForm.emailTooltipState="notsame";RegistrationForm.createRetypedEmailNotSameTootip()
}}return RegistrationForm.Validator.validateEmail($F("register-email2"))&&$F("register-email")==$F("register-email2")}return true})}if(!!$("register-password")){A("register-password",function(){if($F("register-password")==""){RegistrationForm.passwordTooltipState="enter";RegistrationForm.createEnterPasswordTooltip()
}return !!$F("register-password")&&!$("register-password").hasClassName("error")});A("register-password2",function(){if(!$("register-password").hasClassName("error")){if($F("register-password2")==""){RegistrationForm.passwordTooltipState="retype";RegistrationForm.createRetypePasswordTooltip()}else{if($F("register-password")!=$F("register-password2")){RegistrationForm.emailTooltipState="notsame";
RegistrationForm.createRetypedPasswordNotSameTootip()}}return !!$F("register-password2")&&$F("register-password")==$F("register-password2")}return true})}}if(!!$("register-name")){A("register-name",function(){if($F("register-name")==""){RegistrationForm.nameTooltipState="enter";RegistrationForm.createEnterNameToolTip()
}return !!$F("register-name")&&!$("register-name").hasClassName("error")})}if($("register-parentEmail")){A("parentEmail",function(){RegistrationForm.Validator.checkParentEmailValidity();return RegistrationForm.Validator._parentEmailOk})}if($("recaptcha_response_field")){A("recaptcha_response_field",function(){var C=!!$F("recaptcha_response_field");
if(C){RegistrationForm.Validator._captchaOk=true}return !!$F("recaptcha_response_field")})}RegistrationForm.Validator._showNonFieldTips();return B},checkNameAvailability:function(){Tips.get("register-name-check").hideTip();var A=$F("register-name");if(A!=""&&RegistrationForm.Validator._nameCheckNeeded){$("register-name").addClassName("register-loading");
RegistrationForm.Validator._lastCheckedName=A;new Ajax.Request(habboReqPath+"habblet/ajax_namecheck.php",{method:"post",parameters:{name:A},onComplete:function(C,D){$("register-name").removeClassName("register-loading");if(D.registration_name_in_use||D.registration_name){$("register-name").removeClassName("register-ok");
$("register-name").addClassName("error");var B;if(D.registration_name_in_use&&C.responseText!=""){B=C.responseText;RegistrationForm.nameSuggestionEnabled=true}else{B=(D.registration_name)?D.registration_name:D.registration_name_in_use}new Tip("register-name",B,{className:"bubbletip left",title:" ",hook:{target:"topRight",tip:"bottomRight"},offset:{x:85,y:-3},fixed:true,startEvent:"focus",endEvent:null});
RegistrationForm.Validator._boundNameClickObserver=RegistrationForm.Validator._nameClickObserver.bindAsEventListener(document);RegistrationForm.Validator._nameCheckNeeded=true;Event.observe(document,"click",RegistrationForm.Validator._boundNameClickObserver);$("register-name").focus();Tips.get("register-name").showTip()
}else{RegistrationForm.Validator._showSuccessState($("register-name"));if(RegistrationForm.nameTooltipState!="success"){RegistrationForm.nameTooltipState="success";RegistrationForm.createNameSuccessTooltip()}$("name-error-box").hide();RegistrationForm.Validator._nameCheckNeeded=false;Event.stopObserving(document,"click",RegistrationForm.Validator._boundNameClickObserver);
$("registration-overlay").style.display="none";RegistrationForm._toggleFormSection("register-section-3",false);RegistrationForm.personalInfoDisabled=false;$("register-password").focus()}}})}else{if(A==""){$("register-name").removeClassName("register-ok")}}},checkEmailValidity:function(){var B=$F("register-email");
var A=$("register-email");if(B!=RegistrationForm.Validator._lastCheckedEmail&&RegistrationForm.Validator.validateEmail(B)){RegistrationForm.Validator._lastCheckedEmail=B;new Ajax.Request(habboReqPath+"habblet/ajax_emailcheck.php",{method:"post",parameters:{email:B},onComplete:function(E,F){if(F=="emailOk"){var D=$F("register-email2");
var C=$("register-email2");if(!!D&&D==B){RegistrationForm.Validator._resetErrorState(C);RegistrationForm.Validator._showSuccessState(C);RegistrationForm.emailTooltipState="success";RegistrationForm.createEmailSuccessTooltip()}else{if(!!D&&D!=""){RegistrationForm.Validator._showErrorState(C,false);if(RegistrationForm.emailTooltipState!="notsame"){RegistrationForm.emailTooltipState="notsame";
RegistrationForm.createRetypedEmailNotSameTootip()}}else{if(RegistrationForm.emailTooltipState!="retype"){RegistrationForm.emailTooltipState="retype";RegistrationForm.createRetypeEmailTooltip()}}}A.removeClassName("error");A.addClassName("register-ok")}else{RegistrationForm.Validator._showErrorState(A,false);
if(RegistrationForm.emailTooltipState!="invalid"){RegistrationForm.emailTooltipState="invalid";RegistrationForm.createInvalidEmailTooltip()}}Tips.get(A).showTip()}})}},checkParentEmailValidity:function(){var B=$F("register-parentEmail-bubble");var A=$("register-parentEmail-bubble");if(B!=""&&$("register-permission-bubble")&&!$F("register-permission-bubble")){RegistrationForm.Validator._parentEmailOk=false;
$("parentEmail-error-box-content").innerHTML=L10N.get("register.error.parent_permission");$("parentEmail-error-box").setStyle({display:"block"})}else{if($F("register-parentEmail-bubble")==$F("register-email")){RegistrationForm.Validator._showErrorState(A,true);RegistrationForm.Validator._parentEmailOk=false;
$("parentEmail-error-box-content").innerHTML=L10N.get("register.tooltip.emailandparentemailsame");$("parentEmail-error-box").setStyle({display:"block"})}else{if(B!=""&&B!=RegistrationForm.Validator._lastCheckedParentEmail&&RegistrationForm.Validator.validateEmail(B)){RegistrationForm.Validator._lastCheckedParentEmail=B;
new Ajax.Request(habboReqPath+"habblet/ajax_emailcheck.php",{method:"post",parameters:{email:B},onComplete:function(C,D){if(D=="emailOk"){$("parentEmail-error-box-content").innerHTML=L10N.get("register.tooltip.emailsuccess");A.removeClassName("error");A.addClassName("register-ok");RegistrationForm.Validator._parentEmailOk=true;
if($("register-captcha-bubble")&&!RegistrationForm.Validator._captchaOk){$("register-captcha-bubble").focus()}else{$("registerform").submit()}}else{RegistrationForm.Validator._showErrorState(A,true);$("parentEmail-error-box-content").innerHTML=L10N.get("register.tooltip.invalidemail");RegistrationForm.Validator._parentEmailOk=false;
$("parentEmail-error-box").setStyle({display:"block"})}}})}else{if(B!=""&&B!=RegistrationForm.Validator._lastCheckedParentEmail){RegistrationForm.Validator._showErrorState(A,true);RegistrationForm.Validator._parentEmailOk=false;$("parentEmail-error-box-content").innerHTML=L10N.get("register.tooltip.invalidemail");
$("parentEmail-error-box").setStyle({display:"block"})}}}}},checkCapchaValidity:function(A){RegistrationForm.Validator._captchaOk=Event.element(A).value!=""},checkPasswordValidity:function(){var A=$("register-password");var B=$F("register-password");if(B&&B.length>=6&&B!=RegistrationForm.Validator._lastCheckedPassword){RegistrationForm.Validator._lastCheckedPassword=B;
new Ajax.Request(habboReqPath+"habblet/ajax_password.php",{method:"post",parameters:{password:B},onComplete:function(D,F){if(F=="charOk"){var E=$F("register-password2");var C=$("register-password2");if(!!E&&E==B){RegistrationForm.Validator._resetErrorState(C);RegistrationForm.Validator._showSuccessState(C);
RegistrationForm.passwordTooltipState="success";RegistrationForm.createPasswordSuccessTooltip()}else{if(!!E&&E!=""){RegistrationForm.Validator._showErrorState(C,false);if(RegistrationForm.passwordTooltipState!="notsame"){RegistrationForm.passwordTooltipState="notsame";RegistrationForm.createRetypedPasswordNotSameTootip()
}}else{if(RegistrationForm.passwordTooltipState!="retype"){RegistrationForm.passwordTooltipState="retype";RegistrationForm.createRetypePasswordTooltip()}}}A.removeClassName("error");A.addClassName("register-ok")}else{RegistrationForm.Validator._showErrorState(A,false);RegistrationForm.passwordTooltipState="error";
new Tip("register-password",D.responseText,Object.extend(RegistrationForm.defaultPos,RegistrationForm.registrationTipStyle))}Tips.get(A).showTip()}})}},_showErrorState:function(B,A){B.removeClassName("register-ok");B.addClassName("error");if(A&&!B.disabled){B.focus()}},_showSuccessState:function(A){A.removeClassName("error");
A.addClassName("register-ok")},_resetErrorState:function(A){A.removeClassName("error");A.removeClassName("register-ok")},validateEmail:function(A){return !!A&&A.search(/[^@]+@[^@]+/i)!=-1},_nameClickObserver:function(B){var A=Event.element(B);if(A.className=="namelist-link"){Event.stop(B);RegistrationForm.updateNameFromBubble(A.name)
}else{if(A.id!="register-name"){Tips.get($("register-name")).hideTip()}}},_checkName:function(){var A=$F("register-name");if(A!=""&&A!=RegistrationForm.Validator._lastCheckedName){RegistrationForm.Validator._resetErrorState($("register-name"));RegistrationForm.Validator.checkNameAvailability()}else{$("register-name").focus()
}},_showNonFieldTips:function(){if(RegistrationForm.elementFocused=="register-birthday"){Tips.get("register-birthday").showTip()}else{if(RegistrationForm.elementFocused=="register-terms-content"){Tips.get("register-terms-content").showTip()}}}};var HabboEditor=function(){var D=true;var A=null;var B=null;
var C=[];return{addCallback:function(E,F){if(!C[E]){C[E]=[]}C[E].push(F)},setGenderAndFigure:function(F,E){this.setGender(F);this.setFigure(E)},setFigure:function(E){A=E;if(C.setFigure){C.setFigure.each(function(F){F(E)})}},setGender:function(E){B=E;if(C.setGender){C.setGender.each(function(F){F(E)})
}},setAllowedToProceed:function(E){D=E;if(C.setAllowedToProceed){C.setAllowedToProceed.each(function(F){F(E)})}},isAllowedToProceed:function(){return D},showHabboClubNotice:function(){if(C.showHabboClubNotice){C.showHabboClubNotice.each(function(E){E()})}},hideHabboClubNotice:function(){if(C.hideHabboClubNotice){C.hideHabboClubNotice.each(function(E){E()
})}},showOldFigureNotice:function(){if(C.showOldFigureNotice){C.showOldFigureNotice.each(function(E){E()})}},hideOldFigureNotice:function(){if(C.hideOldFigureNotice){C.hideOldFigureNotice.each(function(E){E()})}},setEditorState:function(E){if(C.setEditorState){C.setEditorState.each(function(F){F(E)})
}}}}();