function noCache(uri) { return uri.concat(/\?/.test(uri) ? "&" : "?", "noCache=", (new Date).getTime(), ".", Math.random() * 1234567); } document.onkeypress = enter; function enter(e) { if (!e) { if (window.event) { // Internet Explorer e = window.event; } else { // total failure, we have no // way of referencing the event return; } } if (typeof (e.keyCode) == 'number') { // DOM e = e.keyCode; } else if (typeof (e.which) == 'number') { // NS 4 compatible e = e.which; } else if (typeof (e.charCode) == 'number') { // also NS 6+, Mozilla 0.9+ e = e.charCode; } else { // total failure, we have no way of obtaining the key code return; } if (e != undefined && e == 13) { // loginFromSite(); } } function loginFromSite(){ //document.getElementById('loadingId').style.display='block'; document.forms[0].action="login.action"; document.forms[0].submit(); } function resetPassword(){ $('#update').hide(); $('#passwordLoadingId').show(); if(($.trim(document.getElementById('userName').value)).toLowerCase()=='demo'){ document.getElementById('requestCount').value=0; sutiAlerts("Alert","Password for demo account is 'demo'.","277px"); $('#passwordLoadingId').hide(); $('#update').show(); }else{ if(document.getElementById("passwordErrors")!=null){ document.getElementById("passwordErrors").style.display='none'; } if(document.getElementById("sigleAccountMessageDiv")!=null){ document.getElementById("sigleAccountMessageDiv").style.display='none'; } if(document.getElementById("multipleAccountsMessageDiv")!=null){ document.getElementById("multipleAccountsMessageDiv").style.display='none'; } if(document.getElementById('requestCount').value==0){ document.getElementById('requestCount').value=1; $(document.forgotpassword).ajaxSubmit({ url: "resetPassword.action", type:"POST", success:function(data) { if($.trim(data)=="singleAccount"){ $('#singleForgotPasswordSuccess').fadeIn(); document.getElementById("noteMessageDiv").style.display='none'; document.getElementById("companycodeForgotPwd").value=''; document.getElementById("userName").value=''; document.getElementById("sigleAccountMessageDiv").style.display='block'; document.getElementById('requestCount').value=0; singleForgotPasswordFadeOut(); }else if($.trim(data)=="multiPleAccounts"){ $('#multipleForgotPasswordSuccess').fadeIn(); document.getElementById("noteMessageDiv").style.display='none'; document.getElementById("companycodeForgotPwd").value=''; document.getElementById("userName").value=''; document.getElementById("multipleAccountsMessageDiv").style.display='block'; document.getElementById('requestCount').value=0; multipleForgotPasswordFadeOut(); } else { document.getElementById('requestCount').value=0; document.getElementById("popupDialogDiv_bdiv").innerHTML=data; //document.getElementById("passwordErrors").style.display='block'; } $('#passwordLoadingId').hide(); $('#update').show(); } }); } } } function forgotPassword(){ var strURL ="forgotPassword.action"; var xmlHttp; if(window.XMLHttpRequest){ // For Mozilla, Safari, ... xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject){ // For Internet Explorer xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlHttp.open('POST', noCache(strURL), true); xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttp.onreadystatechange = function(){ if (xmlHttp.readyState == 4){ if(xmlHttp.status==200){ document.getElementById('forgotPasswordPopupId').innerHTML=xmlHttp.responseText; // this method available in common.js displayPasswordDialog('forgotPasswordPopupId','530'); } } } xmlHttp.send(null); } function displayPasswordDialog(divId,w){ $.fx.speeds._default = 1000; $(function() { $('#'+divId).modal({ opacity:0, persist:false, containerCss:{ backgroundColor:"#ffffff", borderColor:"#569db5", //height:h, padding:0, width:w, top: 102 }, onOpen: function (dialog) { dialog.overlay.fadeIn('fast', function () { dialog.data.hide(); dialog.container.fadeIn('fast', function () { dialog.data.slideDown('fast'); }); }); }, onClose: function (dialog) { dialog.data.fadeOut('fast', function () { dialog.container.hide('fast', function () { dialog.overlay.slideUp('fast', function () { $.modal.close(); }); }); }); } }); }); $('#'+divId).parent().parent().css({ "height" : "", "top" : "102px" }); } function singleForgotPasswordFadeOut(){ $('#singleForgotPasswordSuccess').delay(3000); $('#singleForgotPasswordSuccess').fadeOut(1000); } function multipleForgotPasswordFadeOut(){ $('#multipleForgotPasswordSuccess').delay(3000); $('#multipleForgotPasswordSuccess').fadeOut(1000); } function signUp(){ window.location = "https://www.invoicejournal.com/userSignUp.action"; } var scriptsLoaded="" function loadScript(filename,callBackFunction){ if(scriptsLoaded.indexOf("["+filename+"]") == -1){ var locationHREF = window.location.href; if(filename.toLowerCase().endsWith(".css")){ loadCss(filename); scriptsLoaded += "["+filename+"]"; }else{ $.getScript(filename, function() { scriptsLoaded += "["+filename+"]"; if(typeof callBackFunction == 'function'){ callBackFunction(); } }); } }else{ if(typeof callBackFunction == 'function'){ callBackFunction(); } } } function setDivStyle(txtTitle,action,cwidth){ loadScript("scripts/common.js?v=8.2.1", function(){ loadDiv(); xhrGet({url:action,preventCache:true,handleAs: "text", load: function(data){ hideLoadDiv(); openPopup(data,"Forgot Password",cwidth); //setPopupContent(data); } }); }); } function _displayAckMsg(message){if(message.indexOf('Unable to') != -1 || message.indexOf('An internal error') != -1 || message.indexOf('try again') != -1){_errorAckMsg(message);}else{alertify.success(message);}} function _errorAckMsg(message){alertify.error(message);}