function form_validate(theForm) {
  
  theForm.sOrg.style.background = "#FFFFFF";
  theForm.sName.style.background = "#FFFFFF";
  theForm.sNum1.style.background = "#FFFFFF";
  theForm.sNum2.style.background = "#FFFFFF";
  theForm.sNum3.style.background = "#FFFFFF";
  theForm.sEmail.style.background = "#FFFFFF";
  theForm.sDate.style.background = "#FFFFFF";
  theForm.sLoc.style.background = "#FFFFFF";

	
  if (theForm.sOrg.value == "")
  {
    alert("Please enter Your Organization.");
    theForm.sOrg.focus();
    theForm.sOrg.style.background = "#F6F6F6";
    return (false);
  }
  
  
  if (theForm.sName.value == "")
  {
    alert("Please enter Your Name.");
    theForm.sName.focus();
    theForm.sName.style.background = "#F6F6F6";
    return (false);
  }

if (theForm.sNum1.value == "")
  {
    alert("Please enter an area code for the \"Phone\" field.");
    theForm.sNum1.focus();
    theForm.sNum1.style.background = "#F6F6F6";
    return (false);
  }
  
 
 if (theForm.sNum1.value.length!=3)
  {
    alert("Please enter a correct value for the Area Code.\nA 3 digit area code should be entered.");
    theForm.sNum1.focus();
    theForm.sNum1.style.background = "#F6F6F6";
    return (false);
  }   
  
  
 if (theForm.sNum2.value == "")
  {
    alert("Please enter a prefix for the Phone field.");
    theForm.sNum2.focus();
    theForm.sNum2.style.background = "#F6F6F6";
    return (false);
  }
  
  if (theForm.sNum2.value.length!=3)
  {
    alert("Please enter a correct value for the Phone field.\nA 3 digit prefix should be entered.");
    theForm.sNum2.focus();
    theForm.sNum2.style.background = "#F6F6F6";
    return (false);
  } 
  
  
  
 if (theForm.sNum3.value == "")
  {
    alert("Please enter a value for the last 4 digits of your phone");
    theForm.sNum3.focus();
    theForm.sNum3.style.background = "#F6F6F6";
    return (false);
  }
  
  if (theForm.sNum3.value.length!=4)
  {
    alert("Please enter a correct value for the last 4 digits of your phone.");
    theForm.sNum3.focus();
    theForm.sNum3.style.background = "#F6F6F6";
    return (false);
  }   


  
  if (theForm.sEmail.value == "")
  {
    alert("Please enter Your Email.");
    theForm.sEmail.focus();
    theForm.sEmail.style.background = "#F6F6F6";
    return (false);
  } 
  
  if (theForm.sEmail.value.length <= 3)
  {
    alert("Please enter a valid \"Email Address\" field.\nEmail address should be entered as name\@domain.com");
    theForm.sEmail.focus();
    theForm.sEmail.style.background = "#F6F6F6";
    return (false);
  } 
  
  if (theForm.sEmail.value.length > 3)
  {
  	if(!email_validate(theForm.sEmail.value))
  	{
    alert("Please enter a valid \"Email Address\" field.\nEmail address should be entered as name\@domain.com");
   		theForm.sEmail.focus();
    	theForm.sEmail.style.background = "#F6F6F6";
    	return (false);
    }
  } 
  
  
  if (theForm.sMessage.value == "")
  {
    alert("Please enter Your Message.");
    theForm.sMessage.focus();
    theForm.sMessage.style.background = "#F6F6F6";
    return (false);
  }
  
  
  
  
 
return (true);
  
}



function email_validate(e)
{
	accept = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++)
	{
		if(accept.indexOf(e.charAt(i))<0)
		{ 
			return (false);
		}       
	} 

	if (document.images)
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two))
		{
			return (-1);            
		} 
	}
}
