  function validate_login(frm) {
        if (!IsEmail(frm.tf_email.value)) {
            alert("Please enter valid email");
            frm.tf_email.select();
            frm.tf_email.focus();
            return false;
        }
        if (!isValidEntry(frm.tf_password, "password")) {
            return false;
        }
        return true;
    }


    function validate_fogot(frm) {
        if (!IsEmail(frm.tf_email.value)) {
            alert("Please enter valid email");
            frm.tf_email.select();
            frm.tf_email.focus();
            return false;
        }
        return true;
    }


    function validate_register(frm) {
        if (!isValidEntry(frm.tf_fname, "first name")) {
            return false;
        }
        if (!isValidEntry(frm.tf_lname, "last name")) {
            return false;
        }
        if (!IsEmail(frm.tf_email.value)) {
            alert("Please enter valid email");
            frm.tf_email.select();
            frm.tf_email.focus();
            return false;
        }
        if (!isValidAlphaNumeric(frm.tf_password, "password", 1)) {
			return false;
        }
        if (frm.tf_password.value.length <= 3 ||
            frm.tf_password.value.length > 20) {
            alert("Password should be in between 4 and 20 characters");
            frm.tf_password.focus();
            frm.tf_password.value = "";
            return false;
        }
        if (frm.tf_password.value != frm.tf_repassword.value) {
            alert("Please retype password");
            frm.tf_repassword.select();
            frm.tf_repassword.focus();
            return false;
        }
        if (!isValidEntry(frm.tf_company, "company name")) {
            return false;
        }
        if (!isValidEntry(frm.ta_address, "address")) {
            return false;
        }
        if (!isValidEntry(frm.tf_city, "city")) {
            return false;
        }
        if (!isValidEntry(frm.tf_state, "state")) {
            return false;
        }
        if (!isValidZipcode(frm.tf_zip, "zip code", 4)) {
            return false;
        }
        if (!isValidPhone(frm.tf_phone, "phone number", 9)) {
            return false;
        }
        return true;
    }


    function validate_contact(frmcontact) {
        if (!isValidEntry(frmcontact.name, "Name")) {
            return false;
        }
        if (!isValidPhone(frmcontact.phone, "phone number", 9)) {
            return false;
        }
        if (!IsEmail(frmcontact.email.value)) {
            alert("Please enter valid email");
            frmcontact.email.select();
            frmcontact.email.focus();
            return false;
        }
        if (!isValidEntry(frmcontact.comments, "Comments")) {
            return false;
        }
        return true;
    }
	
// By Shiva Kumar S on 17-01-07 to validate email using Ajax
function getData(dataSource)
{
	if (window.XMLHttpRequest) {
		XMLHttpRequestObject = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if(XMLHttpRequestObject) {
		XMLHttpRequestObject.open("GET", dataSource); 
		XMLHttpRequestObject.onreadystatechange = function() { 
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { 
				var targetDiv = document.getElementById("targetDiv");
				var tx_email = document.getElementById("tf_email");
				if(XMLHttpRequestObject.responseText == "Invalid") {
					targetDiv.innerHTML ="<span style=\"color:#FF0000; font-weight:bold;\">"+ tx_email.value+" already taken.</span>";
					tx_email.value="";
					tx_email.focus();
				}
			} 
		} 
		XMLHttpRequestObject.send(null); 
	}
}

// By Shiva Kumar S on 17-01-07 to validate email using Ajax
function checkDomain(input)
{
	var targetDiv = document.getElementById("targetDiv");
	targetDiv.innerHTML = "";
	if(input.value!="")
	{
		getData("check_email.php?email=" + input.value);
	}
}
