<!-- copyright ICCM 2007 -->














































function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }



function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}


//ensure necessary form fields are populated	
function validate(theform) {
	
if (theform.email.value == "" || theform.name.value == "" || theform.location.value == "" || theform.location2.value == "" || theform.location3.value == "" || theform.purchase.value == "" || theform.phone.value == "") 
		{ 
			alert("Please complete all required fields"); 
	 return false; 
      }
	
	
if(!isValidEmail(theform.email.value)) 
   { 
      alert('You have not entered a correctly formatted email address') 
      theform.email.focus(); 
      return false; 
   } 
  
if (!IsNumeric(theform.phone.value)) 
   { 
      alert('Please enter only numbers in the phone field') 
      theform.phone.focus(); 
	   return false; 
      }     

return true;
}


