F2.Apps.com_csim_funds_login=function(s){var o=function(o,t,i){this.appConfig=o,this.appContent=t,this.root=i,this.loginUrl=this.appContent.data.loginUrl,this.logoutUrl=this.appContent.data.logoutUrl,this.resetPasswordUrl=this.appContent.data.resetPasswordUrl,this.isLoggedIn=this.appContent.data.isLoggedIn,this.loginDialog=s(this.root).find(".login-dialog"),this.passwordDialog=s(this.root).find(".password-dialog"),this.forcePasswordDialog=s(this.root).find(".force-password-dialog"),this.appContainer=s(this.root).find(".MOD"),this.bLoginVisible=!1,this.mustResetPassword=this.appContent.data.mustChangePassword,this.errorContainerLogin=s(".error-message",this.loginDialog),this.errorContainerResetPassword=s(".error-message",this.passwordDialog)};return o.prototype.init=function(){F2.Constants.Events.CONTAINER_USER_LOGOUT_COMPLETE=F2.Constants.Events.CONTAINER_USER_LOGOUT_COMPLETE?F2.Constants.Events.CONTAINER_USER_LOGOUT_COMPLETE:"App.UserLogoutComplete",F2.Constants.Events.CONTAINER_USER_REQUEST_LOGOUT=F2.Constants.Events.CONTAINER_USER_REQUEST_LOGOUT?F2.Constants.Events.CONTAINER_USER_REQUEST_LOGOUT:"App.UserRequestLogout",F2.Constants.Events.CONTAINER_VIEW_LOGIN=F2.Constants.Events.CONTAINER_VIEW_LOGIN?F2.Constants.Events.CONTAINER_VIEW_LOGIN:"App.ShowLogin",F2.Constants.Events.CONTAINER_VIEW_REGISTRATION=F2.Constants.Events.CONTAINER_VIEW_REGISTRATION?F2.Constants.Events.CONTAINER_VIEW_REGISTRATION:"App.ShowRegistration",F2.Constants.Events.CONTAINER_USER_INFO=F2.Constants.Events.CONTAINER_USER_INFO?F2.Constants.Events.CONTAINER_USER_INFO:"App.UserInfo",F2.Constants.Events.CONTAINER_FORGOT_PASSWORD=F2.Constants.Events.CONTAINER_FORGOT_PASSWORD?F2.Constants.Events.CONTAINER_FORGOT_PASSWORD:"App.ForgotPassword",this.registerEvents(),this.isLoggedIn&&(s.cookie("s_login")||this.mustResetPassword||F2.Events.emit(F2.Constants.Events.CONTAINER_USER_REQUEST_LOGOUT)),this.mustResetPassword&&(s(this.forcePasswordDialog).on("keypress","#forceResetConfirmPassword",s.proxy(function(s){13===(s.keyCode||s.which)&&this.forceResetPassword(s)},this)),this.showForceResetPassword()),(s(this.root).find(".IE8").length||s(this.root).find(".IE9").length)&&s(this.root).ghostText(),this.isLoggedIn||-1===location.search.substring(1).indexOf("promptlogin")||F2.Events.emit(F2.Constants.Events.CONTAINER_VIEW_LOGIN)},o.prototype.registerEvents=function(){s(this.root).on("click",".btn-login",s.proxy(this.login,this)),s(this.root).on("click",".btn-register",s.proxy(this.registerUserLogin,this)),s(this.loginDialog).on("click",".spr-close",s.proxy(this.closeLoginDialog,this)),s(this.passwordDialog).on("click",".spr-close",s.proxy(this.closePasswordDialog,this)),s(this.loginDialog).on("click",".forgot-password",s.proxy(this.showForgotPassword,this)),s(this.passwordDialog).on("click","#reset-password",s.proxy(this.resetPassword,this)),s(this.passwordDialog).on("click","#register-user",s.proxy(this.registerUserPassword,this)),s(this.loginDialog).on("keypress","#loginPassword",s.proxy(function(s){13===(s.keyCode||s.which)&&this.login(s)},this)),s(this.passwordDialog).on("keypress","#resetPasswordUsername",s.proxy(function(s){13===(s.keyCode||s.which)&&this.resetPassword(s)},this)),F2.Events.on(F2.Constants.Events.CONTAINER_USER_REQUEST_LOGOUT,s.proxy(this.logout,this)),F2.Events.on(F2.Constants.Events.CONTAINER_VIEW_LOGIN,s.proxy(this.showLogin,this)),F2.Events.on(F2.Constants.Events.CONTAINER_FORGOT_PASSWORD,s.proxy(function(){this.showLogin({}),this.showForgotPassword()},this))},o.prototype.showRegistration=function(s){this.closeLoginDialog(),F2.Events.emit(F2.Constants.Events.CONTAINER_VIEW_REGISTRATION,s)},o.prototype.renderErrorMessage=function(o,t){for(var i=s("
"),e=0;e").addClass("spr-icon spr-warning shim-right-sm"),n=o.rValidations[e].rFailedTests[0].errorMessage;i.append(s("- ").append([r,n]))}t.html(i)},o.prototype.clearContainer=function(s){s.html("")},o.prototype.showLogin=function(){this.bLoginVisible||(this.bLoginVisible=!0,this.maskedContainer=s("body"),MOD.UI.showContainerMask(this.maskedContainer),this.appContainer.unhide())},o.prototype.login=function(o){s.cancelEvent(o);var t=this.loginDialog.validateForm();t.bFormValid?(this.oLoginData={user_id:s("#loginUsername",this.root).val(),user_password:s("#loginPassword",this.root).val(),persist:s("#persist").is(":checked")?"true":"false"},this.appConfig.ui.showMask(this.loginDialog,!1),this.cachedLoginRequestObj={url:this.loginUrl,data:this.oLoginData,context:this,success:this.processLoginResponse},this.stopAjax=!1,s.createAjaxRequest(this.cachedLoginRequestObj)):(this.clearContainer(this.errorContainerLogin),this.renderErrorMessage(t,this.errorContainerLogin))},o.prototype.processLoginResponse=function(o){if(this.clearContainer(this.errorContainerLogin),o.isUserLoggedIn)this.appConfig.ui.hideMask(this.loginDialog,!1),this.closeLoginDialog(),F2.Events.emit(F2.Constants.Events.CONTAINER_USER_INFO,o.userInfo);else{o.unlockUserFlag&&!this.stopAjax&&(this.stopAjax=!0,s.createAjaxRequest(this.cachedLoginRequestObj));var t=o.isAccountLocked?'Your Account has been locked. Please reset your password using the "Forgot Password?" link below, or try again in 24 hours.':"You entered an invalid Email Address or Password. Please try again.";this.errorContainerLogin.html(s("")),s("#loginPassword",this.root).val(""),this.appConfig.ui.hideMask(this.loginDialog,!1)}},o.prototype.registerUserLogin=function(){this.showRegistration({email:s("#loginUsername").val()})},o.prototype.closeLoginDialog=function(){this.bLoginVisible=!1,this.loginDialog.find("input").val("").blur(),this.appContainer.mHide(),this.clearContainer(this.errorContainerLogin);this.maskedContainer?this.maskedContainer:s("body");MOD.UI.hideContainerMask(this.maskedContainer)},o.prototype.logout=function(o){this.appConfig.ui.showMask(s("body"),!0),s.createAjaxRequest({url:this.logoutUrl,context:this,success:this.processLogoutResponse})},o.prototype.processLogoutResponse=function(o){o.success?F2.Events.emit(F2.Constants.Events.CONTAINER_USER_LOGOUT_COMPLETE):this.appConfig.ui.hideMask(s("body"))},o.prototype.showForgotPassword=function(){this.loginDialog.mHide(),this.passwordDialog.unhide()},o.prototype.resetPassword=function(o){s.cancelEvent(o);var t=this.passwordDialog.validateForm();if(this.passwordDialog.find(".success").mHide(),this.passwordDialog.find(".invalid").mHide(),t.bFormValid){this.clearContainer(this.errorContainerResetPassword);var i={email:s("#resetPasswordUsername").val(),audience:s.getAudience()};this.appConfig.ui.showMask(this.passwordDialog,!0),s.createAjaxRequest({url:this.resetPasswordUrl,data:i,context:this,success:this.processResetPasswordResponse})}else this.clearContainer(this.errorContainerResetPassword),this.renderErrorMessage(t,this.errorContainerResetPassword)},o.prototype.processResetPasswordResponse=function(o){o.success?(this.passwordDialog.find(".invalid").mHide(),s("#register-user").mHide(),this.passwordDialog.find(".success").unhide(),this.passwordDialog.find("#reset-password").mHide(),this.passwordDialog.find(".input-container").mHide(),this.bPasswordReset=!0):(this.passwordDialog.find(".invalid").unhide(),s("#register-user").unhide()),this.appConfig.ui.hideMask(this.passwordDialog,!0)},o.prototype.closePasswordDialog=function(){this.clearContainer(this.errorContainerResetPassword),s("#resetPasswordUsername").val(""),this.passwordDialog.mHide(),this.bPasswordReset||this.passwordDialog.find(".success").mHide(),this.passwordDialog.find(".invalid").mHide(),s("#register-user").mHide(),this.closeLoginDialog(),this.loginDialog.unhide()},o.prototype.registerUserPassword=function(){this.showRegistration({email:s("#resetPasswordUsername").val()}),this.closePasswordDialog()},o.prototype.showForceResetPassword=function(){MOD.UI.showContainerMask(s("body")),this.loginDialog.mHide(),this.forcePasswordDialog.unhide(),this.appContainer.unhide(),s(this.forcePasswordDialog).on("click","#force-reset-password",s.proxy(this.forceResetPassword,this))},o.prototype.forceResetPassword=function(){var o=this.forcePasswordDialog.validateForm(),t=[["forceResetPassword","forceResetConfirmPassword","Passwords are different"]];if(this.runAdditionalValidations(o,t),o.bFormValid){var i={Password:s("#forceResetPassword").val()};this.appConfig.ui.showMask(this.forcePasswordDialog,!1),s.createAjaxRequest({url:this.resetPasswordUrl,data:i,context:this,success:this.processForceResetPasswordResponse})}else this.renderAllErrorMessages(o)},o.prototype.processForceResetPasswordResponse=function(s){s.success?F2.Events.emit(F2.Constants.Events.CONTAINER_USER_INFO,this.appContent.data.userInfo.userName):this.appConfig.ui.hideMask(this.forcePasswordDialog,!1)},o.prototype.renderAllErrorMessages=function(s){for(var o in s.oValidations){var t=s.oValidations[o];t.bValid||this.renderSingleErrorMessage(t.oEl,t.rFailedTests[0].errorMessage)}},o.prototype.renderSingleErrorMessage=function(o,t){var i=s("").addClass("spr-icon spr-warning shim-right-sm");o.closest(".input-container").find(".error-message").html([i,t])},o.prototype.runAdditionalValidations=function(o,t){for(var i=0;i0||t(this.root).find(".IE9").length>0,this.registerContainer=this.$root.find(".register-outer"),this.thanksContainer=this.$root.find(".thanks-outer"),this.isLoggedIn=this.appContent.data.isLoggedIn};return s.prototype.init=function(){F2.Constants.Events.CONTAINER_VIEW_REGISTRATION=F2.Constants.Events.CONTAINER_VIEW_REGISTRATION?F2.Constants.Events.CONTAINER_VIEW_REGISTRATION:"App.ShowRegistration",F2.Constants.Events.CONTAINER_FORGOT_PASSWORD=F2.Constants.Events.CONTAINER_FORGOT_PASSWORD?F2.Constants.Events.CONTAINER_FORGOT_PASSWORD:"App.ForgotPassword",this.registerEvents(),!this.isLoggedIn&&this.bRequiresGhostText&&this.$root.ghostText()},s.prototype.registerEvents=function(){this.$root.on("click","#register",t.proxy(this.register,this)),this.$root.on("click","#update",t.proxy(this.update,this)),this.$root.on("click","#update-password",t.proxy(this.updatePassword,this)),this.registerContainer.on("click",".spr-close, .cancel",t.proxy(this.closeRegistration,this)),this.thanksContainer.on("click",".spr-close, .close",t.proxy(this.closeThankYou,this)),this.$root.on("change","[data-validations]",t.proxy(this.validateInput,this)),this.registerContainer.on("click","nav li:not(.selected)",t.proxy(this.switchTab,this)),this.$root.on("change","select",t.proxy(this.dropDownStyleClick,this)),F2.Events.on(F2.Constants.Events.CONTAINER_VIEW_REGISTRATION,t.proxy(this.showRegistration,this))},s.prototype.dropDownStyleClick=function(s){var e=t(s.currentTarget);e.css(""===e.val()?{color:"#7F8A92","font-family":"CharlesModern-Regular"}:{color:"#005e84","font-family":"CharlesModern-Bold"})},s.prototype.dropDownStyle=function(){for(var s=["#BusinessType","#Role","#Country","#State"],e=0;e").addClass("spr-icon spr-warning shim-right-sm");s.closest(".input-container").find(".error-message").html([o,e])},s.prototype.clearAllErrorMessages=function(){this.$root.find(".error-message").html("")},s.prototype.clearResetPasswordForm=function(){this.registerContainer.find(".reset-password input").val(""),this.registerContainer.find(".reset-password .error-message").html("")},s.prototype.registrationSuccess=function(s){if(this.appConfig.ui.hideMask(this.$root,!0),s.success)this.closeRegistration(),this.userInfo=s.userInfo,this.showThankYou();else if(1===s.error){this.renderErrorMessage(t("#EmailAddress"),"Email account already exists. ");var e=t("").addClass("forgot-password").attr("href","javascript:void(0);").html("Forgot Password?");t("#EmailAddress").closest(".input-container").append(e),this.$root.on("click","a.forgot-password",t.proxy(function(){this.closeRegistration(),F2.Events.emit(F2.Constants.Events.CONTAINER_FORGOT_PASSWORD)},this))}},s.prototype.updateRegistrationSuccess=function(t){t.success&&this.closeRegistration()},s.prototype.registrationLookupSuccess=function(s){if(s.success){for(var e in s.contact)t(".form-input[data-name="+e+"]",this.$root).setInputValue(s.contact[e],this.$root).blur();this.bRequiresGhostText&&(this.$root.ghostText(),this.bRequiresGhostText=!1)}},s.prototype.validateInput=function(s){var e=t(s.currentTarget).validateInput();e.bValid?t(e.oEl).closest(".input-container").find(".error-message").html(""):this.renderErrorMessage(e.oEl,e.rFailedTests[0].errorMessage)},s.prototype.runAdditionalValidations=function(s,e){for(var o=0;o