function Logincheck()
{



  //email
	if(document.form_login.form_email.value.indexOf("@") +""=="-1" ||
		document.form_login.form_email.value.indexOf(".") +""=="-1" || 
		document.form_login.form_email.value==""){
	alert("Please enter your email address in proper format")
	document.form_login.form_email.focus();
	return false;
	}


  //Password

   if (document.form_login.form_password.value == "" || document.form_login.form_password.value.length < 3 || 
	document.form_login.form_password.value.length > 20) {
    alert("Please type your password");
	document.form_login.form_password.focus();
    return false;
	}


	set();
	document.form_login.submit();
	return true;
}


function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
 
function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}


 
var today = new Date();
var expires = new Date(today.getTime() + (56 * 86400000));

var expiresnew = new Date(today.getTime() - 1);
 
function set() {
    if (document.form_login.form_save_email.checked)
        Set_Cookie("email",document.form_login.form_email.value,expires);

    if (document.form_login.form_save_password.checked)
        Set_Cookie("affiliate_password",document.form_login.form_password.value,expires);
         
}

function get() {
    {document.form_login.form_email.focus();}

    email = Get_Cookie("email")
    if (email != null) {
        document.form_login.form_email.value = email;
        document.form_login.form_save_email.checked = true;

    }

    affiliate_password = Get_Cookie("affiliate_password")
    if (affiliate_password != null) {
        document.form_login.form_password.value = affiliate_password;
        document.form_login.form_save_password.checked = true;

    }

}


var todaynew = new Date();

var expiresnew = new Date(todaynew.getTime() - 1);

function delete_cookie() {
    if (document.form_login.form_save_email.checked)
        Set_Cookie("email",document.form_login.form_email.value,expiresnew);

    if (document.form_login.form_save_password.checked)
        Set_Cookie("affiliate_password",document.form_login.form_password.value,expiresnew);
         
	alert('Cookies have been removed.');
        window.location = "login.asp";
}








