function checkEmail(){ if(isEmail(document.pword.frmEmail.value)== false){ document.pword.frmEmail.focus(); return false; } } function checkLogin(){ if(document.login.frmEmail.value == ""){ document.login.frmEmail.focus(); alert("Please enter your email address."); return false; } if(isEmail(document.login.frmEmail.value)== false){ document.login.frmEmail.focus(); return false; } if(document.login.frmPassword.value == ""){ document.login.frmPassword.focus(); alert("Please enter your password."); return false; } if(document.login.frmPassword.value.length < 5){ document.login.frmPassword.focus(); alert("Password too short."); return false; } if(document.login.frmPassword.value.length > 16){ document.login.frmPassword.focus(); alert("Password too long."); return false; } if(document.login.rememberMe.checked){ // create an instance of the Date object var now = new Date(); // fix the bug in Navigator 2.0, Macintosh fixDate(now); /* cookie expires in one year (actually, 365 days) 365 days in a year 24 hours in a day 60 minutes in an hour 60 seconds in a minute 1000 milliseconds in a second */ now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); //var username = getCookie("username"); setCookie("useremail", document.login.frmEmail.value, now); setCookie("userpassword",document.login.frmPassword.value, now); } else { //deleteCookie('useremail','',''); //deleteCooke('userpassword','',''); } } //checks for the validity of email address provided by the user. //this function checks whether the user has entered @ symbol at first or at last. //whether the user has entered '.' symbol at the beggining or at last. //whether the @ symbol and '.' is together. function isEmail(str){ str=fnStripSpace(str); if(str.charAt(0)=="@" || str.charAt(str.length-1)=="@" || str.charAt(0)=="." || str.charAt(str.length-1)=="." || str.indexOf('@')==-1 || str.indexOf('.')==-1 || str.indexOf('@')==(str.indexOf('.')-1) || str.indexOf('@')==(str.indexOf('.')+1)) { alert("Please Enter Valid Email Address"); return false } } //this function removes the empty spaces from the string passed to it. //it slashes empty spaces on both sides of the string as well as in between the string also function fnStripSpace(str){ var strTemp=""; for(intI=0;intI