
function ValidateRegHP(frm) {


    if (trim(frm.Email.value, "") == "") {
        alert("Please enter your e-mail address.");
        frm.Email.focus();
        return false;
    }

    if (trim(frm.FName.value, "") == "") {
        alert("Please enter your first name.");
        frm.FName.focus();
        return false;
    }

    if (trim(frm.LName.value, "") == "") {
        alert("Please enter your last name.");
        frm.LName.focus();
        return false;
    }

    if (frm.SpeID.selectedIndex < 1) {
        if (trim(frm.OtherSpe.value, "") == "") {
            alert("Please select your specialty.");
            frm.SpeID.focus();
            return false;
        }
    }

    if (frm.ProfID[frm.ProfID.selectedIndex].value == '0') {
        if (trim(frm.OtherProf.value, "") == "") {
            alert("Please select your Profession.");
            frm.ProfID.focus();
            return false;
        }
    }

    if (frm.Practice[frm.Practice.selectedIndex].value == '0') {
        if (trim(frm.OtherPractice.value, "") == "") {
            alert("Please select your Practice.");
            frm.Practice.focus();
            return false;
        }
    }

    if (trim(frm.Address1.value, "") == "") {
        alert("Please enter your Address.");
        frm.Address1.focus();
        return false;
    }

    if (trim(frm.City.value, "") == "") {
        alert("Please enter your City.");
        frm.City.focus();
        return false;
    }

    if (frm.State[frm.State.selectedIndex].value == '0') {
        alert("Please select your State.");
        frm.State.focus();
        return false;
    }

    if (trim(frm.Zip.value, "") == "") {
        alert("Please enter your Zip Code.");
        frm.Zip.focus();
        return false;
    }

    if (frm.Country.selectedIndex < 1) {
        alert("Please select your Country.");
        frm.Country.focus();
        return false;
    }

    
    
    if (!validateEmail(frm.Email.value)) {
        alert("Invalid e-mail address.");
        frm.Email.select();
        frm.Email.focus();
        return false;
    }

    if (trim(frm.vEmail.value, "") == "") {
        alert("Please confirm the e-mail.");
        frm.vEmail.focus();
        return false;
    }

    if (trim(frm.Email.value) != trim(frm.vEmail.value)) {
        alert("e-mails do not match.");
        frm.vEmail.focus();
        return false;
    }

    if (trim(frm.PWD.value, "") == "") {
        alert("Please enter a vaid Password.");
        frm.PWD.focus();
        return false;
    }

    if (frm.PWD.value.length < 4 || frm.PWD.value.length > 10) {
        alert("Password must be 4 to 10 characters.");
        frm.PWD.focus();
        return false;
    }

    if (!validateAlphaNumeric(frm.PWD.value)) {
        alert("Password should include at least one numeric digit.");
        frm.PWD.select();
        frm.PWD.focus();
        return false;
    }


    if (trim(frm.vPWD.value, "") == "") {
        alert("Please confirm the Password.");
        frm.vPWD.focus();
        return false;
    }
    if (trim(frm.PWD.value) != trim(frm.vPWD.value)) {
        alert("Passwords do not match.");
        frm.vPWD.focus();
        return false;
    }

    

    return true;
}

function ValidateRequest(frm){

   
	if (trim(frm.Email.value,"") == "") {
		alert("Please enter your e-mail address.");
		frm.Email.focus();
		return false;
	}

	if (trim(frm.FName.value,"") == "") {
	    alert("Please enter your first name.");
	    frm.FName.focus();
	    return false;
	}

	if (trim(frm.LName.value,"") == "") {
	    alert("Please enter your last name.");
	    frm.LName.focus();
	    return false;
	}


	if (trim(frm.Address1.value, "") == "") {
	    alert("Please enter your Address.");
	    frm.Address1.focus();
	    return false;
	}

	if (trim(frm.City.value, "") == "") {
	    alert("Please enter your City.");
	    frm.City.focus();
	    return false;
	}

	if (frm.State[frm.State.selectedIndex].value == '0') {
	    alert("Please select your State.");
	    frm.State.focus();
	    return false;
	}

	if (trim(frm.Zip.value, "") == "") {
	    alert("Please enter your Zip Code.");
	    frm.Zip.focus();
	    return false;
	}

	if (frm.Country.selectedIndex < 1) {
	    alert("Please select your Country.");
	    frm.Country.focus();
	    return false;
	}

	
	if (frm.chk2009.checked == 0 && frm.chk2010.checked == 0) {
	    alert("Please select at least one Bioidenticals.");
	    frm.chk2009.focus();
	    return false;
	}
	if (frm.profession.selectedIndex < 1) {
	    alert("Please select your profession.");
	    frm.profession.focus();
	    return false;
	}
	  
	      
	if (!validateEmail(frm.Email.value))  {
		alert("Invalid e-mail address.");
		frm.Email.select();
		frm.Email.focus();
		return false;
	}
	
	if (trim(frm.vEmail.value,"") == "") {
		alert("Please confirm the e-mail.");
		frm.vEmail.focus();
		return false;
	}
	
	if (trim(frm.Email.value)!= trim(frm.vEmail.value)) {
		alert("e-mails do not match.");
		frm.vEmail.focus();
		return false;
	}
	
	
	
	if (!validateAlphaNumeric(frm.PWD.value))  {
		alert("Password should include at least one numeric digit.");
		frm.PWD.select();
		frm.PWD.focus();
		return false;
	}
	
	
	return true;
}

function ValidateRegConsumer(frm){


	if (trim(frm.Email.value,"") == "") {
		alert("Please enter your e-mail address.");
		frm.Email.focus();
		return false;
	}
		                
	
	 
	if (trim(frm.FName.value,"") == "") {
		alert("Please enter your first name.");
		frm.FName.focus();
		return false;
	}

	if (trim(frm.LName.value,"") == "") {
		alert("Please enter your last name.");
		frm.LName.focus();
		return false;
	}

	
	if (!checkInteger(frm.Age.value))  {
	    alert("Invalid Age.");		
		frm.Age.focus();
		return false;
	}
	if (trim(frm.Address1.value, "") == "") {
	    alert("Please enter your Address.");
	    frm.Address1.focus();
	    return false;
	}

	if (trim(frm.City.value, "") == "") {
	    alert("Please enter your City.");
	    frm.City.focus();
	    return false;
	}

	if (frm.State[frm.State.selectedIndex].value == '0') {
	    alert("Please select your State.");
	    frm.State.focus();
	    return false;
	}
	if (trim(frm.Zip.value,"") == "") {
		alert("Please enter your Zip Code.");
		frm.Zip.focus();
		return false;
}
if (frm.Country.selectedIndex < 1) {
    alert("Please select your Country.");
    frm.Country.focus();
    return false;
}

	
	if (!validateEmail(frm.Email.value)) {
	    alert("Invalid e-mail address.");
	    frm.Email.select();
	    frm.Email.focus();
	    return false;
	}
	if (trim(frm.vEmail.value, "") == "") {
	    alert("Please confirm the e-mail.");
	    frm.vEmail.focus();
	    return false;
	}

	if (trim(frm.Email.value) != trim(frm.vEmail.value)) {
	    alert("e-mails do not match.");
	    frm.vEmail.focus();
	    return false;
	}

	if (trim(frm.PWD.value, "") == "") {
	    alert("Please enter a vaid Password.");
	    frm.PWD.focus();
	    return false;
	}
	if (frm.PWD.value.length < 4 || frm.PWD.value.length > 10) {
	    alert("Password must be 4 to 10 characters.");
	    frm.PWD.focus();
	    return false;
	}

	if (!validateAlphaNumeric(frm.PWD.value)) {
	    alert("Password should include at least one numeric digit.");
	    frm.PWD.select();
	    frm.PWD.focus();
	    return false;
	}


	if (trim(frm.vPWD.value, "") == "") {
	    alert("Please confirm the Password.");
	    frm.vPWD.focus();
	    return false;
	}
	if (trim(frm.PWD.value) != trim(frm.vPWD.value)) {
	    alert("Passwords do not match.");
	    frm.vPWD.focus();
	    return false;
	}
	
	return true;
}


function ValidateActivation(frm){


	if (trim(frm.Email.value,"") == "") {
		alert("Please enter your e-mail address.");
		frm.Email.focus();
		return false;
	}
		                
	if (!validateEmail(frm.Email.value))  {
		alert("Invalid e-mail address.");
		frm.Email.select();
		frm.Email.focus();
		return false;
	}
	
	return true;
}

function validateEmail(email) {
    if( /^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,4})$/.test(email) ) {
        return (true); // Valid
    } else {
        return(false); // Invalid
    }
}

function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function checkInteger (str){
if( /^\d*$/.test(str) ) {
        return (true); // Valid
    } else {
        return(false); // Invalid
    }
}

function validateAlphaNumeric(str) {
    if(/\d/.test(str) ) {
        return (true); // Valid
    } else {
        return(false); // Invalid
    }
}
