
﻿
var strHTML;$(function(){$("#hlForgotPassword").click(function(){return false;});$("#hlForgotPassword").bind("click",promptForEmail);});function promptForEmail()
{cacheStrings(["common.Send","common.Cancel","common.Continue","login.BtnForgotPass","login.InstructionsForgotPass","error.InvalidEmailAddress","login.pCheckEmail","error.NoSuchEmail"],function(){strHTML="<div id='popup' class='popup'>"+"<h2>"+$.jCache.getItem("login.BtnForgotPass")+"</h2>"+"<p class='ac'>"+$.jCache.getItem("login.InstructionsForgotPass")+"</p>"+"<p class='ac'><input type='text' id='tbEmailReset' class='stretch'/></p>"+"</div>";if(false){var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{callback:promptForEmail,buttons:buttons});}
else{var buttons={};buttons[$.jCache.getItem("common.Send")]=true;buttons[$.jCache.getItem("common.Cancel")]=false;$.prompt(strHTML,{callback:sendResetEmail,buttons:buttons});$("#tbEmailReset").keypress(function(e){if(e.which==13)
{$("#jqibuttons").children()[0].click();}});$("#tbEmailReset").focus();}});}
function sendResetEmail(btn,msg){if(btn!=undefined){if(btn){var strEmail=msg.find("#tbEmailReset").val();if(isValidEmailAddress(strEmail)){pageService.invoke("sendResetEmail",{strEmail:strEmail},function(result){if(result){strHTML=succ($.jCache.getItem("login.pCheckEmail"));var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{buttons:buttons});tick();}
else{strHTML=err($.jCache.getItem("error.NoSuchEmail"));var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{callback:promptForEmail,buttons:buttons});}});}
else{strHTML=warn($.jCache.getItem("error.InvalidEmailAddress"));var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{callback:promptForEmail,buttons:buttons});}}
else{}}
else{}}
function promptForNewPassword(){cacheStrings(["resetPassword.TitleResetPass","resetPassword.Instructions","resetPassword.btnSetPass","common.Cancel","common.Continue","error.WeakPassword","resetPassword.success","error.SetPassword"],function(){strHTML="<div id='popup' class='popup'>"+"<h2>"+$.jCache.getItem("resetPassword.TitleResetPass")+"</h2>"+"<p class='ac'>"+$.jCache.getItem("resetPassword.Instructions")+"</p>"+"<p class='ac'><input id='tbNewPassword' type='password' class='stretch'/></p>"+"</div>";var buttons={};buttons[$.jCache.getItem("resetPassword.btnSetPass")]=true;buttons[$.jCache.getItem("common.Cancel")]=false;$.prompt(strHTML,{callback:setNewPassword,buttons:buttons});$("#tbNewPassword").keypress(function(e){if(e.which==13)
{$("#jqibuttons").children()[0].click();}});$("#tbNewPassword").focus();});}
function setNewPassword(btn,msg){if(btn!=undefined){if(btn){var strPass=$.trim(msg.find("#tbNewPassword").val());if(strPass.length>5){var strEmail=$.jqURL.get("email");var strPassReset=$.jqURL.get("pr");pageService.invoke("setPassword",{strEmail:strEmail,strPassReset:strPassReset,strPass:strPass},function(result){if(result){strHTML=succ($.jCache.getItem("resetPassword.success"));var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{callback:goHome,buttons:buttons});}
else{strHTML=err($.jCache.getItem("error.NoSuchEmail"));var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{callback:promptForEmail,buttons:buttons});}});}
else{strHTML=warn($.jCache.getItem("error.WeakPassword"));var buttons={};buttons[$.jCache.getItem("common.Continue")]=true;$.prompt(strHTML,{callback:promptForNewPassword,buttons:buttons});}}
else{}}
else{}}
function goHome(){window.location="/me";}