Lenovo.AccountLogin=function(){Lenovo.AccountLogin.instance=this;this.ThisPage=$("#account-login");this.ResetPasswordPage=$("#ForgotPasswordView");this._Init()};Lenovo.AccountLogin.accountLoginComplete=function(n){var t=AjaxUtil.getJsonBodyPart(n),i=JSON.parse(t);Lenovo.AccountLogin.instance._LoginError(i)};Lenovo.AccountLogin.accountLoginClickNo=function(){Lenovo.AccountLogin.instance._RefreshCurrentPage()};Lenovo.AccountLogin.resetPasswordComplete=function(n){var t=AjaxUtil.getJsonBodyPart(n),i=JSON.parse(t);Lenovo.AccountLogin.instance._ResetPasswordInform(i);Lenovo.AccountLogin.showForgotPasswordComplete();$("#account-login").find(".account-icon-location").hide()};Lenovo.AccountLogin.logOutComplete=function(){Lenovo.AccountLogin.instance._RefreshAfterLogout();$("#account-login").find(".account-icon-location").hide()};Lenovo.AccountLogin.CheckLoginBeforeStart=function(){$.ajax({url:$("#account_content").attr("checkloginurl"),type:"Get",dataType:"json",success:function(n){if(!n)return $("#account-login").hide(),window.location.href=window.location.origin,!1}})};Lenovo.AccountLogin.showForgotPasswordComplete=function(){$("#LoginView").hide();$("#ForgotPasswordView").show();$("#backToLogin").click(function(){$("#LoginView").show();$("#ForgotPasswordView").hide()});$("#account-login").find(".account-icon-location").hide()};Lenovo.AccountLogin.prototype={_Init:function(){var n=this;$("#CreateAccountbtn").length>0&&($("#CreateAccountbtn").click(),$(".servicer-login-box").hide(),$("#link-accounts").hide());n.ThisPage.find("#username").focus(function(){n.ThisPage.find("#error_text").empty()});n.ThisPage.find("#password").focus(function(){n.ThisPage.find("#error_text").empty()});$(".account-icon").click(function(){$("#account-login>a#account").length>0&&(location.href=$("#account-login>a#account").attr("href"));$(".account-login-mobile").hasClass("header-mobile-account")?$(".account-login-mobile").removeClass("header-mobile-account"):$(".account-login-mobile").addClass("header-mobile-account")});$(window).resize(function(){$(window).width()<999?($("#account_content").removeClass("website-width"),$("#account_content").removeClass("over_page"),$("#account_content").removeClass("account-login-box"),$("#account-login").addClass("account-login-mobile")):($("#account_content").addClass("website-width"),$("#account_content").addClass("over_page"),$("#account_content").addClass("account-login-box"),$("#account-login").removeClass("account-login-mobile"))});$(window).width()<999?($("#account_content").removeClass("website-width"),$("#account_content").removeClass("over_page"),$("#account_content").removeClass("account-login-box"),$("#account-login").addClass("account-login-mobile")):($("#account_content").addClass("website-width"),$("#account_content").addClass("over_page"),$("#account_content").addClass("account-login-box"),$("#account-login").removeClass("account-login-mobile"));$(".accountMask").length>0&&($(".accountMask").show(),$("body").css("overflow","hidden"));$("#btnlinkStep2").click(function(){$(this).parents(".accountLoginStep1").hide();$(this).parents(".accountLoginStep1").next(".accountLoginStep2").show()});$("#btnlinkStep1").click(function(){$(this).parents(".accountLoginStep2").hide();$(this).parents(".accountLoginStep2").prev(".accountLoginStep1").show()});$("#IsLockedUser").length>0&&(alert("current user had locked."),location.href=$("#IsLockedUser").attr("href"));$('a[data-type="SsoLinkForHome"]').each(function(){var n=$(this).attr("href");n!=undefined&&n.indexOf("?")>-1&&$(this).attr("href",n.replace($(this).attr("href").split("?")[1],"backUrl="+encodeURIComponent(location.origin)))});$('a[data-type="LinkUrlReplace"]').each(function(){var n=$(this).attr("href");n!=undefined&&n.indexOf("?")>-1&&$(this).attr("href",n.replace($(this).attr("href").split("?")[1],"backUrl="+encodeURIComponent(location.href)))});$('[data-jscomponent="ServicerLogin"]').length==0?$('a[data-type="ServiceLoginUrlReplace"]').each(function(){var n=$(this).attr("href");n!=undefined&&n.indexOf("?")>-1&&$(this).attr("href",n.replace($(this).attr("href").split("?")[1],"ReturnPage="+encodeURIComponent(location.href)))}):$('a[data-type="ServiceLoginUrlReplace"]').each(function(){var n=$(this).attr("href");n!=undefined&&n.indexOf("?")>-1&&$(this).attr("href",location.href)});$("a[data-type=ServicerLoginUrl]").on("click",function(){location.href=$("a[data-type=ServiceLoginUrlReplace]").attr("href")})},_LoginError:function(n){var r=this,t,i;n!=null?(n.IslockedUser&&alert("current user had locked."),r.ThisPage.find("#error_text").show().html("").append(n.loginResult)):location.search!=""&&location.search.indexOf("?")>-1&&$('div[data-jscomponent="PreAuth"]').length>0?(t=decodeURIComponent(location.search),i="",t.indexOf("&")>-1&&(i=t.substring(1,t.length).split("&")),i!=""?$(i).each(function(){this.toLowerCase().indexOf("returnurl")>-1&&(window.location.href=this.toLowerCase().replace("returnurl=",""))}):window.location.href=t.substring(1,t.length).toLowerCase().replace("returnurl=","")):r._RefreshCurrentPage()},_RefreshCurrentPage:function(){location.reload()},_RefreshAfterLogout:function(){var n=window.location.href.substring(0,window.location.href.lastIndexOf("/"));location.href.toLowerCase().indexOf("myaccount")>-1?window.location.replace(n):location.href.toLowerCase().indexOf("insufficientpermissions")>-1?window.location.replace(n):location.reload()},_ResetPasswordInform:function(n){var t=this;if(t.ResetPasswordPage=$("#ForgotPasswordView"),n!=null){if(n.resetUserResult!=undefined){t.ResetPasswordPage.find("#info_text").empty();t.ResetPasswordPage.find("#Username").addClass("input-validation-error");t.ResetPasswordPage.find("#Username").focus(function(){t.ResetPasswordPage.find("#Username").removeClass("input-validation-error")});return}t.ResetPasswordPage.find("#info_text").show().append(n.resetResult)}}};Lenovo.ChangePassword=function(){};Lenovo.ChangePassword.prototype={};Lenovo.ChangePassword.ChangePasswordComplete=function(n){var t=AjaxUtil.getJsonBodyPart(n),i=JSON.parse(t);$("#errorBox").show();$("#errorContent").html(i)}