/*
    
    Date: 3/15/03	

    This Code and Idea is Copyright 2003 SonnySales.com
    GetThatMenu.com is a division of SonnySales.com. By no means
    may this code or idea be implemented without written authority
    by SonnySales or its divisions.

*/



// JavaScript Document

function clearField(thefield){
	if (thefield.defaultValue==thefield.value) 
	thefield.value = ""
}



function gray(){
	
	document.theform.subb.disabled = true;
	//document.theform.subb.style.visibility="hidden"; //set to hidden

}

/////////////////////////////////////

function isNumeric(val){

return(parseFloat(val,10)==(val*1));

}
/////////////////////////////////////////




function checkform() {
	var missing = "";
	var count = 0;
		
if (document.theform.firstname.value == "" || document.theform.firstname.value == document.theform.firstname.defaultValue) { missing +="\n Contact Name"; }
	//if (document.theform.lastname.value == "" || document.theform.lastname.value == document.theform.lastname.defaultValue) { missing +="\n Last Name"; }
if ( !(/^[^@]+@[^@]+(\.[^@]+)+$/.test(document.theform.email1.value))) { missing +="\n Email Address"; };
if ( !(/^[^@]+@[^@]+(\.[^@]+)+$/.test(document.theform.email2.value))) { missing +="\n Confirm Email Address"; };
if ((document.theform.email1.value) != (document.theform.email2.value)) { missing +="\n Email\'s Do Not Match"; };
//if (document.theform.orgarea.value == "" || document.theform.orgarea.value == document.theform.orgarea.defaultValue || ! isNumeric(document.theform.orgarea.value)) { missing +="\n Orginization Phone Area Code"; }

if ( (document.theform.orgarea.value) || (document.theform.orgphone.value) ) {
if (document.theform.orgarea.value == "" || document.theform.orgarea.value == document.theform.orgarea.defaultValue || ! isNumeric(document.theform.orgarea.value)) { missing +="\n Phone Area Code"; }
if (document.theform.orgphone.value == document.theform.orgphone.defaultValue || !(/^\d{3}-?\d{4}$/.test(document.theform.orgphone.value))) { missing +="\n Phone Number"; }
if (!document.theform.best_time.selectedIndex) { missing +="\n Best Time To Call"; }
								 }
								 
								 

	//if (document.theform.refer.value == "" || document.theform.refer.value == document.theform.refer.defaultValue) { missing +="\n Organization Name"; }
	//if (document.theform.SITE_ADDRESS1.value == "" || document.theform.SITE_ADDRESS1.value == document.theform.SITE_ADDRESS1.defaultValue) { missing +="\n Mailing Address"; }
	//if (document.theform.city.value == "" || document.theform.city.value == document.theform.city.defaultValue) { missing +="\n City"; }
	//if (!document.theform.state.selectedIndex) { missing +="\n State"; }
	//if (document.theform.zipcode.value == "" || document.theform.zipcode.value == document.theform.zipcode.defaultValue) { missing +="\n Postal/Zip Code"; }
//if (document.theform.referred.value == "" || document.theform.referred.value == document.theform.referred.defaultValue) { missing +="\n How Where Your Referred"; }
if (document.theform.subject.value == "" || document.theform.subject.value == document.theform.subject.defaultValue) { missing +="\n Subject"; }
if (document.theform.inquiry.value == "" || document.theform.inquiry.value == document.theform.inquiry.defaultValue) { missing +="\n Enter Inquiry"; }
	
	
	//if (!document.theform.COUNTRY.selectedIndex) { missing +="\n Country"; }

//if (document.theform.regarea.value == "" || document.theform.regarea.value == document.theform.regarea.defaultValue || ! isNumeric(document.theform.regarea.value)) { missing +="\n Phone Area Code"; }
//if (document.theform.regphone.value == document.theform.regphone.defaultValue || !(/^\d{3}-?\d{4}$/.test(document.theform.regphone.value))) { missing +="\n Phone number"; }



	//if (!document.theform.WW_NUMBER_OF_EMP.selectedIndex) { missing +="\n Number of employees"; }
	//if (!document.theform.INDUSTRY_TYPE.selectedIndex) { missing +="\n You industry"; }
	//if (!document.theform.JOB_FUNCTION.selectedIndex) { missing +="\n Your function"; }

	//if (!document.theform.CONTACT_BY_EMAIL.checked &&
	//!document.theform.CONTACT_BY_PHONE.checked &&
	//!document.theform.CONTACT_BY_FAX.checked &&
	//!document.theform.CONTACT_BY_MAIL.checked &&
	//!document.theform.DO_NOT_CONTACT.checked) { missing +="\n Contact method"; }

	if (missing !="") {
		missing = "Please enter the following information: \n" + missing;
		alert(missing);
		return false;
	} else {
		
		return true; 
		
	}
}
