$(function(){$(".up_registration_row").css("height","37px");email_default=$("#f_email_error_content").html();$("#registration_form #f_email").focus(function(){$("#f_email_error_content").html(email_default);$("#f_email_error").hide();$("#f_email_ok").hide();$("#f_email_help > div").show()});$("#registration_form #f_email").blur(function(){H($("#f_email").val())});function H(N){if(G(N)){$.get("/ajax/register.php?a=email",{email:$("input#f_email").val()},function(O,P){if(O.status==1){$("#f_email_ok").show();$("#f_email_error").hide();$("input#f_email").removeClass("validationError");$("#f_email_help > div").hide()}else{$("#f_email_error_content").html(O.message);$("input#f_email").addClass("validationError");$("#f_email_error").show();$("#f_email_error").css("visibility","visible");$("#f_email_help > div").hide()}},"json")}else{$("input#f_email").addClass("validationError");$("#f_email_error").show();$("#f_email_error").css("visibility","visible");$("#f_email_help > div").hide()}}username_default=$("#f_username_error_content").html();$("#registration_form #f_username").focus(function(){$("#f_username_error_content").html(username_default);$("#f_username_error").hide();$("#f_username_ok").hide();$("#f_username_help > div").show()});$("#registration_form #f_username").blur(function(){J()});function J(){if($("#f_username").val().length>=3&&$("#f_username").val().length<=25){$.get("/ajax/register.php?a=username",{username:$("input#f_username").val()},function(N,O){if(N.status==1){$("#f_username_ok").show();$("#f_username_error").hide();$("input#f_username").removeClass("validationError");$("#f_username_help > div").hide()}else{$("#f_username_error_content").html(N.message);$("input#f_username").addClass("validationError");$("#f_username_error").show();$("#f_username_error").css("visibility","visible");$("#f_username_help > div").hide()}},"json")}else{$("input#f_username").addClass("validationError");$("#f_username_error").show();$("#f_username_error").css("visibility","visible");$("#f_username_help > div").hide()}}password_default=$("#f_password_error_content").html();$("#registration_form #f_password").focus(function(){$("#f_password_error_content").html(password_default);$("#f_password_error").hide();$("#f_password_ok").hide();$("#f_password_help > div").show()});$("#registration_form #f_password").blur(function(){A()});function A(){if($("#f_password").val().length>=6){$("#f_password_ok").show();$("#f_password_error").hide();$("input#f_password").removeClass("validationError");$("#f_password_help > div").hide()}else{$("input#f_password").addClass("validationError");$("#f_password_error").show();$("#f_password_error").css("visibility","visible");$("#f_password_help > div").hide()}}password_repeat_default=$("#f_password_repeat_error_content").html();$("#registration_form #f_password_repeat").focus(function(){$("#f_password_repeat_error_content").html(password_repeat_default);$("#f_password_repeat_error").hide();$("#f_password_repeat_ok").hide();$("#f_password_repeat_help > div").show()});$("#registration_form #f_password_repeat").blur(function(){I()});function I(){if($("#f_password_repeat").val().length!=0&&$("#f_password_repeat").val()==$("#f_password").val()){$("#f_password_repeat_ok").show();$("#f_password_repeat_error").hide();$("input#f_password_repeat").removeClass("validationError");$("#f_password_repeat_help > div").hide()}else{$("input#f_password_repeat").addClass("validationError");$("#f_password_repeat_error").show();$("#f_password_repeat_error").css("visibility","visible");$("#f_password_repeat_help > div").hide()}}f_givenname_default=$("#f_givenname_error_content").html();$("#registration_form #f_givenname").focus(function(){$("#f_givenname_error_content").html(f_givenname_default);$("#f_givenname_error").hide();$("#f_givenname_ok").hide();$("#f_givenname_help > div").show()});$("#registration_form #f_givenname").blur(function(){D()});function D(){if($("#f_givenname").val().length>1){$("#f_givenname_ok").show();$("#f_givenname_error").hide();$("input#f_givenname").removeClass("validationError");$("#f_givenname_help > div").hide()}else{$("input#f_givenname").addClass("validationError");$("#f_givenname_error").show();$("#f_givenname_error").css("visibility","visible");$("#f_givenname_help > div").hide()}}f_lastname_default=$("#f_lastname_error_content").html();$("#registration_form #f_lastname").focus(function(){$("#f_lastname_error_content").html(f_lastname_default);$("#f_lastname_error").hide();$("#f_lastname_ok").hide();$("#f_lastname_help > div").show()});$("#registration_form #f_lastname").blur(function(){C()});function C(){if($("#f_lastname").val().length>1){$("#f_lastname_ok").show();$("#f_lastname_error").hide();$("input#f_lastname").removeClass("validationError");$("#f_lastname_help > div").hide()}else{$("input#f_lastname").addClass("validationError");$("#f_lastname_error").show();$("#f_lastname_error").css("visibility","visible");$("#f_lastname_help > div").hide()}}male=0;$("#registration_form #f_male").click(function(){male=1;$("#f_male_ok").show();$("#f_male_error").hide();$("#f_male_help > div").hide()});$("#registration_form #f_female").click(function(){male=1;$("#f_male_ok").show();$("#f_male_error").hide();$("#f_male_help > div").hide()});birth_year_error=1;birth_month_error=1;birth_day_error=1;$("#registration_form #f_dob_month").change(function(){M()});function M(){val=$("#f_dob_month").val();if(val==-1){$("select#f_dob_month").addClass("validationError");$("#f_dob_error_content > div:eq(0)").html(lang.what_month);$("#f_dob_noselect_error_text").show();$("#f_dob_error").show();$("#f_dob_noselect_error_text").css("visibility","visible");$("#f_dob_help > div").hide();$("#f_dob_ok").hide();birth_month_error=1}else{birth_month_error=0;$("select#f_dob_month").removeClass("validationError");$("#f_dob_error_content > div:eq(0)").html("");if(birth_year_error==0&&birth_month_error==0&&birth_day_error==0){$("#f_dob_noselect_error_text").hide();$("#f_dob_error").hide();$("#f_dob_ok").show()}}}$("#registration_form #f_dob_day").change(function(){K()});function K(){val=$("#f_dob_day").val();if(val==-1){$("select#f_dob_day").addClass("validationError");$("#f_dob_error_content > div:eq(1)").html(lang.what_date);$("#f_dob_noselect_error_text").show();$("#f_dob_error").show();$("#f_dob_noselect_error_text").css("visibility","visible");$("#f_dob_help > div").hide();$("#f_dob_ok").hide();birth_day_error=1}else{birth_day_error=0;$("select#f_dob_day").removeClass("validationError");$("#f_dob_error_content > div:eq(1)").html("");if(birth_year_error==0&&birth_month_error==0&&birth_day_error==0){$("#f_dob_noselect_error_text").hide();$("#f_dob_error").hide();$("#f_dob_ok").show()}}}$("#registration_form #f_dob_year").change(function(){L()});function L(){val=$("#f_dob_year").val();if(val==-1){$("select#f_dob_year").addClass("validationError");$("#f_dob_error_content > div:eq(2)").html(lang.what_year);$("#f_dob_noselect_error_text").show();$("#f_dob_error").show();$("#f_dob_noselect_error_text").css("visibility","visible");$("#f_dob_help > div").hide();$("#f_dob_ok").hide();birth_year_error=1}else{birth_year_error=0;$("select#f_dob_year").removeClass("validationError");$("#f_dob_error_content > div:eq(2)").html("");if(birth_year_error==0&&birth_month_error==0&&birth_day_error==0){$("#f_dob_noselect_error_text").hide();$("#f_dob_error").hide();$("#f_dob_ok").show()}}if(val>2002){}}$("#registration_form div.submit").click(function(){if($("#f_username_ok").is(":hidden")){J();return }if($("#f_password_ok").is(":hidden")){A();return }if($("#f_password_repeat_ok").is(":hidden")){I();return }if($("#f_email_ok").is(":hidden")){H($("#f_email").val());return }if($("#f_givenname_ok").is(":hidden")){D();return }if($("#f_lastname_ok").is(":hidden")){C();return }if($(".validateMe:radio:checked").length==0){$("#f_male_error").show();$("#f_male_error").css("visibility","visible");return }if(birth_year_error==1||birth_month_error==1||birth_day_error==1){M();K();L();return }$.post("/ajax/register.php?a=register&t="+new Date().getTime(),{register_submit:1,username:$("#f_username").val(),password:$("#f_password").val(),confirm_password:$("#f_password_repeat").val(),email:$("#f_email").val(),firstname:$("#f_givenname").val(),lastname:$("#f_lastname").val(),gender:$(".validateMe:radio:checked").val(),bm:$("#f_dob_month").val(),bd:$("#f_dob_day").val(),by:$("#f_dob_year").val()},function(N,O){if(N.status==1){$.cookie("remember",0,{path:"/"});$.cookie("userid",N.id,{path:"/"});$.cookie("username",N.username,{path:"/"});$.cookie("avatar",N.avatar,{path:"/"});$.cookie("level",N.level,{path:"/"});$.cookie("points",N.points,{path:"/"});$.cookie("last_visit",N.last_visit,{path:"/"});window.location.href="/registration_complete.html"}else{}},"json");return false});forgot_email_default=$("#f_email_error_content").html();$("#forgot_password_form #f_email").focus(function(){$("#f_email_error_content").html(forgot_email_default);$("#f_email_error").hide();$("#f_email_ok").hide();$("#f_email_help").show()});$("#forgot_password_form #f_email").blur(function(){E($("#f_email").val())});function E(N){if(G(N)){$.get("/ajax/register.php?a=email",{email:$("input#f_email").val()},function(O,P){if(O.status==1){$("#f_email_ok").show();$("#f_email_error").hide();$("input#f_email").removeClass("validationError");$("#f_email_help > div").hide()}else{$("#f_email_error_content").html(O.message);$("input#f_email").addClass("validationError");$("#f_email_error").show();$("#f_email_error").css("visibility","visible");$("#f_email_help > div").hide()}},"json")}else{$("input#f_email").addClass("validationError");$("#f_email_error").show();$("#f_email_error").css("visibility","visible");$("#f_email_help > div").hide()}}$("#forgot_password_form #f_submit").click(function(){if(G($("#f_email").val())){$.post("/ajax/register.php?a=forget_password",{email:$("#f_email").val()},function(N,O){if(N.status==1){$("#forgot_password_form_box").hide();$("#forgot_password_confirmation_box").fadeIn()}else{$("#f_email_error_content").html(N.message);$("input#f_email").addClass("validationError");$("#f_email_ok").hide();$("#f_email_error").show();$("#f_email_error").css("visibility","visible");$("#f_email_help > div").hide()}},"json")}});$("#forgot_password_form #f_cancel").click(function(){if(document.referrer==window.location.href){window.location.href="/"}else{window.location.href=document.referrer}});$("#forgot_password_form #f_continue").click(function(){if(document.referrer==window.location.href){window.location.href="/"}else{window.location.href=document.referrer}});password_default=$("#f_password_error_content").html();$("#new_password_form #f_password").focus(function(){$("#f_password_error_content").html(password_default);$("#f_password_error").hide();$("#f_password_ok").hide();$("#f_password_help").show()});$("#new_password_form #f_password").blur(function(){B()});function B(){if($("#f_password").val().length>=6){$("#f_password_ok").show();$("#f_password_error").hide();$("input#f_password").removeClass("validationError");$("#f_password_help").hide()}else{$("input#f_password").addClass("validationError");$("#f_password_error_content").prepend(lang.password_6);$("#f_password_error").show();$("#f_password_error").css("visibility","visible");$("#f_password_help").hide()}}newpassword_repeat_default=$("#f_password_repeat_error_content").html();$("#new_password_form #f_password_repeat").focus(function(){$("#f_password_repeat_error_content").html(newpassword_repeat_default);$("#f_password_repeat_error").hide();$("#f_password_repeat_ok").hide();$("#f_password_repeat_help").show()});$("#new_password_form #f_password_repeat").blur(function(){F()});function F(){if($("#f_password_repeat").val().length!=0&&$("#f_password_repeat").val()==$("#f_password").val()){$("#f_password_repeat_ok").show();$("#f_password_repeat_error").hide();$("input#f_password_repeat").removeClass("validationError");$("#f_password_repeat_help").hide()}else{$("input#f_password_repeat").addClass("validationError");$("#f_password_repeat_error").show();$("#f_password_repeat_error").css("visibility","visible");$("#f_password_repeat_help").hide()}}$("#new_password_form #f_submit").click(function(){var N=$().getParmByUrl("id");$.post("/ajax/register.php?a=reset_password",{id:$().getParmByUrl("id"),key:$().getParmByUrl("k"),username:$().getParmByUrl("username"),new_password:$("#f_password").val()},function(O,P){if(O.status==1){}else{}},"json")});$("#new_password_form #f_cancel").click(function(){window.location.href="/"});function G(N){var O=new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");if(!O.test(N)||N.indexOf(".")==-1){return false}else{return true}}})

