// Save users name and password function savepwd() { if(document.CustLog.RememberMe.checked) { var usr_str = document.CustLog.Username.value; var pwd_str = document.CustLog.Password.value; var usr_num = str_to_num(usr_str); pwd_num = str_to_num(pwd_str); if (usr_num != null) { if (pwd_num !=null) { document.cookie = "LOGIN=Y; expires=Saturday, 01-Apr-2020 08:00:00 GMT; path=/"; document.cookie = ("USR=" + usr_num) + "; expires=Saturday, 01-Apr-2020 08:00:00 GMT; path=/"; document.cookie = ("PWD=" + pwd_num) + "; expires=Saturday, 01-Apr-2020 08:00:00 GMT; path=/"; alert("Username and password saved."); } } } return true; } // Convert string to number function str_to_num(str_in) { num_out = ""; if(str_in != "") { for(i = 0; i < str_in.length; i++) { if (str_in.charCodeAt(i) != 32) { num_out += str_in.charCodeAt(i) - 23; } else { num_out += '09'; } } return num_out; } return null; } //new set cookie function SetCookie (name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function setFormFocus() { document.forms["CustLog"].Username.focus(); document.forms["CustLog"].Username.select(); } // Automatically Login user function autologin() { var userenc = GetCookie ('USR'); var pwdenc = GetCookie('PWD'); document.CustLog.Username.value = num_to_str(userenc); document.CustLog.Password.value = num_to_str(pwdenc); document.CustLog.submit(); } // Convert number to string function num_to_str(num_out) { str_out = ""; if(num_out != "") { for(i = 0; i < num_out.length; i += 2) { if (num_out.substr(i,[2]) != '09') { num_in = parseInt(num_out.substr(i,[2])) + 23; num_in = unescape('%' + num_in.toString(16)); } else { num_in = ' '; } str_out += num_in; } return unescape(str_out); } return null; } function GetCookie(cookieName) { if(document.cookie) index = document.cookie.indexOf(cookieName); else retrun(null) var tbegin = index + cookieName.length + 1 var tend = document.cookie.indexOf(";", index); if (tend == -1) tend = document.cookie.length return (document.cookie.substring(tbegin, tend)) }