 /*check*/
 function checkform ()
 	{
  		if ( ValidateForm() ) {document.contactus.submit();}
 	}
 /*validate*/
 function ValidateForm() {
 thisform = document.contactus;

  if (document.contactus.fullname.value.length <1 )
  {
   thisform.fullname.focus();
   alert('please enter your name');
  }
  else if (emailvalidation(thisform.emailaddress,"Please check your email address")==false) {thisform.emailaddress.focus(); return false;}
  else if (emptyvalidation(thisform.phone,"Please check your daytime phone")==false) {thisform.phone.focus(); return false;}
  else if (emptyvalidation(thisform.company,"Please check your company")==false) {thisform.company.focus(); return false;}
  else {document.contactus.submit();}
  }


   /*empty*/
 function emptyvalidation(entered, alertbox){

  with (entered)
  {
  if (entered==null || entered=="" || value.length < 2 )
  {if (alertbox!="") {alert(alertbox);} return false;}
  else {return true;}
  }
 }

 /*email validation*/
	function emailvalidation(entered, alertbox){
	with (entered)
	{
	apos=value.indexOf("@");
	dotpos=value.lastIndexOf(".");
	lastpos=value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
	{if (alertbox) {alert(alertbox);} return false;}
	else {return true;}
	}
	}

