var emailAlreadySent=!1;function initReg(e,a,t){var o=new XMLHttpRequest;o.open("GET",url+"/register/init/"+e),o.onreadystatechange=function(){if(4==o.readyState){var e=$.parseJSON(o.responseText);"SUCCESS"==e.status?$("#"+a).append('<input type="hidden" value="'+e.hashcode+'" name="hash" id="hash" />'):alert("Please check the game!"),e.gameInfo.emailConfirmationRequired&&alert("DOI Registration is not possible"),e.gameInfo.registrationEnabled||alert("Registration disabled"),initPolicies(e),gameaccountname_too_short=gameaccountname_too_short.replace("%usernameLengthMin%",e.gameInfo.policies.usernameLengthMin),gameaccountname_too_long=gameaccountname_too_long.replace("%usernameLengthMax%",e.gameInfo.policies.usernameLengthMax),password_too_short=password_too_short.replace("%passwordLengthMin%",e.gameInfo.policies.passwordLengthMin),password_too_long=password_too_long.replace("%passwordLengthMax%",e.gameInfo.policies.passwordLengthMax)}},o.send()}function initComplete(e,a,t){var o=new XMLHttpRequest;o.open("GET",url+"/emailonly/init/"+e),o.onreadystatechange=function(){if(4==o.readyState){var e=$.parseJSON(o.responseText);"SUCCESS"==e.status?$("#"+a).append('<input type="hidden" value="'+e.hashcode+'" name="hash" id="hash" />'):alert("Please check the game!"),e.gameInfo.emailConfirmationRequired&&alert("DOI Registration is not possible"),e.gameInfo.registrationEnabled||alert("Registration disabled"),initPolicies(e),gameaccountname_too_short=gameaccountname_too_short.replace("%usernameLengthMin%",e.gameInfo.policies.usernameLengthMin),gameaccountname_too_long=gameaccountname_too_long.replace("%usernameLengthMax%",e.gameInfo.policies.usernameLengthMax),password_too_short=password_too_short.replace("%passwordLengthMin%",e.gameInfo.policies.passwordLengthMin),password_too_long=password_too_long.replace("%passwordLengthMax%",e.gameInfo.policies.passwordLengthMax)}},o.send()}function submitEmail(e){showLoading(),hideError();var a=url+"/emailonly/signup",t=new XMLHttpRequest;t.open("POST",a),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){if(4==t.readyState){hideLoading();var e=$.parseJSON(t.responseText);e.hasOwnProperty("hashcode")&&$("#hash").val(e.hashcode),"NEW_GAME_ACCOUNT"==e.status&&showEmail(),"EMAIL_ALREADY_OCCUPIED"==e.status&&(emailAlreadySent||(emailAlreadySent=!0,$("#emailScenario").val("ALL"),submitEmail("registergame_form"),showEmail())),"EMAIL_INVALID"==e.status&&invalidEmail(),"NEW_GAME_AND_GAS_ACCOUNT"==e.status&&showEmail(),"EXISTING_GAME_ACCOUNT"==e.status&&showAccount(),"FAILURE"==e.status&&showError(e.failure.code)}},t.send($("#"+e).serialize())}function submitComplete(e){showLoading(),hideError();var a=url+"/emailonly/complete",t=new XMLHttpRequest;t.open("POST",a),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){if(4==t.readyState){hideLoading();var e=$.parseJSON(t.responseText);e.hasOwnProperty("hashcode")&&$("#hash").val(e.hashcode),"SUCCESS"!=e.status||"AUTO"!=e.successaction&&"BY_EMAIL"!=e.successaction||(successAction(e),partnerTracking(e.trackInfo)),"SUCCESS"==e.status&&"BY_USER_PASSWORD"==e.successaction&&!$("#gaspassword").length>0&&addPasswordElement(),"FAILURE"==e.status&&(e.hasOwnProperty("nametip")&&"function"==typeof showNametip?showNametip(e.nametip):showError(e.failure.code),e.hasOwnProperty("tooltipps")&&"function"==typeof showTooltip&&showTooltip(e.tooltips))}},t.send($("#"+e).serialize())}function submitForm(e){showLoading(),hideError();var a=url+"/register/signup",t=new XMLHttpRequest;t.open("POST",a),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){if(4==t.readyState){hideLoading();var e=$.parseJSON(t.responseText);e.hasOwnProperty("hashcode")&&$("#hash").val(e.hashcode),"SUCCESS"==e.status&&"AUTO"==e.successaction&&(successAction(e),partnerTracking(e.trackInfo)),"SUCCESS"==e.status&&"BY_USER_PASSWORD"==e.successaction&&!$("#gaspassword").length>0&&addPasswordElement(),"FAILURE"==e.status&&(e.hasOwnProperty("nametip")&&"function"==typeof showNametip?showNametip(e.nametip):showError(e.failure.code),e.hasOwnProperty("tooltipps")&&"function"==typeof showTooltip&&showTooltip(e.tooltips))}},t.send($("#"+e).serialize())}function partnerTracking(e){var a="?check=1";$("#pl").length>0&&(a=a+"&pl="+$("#pl").val()),$("#pubID").length>0&&(a=a+"&pubID="+$("#pubID").val()),$("#pubsub").length>0&&(a=a+"&pubsub="+$("#pubsub").val()),e.char&&(a=a+"&char="+e.char),e.actionkey&&(a=a+"&actionkey="+e.actionkey);var t=decodeURIComponent((RegExp("account=(.+?)(&|$)").exec(location.search)||[,""])[1]);""!=t&&(a=a+"&account="+t+"&invitee="+$("#accountName").val());var o='<iframe src="'+url+"/partner/"+e.gameaccountid+"/"+e.affiliateId+"/"+e.gameversionkey+a+'" />';$("#partnercontainer").html(o)}