function getpage(){ var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); return sPage; } function auto_login1(){ var Str=Get_Cookievalue( "rememberme"); //var Str=getCookie("rememberme"); if(Str){ myform=document.createElement("form"); input1 = document.createElement("input"); myform.setAttribute("method","post"); myform.setAttribute("action",window.location); myform.setAttribute("id","autologform"); input1.setAttribute("name","do"); input1.setAttribute("value","auto"); myform.appendChild(input1); document.body.appendChild(myform); autologform.submit(); return true; } return false; } function log_into_site(){ var Str=getCookie("logincookie"); Str=unEncrypt(Str); var str2=Str.toLowerCase().split('!@'); document.getElementById("username").value =str2[0]; document.getElementById("password").value =str2[1]; //document.autoform.password.value =str2[1]; document.autoform.submit(); return true; } function setCookie(NameOfCookie, value, expiredays){ var ExpireDate = new Date(); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); } function getCookie(NameOfCookie){ if(document.cookie.length > 0){ begin = document.cookie.indexOf(NameOfCookie+"="); if(begin != -1){ begin += NameOfCookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null; } function delCookie(NameOfCookie){ if(getCookie(NameOfCookie)){ document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } function Encrypt(theText){ output = new String; Temp = new Array(); Temp2 = new Array(); TextSize = theText.length; for (i = 0; i < TextSize; i++) { rnd = Math.round(Math.random() * 122) + 68; Temp[i] = theText.charCodeAt(i) + rnd; Temp2[i] = rnd; } for (i = 0; i < TextSize; i++){ output += String.fromCharCode(Temp[i], Temp2[i]); } return output; } function unEncrypt(theText) { output = new String; Temp = new Array(); Temp2 = new Array(); TextSize = theText.length; for (i = 0; i < TextSize; i++) { Temp[i] = theText.charCodeAt(i); Temp2[i] = theText.charCodeAt(i + 1); } for (i = 0; i < TextSize; i = i+2) { output += String.fromCharCode(Temp[i] - Temp2[i]); } return output; } function Remeberlogin(f1,f2){ function setCookie(NameOfCookie, value, expiredays){ var ExpireDate = new Date(); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); } var vv=f1+'!@'+f2 setCookie('logincookie',Encrypt(vv) , 5); setCookie('rememberme','true', 5); return true; } function IsValidEmail(NForm){ NForm.username.focus(); var str = NForm.username.value; var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/; // valid if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid return true; }else{ alert("You must enter your email-address"); return false; } } function validate_loginform(nform){ if(!IsValidEmail(nform)){ return false; } if(!nform.password.value){ nform.password.focus(); alert("You must enter your password"); return false; } return true; } function validate_Email(nform){ if(!IsValidEmail(nform)){ return false; } return true; } function validate_password(nform){ if(!nform.newpass.value){ nform.newpass.focus(); alert("Please enter your password"); return false; } if(!nform.connewpass.value){ nform.connewpass.focus(); alert("Please enter your password"); return false; } if(nform.newpass.value!=nform.connewpass.value){ alert("Passwords dont match"); return false; } return true; } function Get_Cookievalue( check_name ) { // first we'll split this cookie up into name/value pairs // note: document.cookie only returns name=value, not the other components var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; // set boolean t/f default f for ( i = 0; i < a_all_cookies.length; i++ ) { // now we'll split apart each name=value pair a_temp_cookie = a_all_cookies[i].split( '=' ); // and trim left/right whitespace while we're at it cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); // if the extracted name matches passed check_name if ( cookie_name == check_name ) { b_cookie_found = true; // we need to handle case where cookie has no value but exists (no = sign, that is): if ( a_temp_cookie.length > 1 ) { cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); } // note that in cases where cookie is initialized but no value, null is returned return cookie_value; break; } a_temp_cookie = null; cookie_name = ''; } if ( !b_cookie_found ) { return null; } }