// IN THIS FILE

function validateform()
{
	
	
if (contactform.email.value != "" ){
	alert("Oops.. you filled in the leave-it-blank field.  Clear that field and try again.");
	return false;
}


	if (document.contactform.FName.value=="")
	{
		alert("You must enter your first name.");
		return(false);
	}
	
	if (document.contactform.LName.value=="")
	{
		alert("You must enter your last name.");
		return(false);
	}
	
	if (document.contactform.Address.value=="")
		{
		alert("You must enter a valid Address");
		return(false);
		}	
	
	if (document.contactform.City.value=="")
		{
		alert("You must enter a valid City.");
		return(false);
		}	
		
	if (document.contactform.ZIP.value=="")
		{
		alert("You must enter a valid Zip Code.");
		return(false);
		}		
				
	if (document.contactform.State.selectedIndex==-1 || document.contactform.State.options[document.contactform.State.selectedIndex].text == "Your State")
		{
		alert("You must choose a valid State.");
		return(false);
		}	
	/*	
	if (document.contactform.Country.selectedIndex==-1 || document.contactform.Country.options[document.contactform.Country.selectedIndex].text == "===choose===")
		{
		alert("You must choose a valid State.");
		return(false);
		}			
*/		
	var valid = 1;
	var TheNumber = document.contactform.homephone.value;
	var GoodChars = "0123456789()-+ "
	var i = 0;
	
	if (TheNumber=="") {
			alert("Phone number field is empty");
			return (false);
	}

	for (i =0; i <= TheNumber.length -1; i++) {
		if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
			valid = 0;
		} // End if statement
	} // End for loop
	
	if (valid ==0){
		alert("Please enter a valid telephone number.");	
		return (false);
	}



	var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	var strEmail = contactform.digitalmail.value;
	
	if (strEmail.length < 5) 
		valid=0;
	
	if (strEmail.search(validRegExp) == -1) 
		valid=0;
		
	if (valid == 0) {
		alert ("Invalid Email Address.");
		return (false);	
	}

}

// this function is used for parameters on landing pages
function replaceChars(entry,out,add) {
	temp = "" + entry; // temporary holder
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
return(temp);
}
