$(function(){var b=["/graphics/pop_up_bgr.jpg","/graphics/close_btn.gif","/graphics/btn_bgr.jpg","/graphics/modal-loader.gif"];for(x in b){(new Image).src=b[x];}jQuery.easing.def="easeOutQuad";function c(){var f=$(document).height();var h=$(window).width();var g=(h-$("#container").width())/-2;$("#qm_overlay").css({width:h,height:f,left:g});$("#qm_overlay").fadeIn("fast");}function a(f){f.fadeOut().fadeIn().fadeOut().fadeIn();}$("#more_info").click(function(){$.scrollTo($("#container_more_info"),{speed:1000});return false;});$(".prizes_link").click(function(){$.scrollTo($("#hdr_prizes"),{speed:1000});return false;});$(".spec_link").click(function(){$.scrollTo($("#hdr_spec"),{speed:1000});return false;});$("#back_to_top").click(function(){$.scrollTo("0",{speed:1000});return false;});$(".sign_up_link").click(function(){$.scrollTo("0",{speed:1000});$("#qmreg_window").fadeIn("fast");c();return false;});$("#sign_up_close").click(function(){$("#qmreg_window").fadeOut("fast");$("#qm_overlay").fadeOut("fast");return false;});$("#log_in").click(function(){$("#qmlog_window").fadeIn("fast");$(".modalInput:input").keypress(function(f){if(f.which==13){$("#btn_login").triggerHandler("click");}});c();return false;});$("#log_in_close").click(function(){$("#qmlog_window").fadeOut("fast");$("#qm_overlay").fadeOut("fast");return false;});$("#forgot_close").click(function(){$("#qmforgot_window").fadeOut("fast");$("#qm_overlay").fadeOut("fast");return false;});$(".coming_soon_link").click(function(){$.scrollTo("0",{speed:1000});$("#qmsoon_window").fadeIn("fast");c();return false;});$("#coming_soon_close").click(function(){$("#qmsoon_window").fadeOut("fast");$("#qm_overlay").fadeOut("fast");return false;});$("#forgotBtn").click(function(){$("#qmlog_window").fadeOut("fast",function(){$("#qmforgot_window").fadeIn("fast");});return false;});$("#forgotBtnReg").click(function(){$.scrollTo("0",{speed:1000});$("#forgot_id").val($("#signup_email").val());$("#qmreg_window").fadeOut("fast",function(){$("#qmforgot_window").fadeIn("fast");});return false;});$("#request_invite").click(function(){$("#qminvite_window").fadeIn("fast");$("#invite_email:input").keypress(function(f){if(f.which==13){$("#btn_invite").triggerHandler("click");}});c();return false;});$("#request_invite_in").click(function(){$("#qmreg_window").fadeOut("fast",function(){$("#qminvite_window").fadeIn("fast");c();});return false;});$("#invite_close").click(function(){$("#qminvite_window").fadeOut("fast");$("#qm_overlay").fadeOut("fast");return false;});function d(f){return/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(f);}function e(f){return(/^[^\"\'@;%| ]*$/.test(f));}$("#btn_login:not(.disabled)").click(function(){$(".feedback").fadeOut("fast");$("#btn_login").addClass("disabled");$("#modal-loader-login").show();$.ajax({type:"POST",url:"/login",data:"i="+$("#login_username").val()+"&p="+$("#login_password").val(),success:function(f){$("#btn_login").removeClass("disabled");if(f=="ok"){top.location.href="/lobby";}else{$(".feedback").fadeOut("fast");a($("#login_error"));$("#modal-loader-login").hide();}}});return false;});$("#btn_signup:not(.disabled)").live("click",function(){$(".feedback").fadeOut("fast");if(!($("#signup_agree").attr("checked")==true)){$(".feedback").fadeOut("fast");a($("#signup_agree_inv"));}else{if($("#signup_username").val().length<2){$(".feedback").fadeOut("fast");a($("#signup_username_inv"));}else{if($("#signup_username").val().length<2){$(".feedback").fadeOut("fast");a($("#signup_username_err"));}else{if($("#signup_password").val().length<6){$(".feedback").fadeOut("fast");a($("#signup_password_err"));}else{if(!d($("#signup_email").val())){$(".feedback").fadeOut("fast");a($("#signup_email_err"));}else{if(!e($("#signup_username").val())){$(".feedback").fadeOut("fast");a($("#signup_username_inv"));}else{$("#modal-loader-signup").show();$("#btn_signup").addClass("disabled");$.ajax({type:"POST",url:"/register",data:"i="+$("#signup_username").val()+"&p="+$("#signup_password").val()+"&e="+$("#signup_email").val()+"&c="+$("#signup_code").val()+"&a="+$("#signup_agree").attr("checked"),success:function(f){$("#btn_signup").removeClass("disabled");if(f=="ok"){a($("#signup_success"));}else{if(f=="er"){a($("#signup_id_err"));}if(f=="em"){a($("#signup_emailtaken_err"));}if(f=="in"){a($("#signup_code_err"));}}$("#modal-loader-signup").hide();}});}}}}}}return false;});$("#btn_forgot:not(.disabled)").live("click",function(){$(".feedback").fadeOut("fast");$("#modal-loader-forgot").show();$("#btn_forgot").addClass("disabled");$.ajax({type:"POST",url:"/forgot",data:"i="+$("#forgot_id").val(),success:function(f){$("#btn_forgot").removeClass("disabled");if(f=="ok"){a($("#forgot_sent"));}else{$(".feedback").fadeOut("fast");a($("#forgot_error"));}$("#modal-loader-forgot").hide();}});return false;});$("#btn_invite:not(.disabled)").live("click",function(){$(".feedback").fadeOut("fast");$("#modal-loader-invite").show();$("#btn_invite").addClass("disabled");$.ajax({type:"POST",url:"/inviteMe",data:"e="+$("#invite_email").val(),success:function(f){if(f=="ok"){a($("#invite_sent"));}else{$("#btn_invite").removeClass("disabled");$(".feedback").fadeOut("fast");a($("#invite_error"));}$("#modal-loader-invite").hide();}});return false;});$(".btn_close").click(function(){$(".feedback").fadeOut("fast");$(".modalBtn").fadeIn("fast");$("#btn_invite").removeClass("disabled");return false;});});