// JavaScript Document

	/************************************************
	 bool ValidatePhone(string input)
	 Return true or false
	 if the phone number is valid or not.
	 acepts - and + symbols
	**************************************************/
	function ValidatePhone(theinput){
	 var s=theinput;
	 if(s.search)
	  return (s.search(new RegExp("[-+0-9]+","gi"))>=0);
	 if(s.length<5)
	  return false;
	 else
	  return true;
	}
	 
	/************************************************
	 bool ValidateEmail(string input)
	 Return true or false
	 if the email is valid or not.
	 checks for @ and .
	**************************************************/
	function ValidateEmail(theinput){
	 var s=theinput;
	 if(s.search)
	  return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}$","gi"))>=0);
	 if(s.indexOf)
	 {
	  at_character=s.indexOf('@');
	  if(at_character<=0 || at_character+4>s.length)
	   return false;
	 }
	 if(s.length<6)
	  return false;
	 else
	  return true;
	}
	 
	/******************************************************************
	 CheckContactForm()
	******************************************************************/
	function CheckContactForm(){
		var error="Check one option\n";

		var i = 0;
		while((i < document.frmContact.sendto.length)&&(error!="")){
			if ( document.frmContact.sendto[i].checked ) error="";
			i++;
		}
		
		if(document.frmContact.fname.value=="" || document.frmContact.fname.value.lenght<3)
			error+="First Name\n";
		if(document.frmContact.lname.value=="" || document.frmContact.lname.value.lenght<3)
			error+="Last Name\n";	
		if(document.frmContact.message.value=="")
			error+="Message\n";
		if(!ValidateEmail(document.frmContact.email.value))
			error+="Email\n";			
		if((document.frmContact.phone.value!="") && (!ValidatePhone(document.frmContact.phone.value)))
			error+="Phone\n";
		if(error!="")
			alert("Error! Please check:\n"+error);
		else {
			document.frmContact.submit();
		}
		return;
	}

