var PassportScore={loginPost:"http://passport.gamedp.com/dologon.axd?",loginGet:"http://passport.gamedp.com/dologin.axd?",checkCodeUrl:"http://passport.gamedp.com/ConfirmationCode.ashx",getUserStateUrl:"http://passport.gamedp.com/loginstatus.axd?",regUrl:"http://passport.gamedp.com/Account/Register?",getPwdUrl:"http://passport.gamedp.com/Account/ResetPassword?",checkUsernameExist:"http://payment.gamedp.com/Passport/PassportAPI.php?",loginNum:"1",loginToken:"123",receiveUrl:"",goUrl:"",domain:"",init:function(){},checkUserState:function(){var B=this.getCookie("PASSPORT_LOGINCOUNT");if(this.domain==""){this.domain=this.getDomain()}this.SetCookie("PASSPORT_LOGINCOUNT","1",null,null,"."+this.domain,false);if(B!="1"){var A=this.getUserStateUrl+"a="+this.loginNum+"&t="+this.loginToken+"&json=true&jsoncallback=?";$.getJSON(A,function(D){if(D!=""){var C;C=D.split(":");if(C[2]=="logon=true"){A=this.loginGet+"a="+this.loginNum+"&t="+this.loginToken+"&d="+firstLogin+"&r="+this.receiveUrl+this.goUrl;window.location.href=A}}})}},loginSucess:function(){},showLoginForm:function(){return""},showRegForm:function(){return""},loginOut:function(){},submitCheck:function(){var B=$("#username");var D=$("#password");var E=$("#safecode");var A=$("#btnLogin");if(B.val().length<4||B.val().length>50){alert("4-20 characters in length required.");B.focus();return false}if(D.val().length<4||D.val().length>20){alert("4-20 characters in length required.");D.focus();return false}if(E.val().length!=4){alert("Type the characters you see in the picture");E.focus();return false}var C=this.loginPost+"a="+this.loginNum+"&t="+this.loginToken+"&username="+B.val()+"&password="+D.val()+"&safecode="+E.val()+"&json=true&jsoncallback=?";$.getJSON(C,function(G){var F=false;switch(G){case"EU":alert("The account or password you entered is incorrect,please check it.");B.focus();F=false;break;case"EP":alert("Incorrect password, please retype the password.");D.focus();F=false;break;case"ES":alert("Incorrect verification code, please retype the verification code.");E.focus();F=false;break;case"EA":alert("The account or password you entered is incorrect, please check it.");$("#username").val("");$("#password").val("");B.focus();F=false;break;case"OK":F=true}if(F){$("#loginForm").submit()}});return false},RegCheck:function(){var C=$("#password");var D=$("#safecode");if(C.val().length<4||C.val().length>20){alert("4-20 characters in length required.");C.focus();return false}if(D.val().length!=4){alert("Type the characters you see in the picture");D.focus();return false}var A=$("#username");var B=this.checkUsernameExist+"act=userExistJson&NA="+A+"&json=true&jsoncallback=?";$.getJSON(B,function(F){var E=false;if(F.result=="ok"){alert("Account already existed.");$("#username").focus()}else{$("#allowReg").val(true);E=true}if(E){$("#loginForm").submit()}});return true},UsernameBlur:function(){$("#passwordtips").text("");var B=$("#username").val();if(!this.CheckEmail(B)){$("#usernametips").text("please input email address.");$("#username").focus();return }if(B){var A=this.checkUsernameExist+"act=userExistJson&NA="+B+"&json=true&jsoncallback=?";$.getJSON(A,function(C){if(C.result=="ok"){$("#usernametips").text("Account already existed.");$("#username").focus()}else{$("#usernametips").text("");$("#allowReg").val(true)}})}},PasswordBlur:function(){if(!$("#allowReg").val()){return }$("#confirmPasswordtips").text("");var A=$("#password");if(A.val().length<4||A.val().length>20){$("#passwordtips").text("4-20 characters in length required.")}},ConfirmPasswordBlur:function(){$("#passwordtips").text("");var A=$("#confirmPassword");var B=$("#password");if(A.val()!=B.val()){$("#confirmPasswordtips").text("Password does not match, please retype it.")}},SafecodeBlur:function(){var A=$("#safecode");if(A.val().length!=4){$("#safecodetips").text("Type the characters you see in the picture");return false}},refreshimg:function(){var A=$("#passportYZM").attr("src");A+="?"+Math.round(Math.random()*100000);$("#passportYZM").attr("src",A)},CheckEmail:function(B){var A=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;if(B!=""){if(A.test(B)){return true}}return false},getDomain:function(){var B=document.domain.split(".");var A=B.length;if(A<=2){return document.domain}return B[A-2]+"."+B[A-1]},SetCookie:function(C,F,B,H,E,G){var D=new Date();if(B!=null){D.setTime(D.getTime()+(B*1000))}var A=C+"="+escape(F)+((B==null)?"":("; expires="+D.toGMTString()))+((H==null)?"":("; path="+H))+((E==null)?"":("; domain="+E))+((G==true)?"; secure":"");document.cookie=A},getCookie:function(D){var B=D+"=";var F=B.length;var A=document.cookie.length;var E=0;while(E<A){var C=E+F;if(document.cookie.substring(E,C)==B){return this.getCookieVal(C)}E=document.cookie.indexOf(" ",E)+1;if(E==0){break}}return null},getCookieVal:function(B){var A=document.cookie.indexOf(";",B);if(A==-1){A=document.cookie.length}return unescape(document.cookie.substring(B,A))},delCookie:function(A){var C=new Date();C.setTime(C.getTime()-1);var B=this.getCookie(A);document.cookie=A+"="+B+"; expires="+C.toGMTString()},iniLoginForm:function(){$("#btnSubmit").click(function(){return PassportScore.submitCheck()});$(document).ready(function(){$("#username").focus()})},iniRegForm:function(){$("#btnReg").click(function(){return PassportScore.RegCheck()});$("#username").blur(function(A){PassportScore.UsernameBlur()});$("#password").blur(function(A){PassportScore.PasswordBlur()});$("#confirmPassword").blur(function(A){PassportScore.ConfirmPasswordBlur()});$("#safecode").blur(function(A){PassportScore.SafecodeBlur()});$(document).ready(function(){$("#username").focus()})},userNameKeyUp:function(){if(event.keyCode==13){$("#password").focus()}},pwdKeyUp:function(){if(event.keyCode==13){$("#safecode").focus()}},checkCodeKeyUp:function(){if(event.keyCode==13){this.submitCheck()}}}
