/*
    
    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 ( !(/^[^@]+@[^@]+(\.[^@]+)+$/.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.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.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 (missing !="") {
		missing = "Please enter the following information: \n" + missing;
		alert(missing);
		return false;
	} else {
		
		return true; 
		
	}
}
