﻿function ThePortLogin(){this.m_sLoginServiceURL="/apis/login/LoginService.asmx/";this.m_oPublicNameNode=null;this.m_oWelcomeNode=null;this.m_oInputNode=null;};ThePortLogin.prototype.SendLoginUser=function(oWelcomeNode,oInputNode,oPublicNameNode){var otxtLoginEmail=ThePort.Utils.GetObj("txtLoginEmail");var otxtLoginPassword=ThePort.Utils.GetObj("pwLoginPassword");if(otxtLoginEmail.value==ThePort.Common.CONST_EMPTY_STRING){alert("Please enter your email address.");return;}if(otxtLoginPassword.value==ThePort.Common.CONST_EMPTY_STRING){alert("Please enter your password.");return;}var ocbLoginRemember=ThePort.Utils.GetObj("cbLoginRemember");this.m_oPublicNameNode=oPublicNameNode;this.m_oWelcomeNode=oWelcomeNode;this.m_oInputNode=oInputNode;this.OutputMessage(ThePort.Common.CONST_EMPTY_STRING);var sPostData=ThePort.Common.CONST_EMPTY_STRING;sPostData+="sLoginEmail="+encodeURIComponent(otxtLoginEmail.value);sPostData+="&sLoginPassword="+encodeURIComponent(otxtLoginPassword.value);sPostData+="&sLoginRememberMe="+encodeURIComponent(String(ocbLoginRemember.checked));eUrl=encodeURI(this.m_sLoginServiceURL+"SendLoginUser");this.OutputMessage(ThePort.Common.CONST_EMPTY_STRING);ThePort.Utils.Ajax('POST',eUrl,ThePort.Utils.Bind(this,"onSendLoginUserResponse"),sPostData);};ThePortLogin.prototype.onSendLoginUserResponse=function(originalRequest){try{var bReturnValue=false;var oSR=new ThePort.ReplyObject(originalRequest.responseXML);var boolResponse=false;if((oSR.Response=="true")||(oSR.Response=="yes")||(oSR.Response=="1"))boolResponse=true;SMUserLogin.Event_LogInResponse(boolResponse,oSR.Data);}catch(e){}return bReturnValue;};ThePortLogin.prototype.SendEmailPassword=function(sXSLEmailPasswordFileName){var otxtLoginEmail=ThePort.Utils.GetObj("txtLoginEmail");if(otxtLoginEmail.value==ThePort.Common.CONST_EMPTY_STRING){alert("Please enter your email address.");}else{eUrl=encodeURI(this.m_sLoginServiceURL+"SendEmailPassword?sLoginEmail="+otxtLoginEmail.value+"&sXSLEmailPasswordFileName="+sXSLEmailPasswordFileName);ThePort.Utils.Ajax("GET",eUrl,ThePort.Utils.Bind(this,"onSendEmailPasswordResponse"),null);}};ThePortLogin.prototype.onSendEmailPasswordResponse=function(originalRequest){try{var bReturnValue=false;var oSR=new ThePort.ReplyObject(originalRequest.responseXML);var boolResponse=false;if((oSR.Response=="true")||(oSR.Response=="yes")||(oSR.Response=="1"))boolResponse=true;SMUserLogin.Event_SendEmailPasswordResponse(boolResponse,oSR.Data);}catch(e){}return bReturnValue;};ThePortLogin.prototype.SendResetPasswordEmail=function(sXSLEmailResetFileName){var otxtLoginEmail=ThePort.Utils.GetObj("txtLoginEmail");if(otxtLoginEmail.value==ThePort.Common.CONST_EMPTY_STRING){alert("Please enter your email address.");}else{eUrl=encodeURI(this.m_sLoginServiceURL+"SendResetPasswordEmail?sLoginEmail="+otxtLoginEmail.value+"&sXSLEmailResetFileName="+sXSLEmailResetFileName);ThePort.Utils.Ajax("GET",eUrl,ThePort.Utils.Bind(this,"onSendResetPasswordEmailResponse"),null);}};ThePortLogin.prototype.onSendResetPasswordEmailResponse=function(originalRequest){try{var bReturnValue=false;var oSR=new ThePort.ReplyObject(originalRequest.responseXML);var boolResponse=false;if((oSR.Response=="true")||(oSR.Response=="yes")||(oSR.Response=="1"))boolResponse=true;SMUserLogin.Event_SendResetPasswordEmailResponse(boolResponse,oSR.Data);}catch(e){}return bReturnValue;};ThePortLogin.prototype.SendPasswordReminder=function(){var otxtLoginEmail=ThePort.Utils.GetObj("txtLoginEmail");if(otxtLoginEmail.value==ThePort.Common.CONST_EMPTY_STRING){alert("Please enter your email address.");}else{eUrl=encodeURI(this.m_sLoginServiceURL+"SendPasswordReminder?sLoginEmail="+otxtLoginEmail.value);ThePort.Utils.Ajax("GET",eUrl,ThePort.Utils.Bind(this,"onSendPasswordReminderResponse"),null);}};ThePortLogin.prototype.onSendPasswordReminderResponse=function(originalRequest){try{var bReturnValue=false;var oSR=new ThePort.ReplyObject(originalRequest.responseXML);var boolResponse=false;if((oSR.Response=="true")||(oSR.Response=="yes")||(oSR.Response=="1"))boolResponse=true;SMUserLogin.Event_SendPasswordReminderResponse(boolResponse,oSR.Data);}catch(e){}return bReturnValue;};ThePortLogin.prototype.OutputMessage=function(sMessage){try{var oMessage=ThePort.Utils.GetObj("loginOutputMessage");oMessage.innerHTML=sMessage;oMessage.style.display="block";}catch(e){}};ThePortLogin.prototype.Register=function(){window.location="/community/app/reg/tptwiz/step.aspx";};ThePortLogin.prototype.KeyDownHandler=function(e,c){var ev=e||window.event;if(ev.keyCode==13){ev.returnValue=false;ThePort.Utils.StopEvent(ev);document.getElementById(c).click();}} 