function formCheck() {

	if (document.forms.contact.fname.value == "") {
		alert("Please include your first name.");
		return false;		
	}
	
	if (document.forms.contact.lname.value == "") {
		alert("Please include your last name.");
		return false;		
	}	
	
	if (document.forms.contact.state.value == "") {
		alert("Please include the state where you live.");
		return false;		
	}	
	


	//if (!checkPhone(document.forms.contact.phoneAreaCode.value.toString(), document.forms.contact.phonePrefix.value.toString(), document.forms.contact.phoneSuffix.value.toString(), "")) { return false; }
	
		

	if(!checkMail(document.forms.contact.email.value.toString(), "")) { return false; }
	
   	var boxStatus="false";
	var count=0;
	
	 for (var i=0; i<document.forms.contact.elements['contactMethod[]'].length; i++) {
	 
	    if (document.forms.contact.elements['contactMethod[]'][i].checked == true) {
			count++;
			//alert(count);
		    boxStatus = "true";
		} 
	}
		
	if (boxStatus != "true") {
		if(!confirm("You didn't select a contact Method. Please check one of the boxes if you want to receive info.")) {
		return false;
		} else { return true; }
   }

}	

function tellAFriendCheck() {

	if (document.forms.tellafriend.senderName.value == "") {
		alert("Please include your name.");
		return false;		
	}
	
	if(!checkMail(document.forms.tellafriend.senderEmail.value.toString(), "")) { return false; }	
	
	if(!checkMail(document.forms.tellafriend.sendToEmail.value.toString(), "")) { return false; }
}	

function checkPhone(theAreaCode,thePrefix,theSuffix, whichPhone) {

	var phone = "";
	var areaCode = theAreaCode;
	var prefix = thePrefix;
	var suffix = theSuffix;
	phone = areaCode + prefix + suffix; 

	//if (phone == "") {
	
		if (phone.length < 10) {
			if (areaCode.length < 3) {
				alert(whichPhone + " Area code must have three digits.");
				return false;
			}
			if (prefix.length < 3) {
				alert(whichPhone + " Phone prefix must have three digits.");
				return false;
			}
			if (suffix.length < 4) {
				alert(whichPhone + " Phone suffix must have four digits.");
				return false;
			}
		}
	//}
	return true;
}

function checkMail(theEmail, whichEmail) {
	var x = "";
	x= theEmail;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
	if (filter.test(x)) {
		var emailArray = x.split(".");
		var extension = emailArray[(emailArray.length-1)];
		var leftOfExt = emailArray[(emailArray.length-2)].split("@");
		var domainName = leftOfExt[(leftOfExt.length-1)];
		if(extension.length != 3){
			if(!confirm("The email address: " +theEmail+ "\nhas an extension of "+extension.length+" letters (."+extension+").\nIs this Ok?")) {
				return false;
			} 
		}
			
		if(domainName.length < 2 || domainName.length > 26) {
			if(!confirm("The email address: " +theEmail+ "\nhas a domain of "+domainName.length+" letters ("+domainName+").\n Domains are usually between 2 and 26 characters long.\nIs this Ok?")) {
				return false;
			} else { return true; }				
		}		
	}
	else { 
		alert("There appears to be an incorrect " +whichEmail+ " email address.  Please check it and try again.");
		return false;
	}
	return true;
}
//////////////////////////////////////////////////////////////////////////////////////////
function dropDownSubmit(a,v,f) {
//alert( v & f);
if (v.value == "") {
	alert("Please select a valid value.");
	return false;
	}
f.action=a;
f.submit();

}

//////////////////////////////////////////////////////////////////////////////////////////