
function hidestatus(){
window.status=''
return true
}
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
document.onmouseover=hidestatus
document.onmouseout=hidestatus


// function to check correct phone number format: (taken from join.php)
function ValidFormat(item) {
   var c = "";
   var strNum="0123456789";
   var i,j,k,t;
   sec = new Array(3);
   sec[0]=3; sec[1]=3; sec[2]=4;
   t=sec[0]+sec[1]+sec[2]+2;
   strDest = "";
   for (i=0,j=0,k=0 ; i<item.length; i++) {
      c=item.charAt(i);
      if (strNum.indexOf(c, 0) > -1) {
         strDest += c;
         j++;
         if (j==sec[k] && k<2) {
            strDest += "-";
            k++;
            j=0;
         }
      }
   }
   if (strDest.length != t) return 1;
   return 0;
}


function EstimateValidate(){
	
		if(document.frmEstimate.name.value==""){
			alert("First Name Required.");
			document.frmEstimate.name.focus();
			return false;
		}
		
		if(document.frmEstimate.lastname.value==""){
			alert("Last Name Required.");
			document.frmEstimate.lastname.focus();
		return false;
		}
		
		
	if(isNaN(document.frmEstimate.zip.value)){
			alert("Not Valid.");
			document.frmEstimate.zip.select();
		return false;
		}

		if(document.frmEstimate.phone.value==""){
			alert("Phone Number Required.");
			document.frmEstimate.phone.focus();
		return false;
		}
	
		if ((document.frmEstimate.email.value=="")||(document.frmEstimate.email.value.indexOf('@')==-1)||(document.frmEstimate.email.value.indexOf('.')==-1)){
			alert ("not a valid Email Address");
			document.frmEstimate.email.select();	
			return false;
		}
		
		if(document.frmEstimate.description.value==""){
			alert("Project Description Required.");
			document.frmEstimate.description.focus();
			return false;
		}
		
		if(document.frmEstimate.phone.value != ""){	
			var err;
			err=ValidFormat(document.frmEstimate.phone.value);

			if (err==1) {
				alert("Phone number requires 10 digits: 000-000-0000");
				document.frmEstimate.phone.select();
				return false;
			}			
		}
	
	}
	
	function NewsletterValidate(){
		
		if(document.frmNewsletter.name.value==""){
			alert("Name Required.");
			document.frmNewsletter.name.focus();
			return false;
		}
		
	
		  if ((document.frmNewsletter.email.value=="")||(document.frmNewsletter.email.value.indexOf('@')==-1)||(document.frmNewsletter.email.value.indexOf('.')==-1)){
		 alert ("not a valid Email Address");
				
		document.frmNewsletter.email.select();	
			return false;
	}
	}	
	
	
	
	function ContactValidate(){
		
		if(document.frmContact.name.value==""){
			alert("Name Required.");
			document.frmContact.name.focus();
			return false;
		}
		
		
		if(isNaN(document.frmContact.zip.value)){
			alert("Not Valid.");
			document.frmContact.zip.select();
		return false;
		}
		
		  if ((document.frmContact.email.value=="")||(document.frmContact.email.value.indexOf('@')==-1)||(document.frmContact.email.value.indexOf('.')==-1)){
		 alert ("not a valid Email Address");
				
		document.frmContact.email.select();	
			return false;
	}
	

	
			if(document.frmContact.comments.value==""){
			alert("Comments Required.");
			document.frmContact.comments.focus();
			return false;
		}
				if(document.frmContact.word.value==""){
			alert("Required.");
			document.frmContact.word.focus();
			return false;
		}

		
		
	
	}	

		
