
<!-- Begin
function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")



var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("Email address is incorrect. Please try again.")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}


var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}

return true;
}


function validateForm()
{
	if(document.mainform.strCustFirstName2.value=='')
	  {
		alert("Please enter customer first name.");
        document.mainform.strCustFirstName2.focus();
		return false;
	  }
    if(document.mainform.strCustLastName2.value=='')
	  {
		alert("Please enter customer last name.");
        document.mainform.strCustLastName2.focus();
		return false;
	  }
    if(document.mainform.strCustPhone12.value=='')
	  {
		alert("Please enter customer phone no.");
        document.mainform.strCustPhone12.focus();
		return false;
	  } 
    if(document.mainform.strCustEmail2.value=='')
	  {
		alert("Please enter customer email.");
        document.mainform.strCustEmail2.focus();
		return false;
	  } 
    if(!emailCheck(document.mainform.strCustEmail2.value))
	  {
        document.mainform.strCustEmail2.focus();
		return false;
	  }
	if(document.mainform.year.value=='0')
	  {
		alert("Please select year.");
        document.mainform.year.focus();
		return false;
	  } 
    if(document.mainform.strDateAvailable2.value=='')
	  {
		alert("Please enter a date.");
        document.mainform.strDateAvailable2.focus();
		return false;
	  } 
	if(document.mainform.strPickup_Contact2.value=='')
	  {
		alert("Please enter pickup contact name.");
        document.mainform.strPickup_Contact2.focus();
		return false;
	  } 
	 if(document.mainform.strPickup_Address12.value=='')
	  {
		alert("Please enter pickup contact address.");
        document.mainform.strPickup_Address12.focus();
		return false;
	  }  
    if(document.mainform.strPickup_HomePhone2.value=='' && document.mainform.strPickup_WorkPhone2.value=='')
	  {
		alert("Please enter at-least one phone.");
        document.mainform.strPickup_HomePhone2.focus();
		return false;
	  } 
	  

    if(document.mainform.strDeliver_Contact2.value=='')
	  {
		alert("Please enter deliver contact name.");
        document.mainform.strDeliver_Contact2.focus();
		return false;
	  } 
	 if(document.mainform.strDeliver_Address12.value=='')
	  {
		alert("Please enter deliver contact address.");
        document.mainform.strDeliver_Address12.focus();
		return false;
	  }  
    if(document.mainform.strDeliver_HomePhone2.value=='' && document.mainform.strDeliver_WorkPhone2.value=='')
	  {
		alert("Please enter at-least one phone.");
        document.mainform.strDeliver_HomePhone2.focus();
		return false;
	  } 
   if(document.mainform.billing_fname.value=="")
	  {
		alert("Please enter the billing first name.");
		document.mainform.billing_fname.focus();
		return false;
	  }
	if(document.mainform.billing_lname.value=="")
	  {
		alert("Please enter the billing last name.");
		document.mainform.billing_lname.focus();
		return false;
	  }
	if(document.mainform.billing_street_address.value=="")
	  {
		alert("Please enter the billing address.");
		document.mainform.billing_street_address.focus();
		return false;
	  }
	if(document.mainform.billing_city.value=="")
	  {
		alert("Please enter the billing city.");
		document.mainform.billing_city.focus();
		return false;
	  }
	if(document.mainform.billing_state.value=="0")
	  {
		alert("Please enter the billing state.");
		document.mainform.billing_state.focus();
		return false;
	  }
	if(document.mainform.billing_postcode.value=="")
	  {
		alert("Please enter the billing postcode.");
		document.mainform.billing_postcode.focus();
		return false;
	  }
	if(document.mainform.credit_card.value=="")
	  {
		alert("Please enter the credit card no.");
		document.mainform.credit_card.focus();
		return false;
	  }
	if(document.mainform.month.value=="-1")
	  {
		alert("Please enter the credit card expiry month.");
		document.mainform.month.focus();
		return false;
	  }
	if(document.mainform.cc_year.value=="-1")
	  {
		alert("Please enter the credit card expiry year.");
		document.mainform.cc_year.focus();
		return false;
	  }
    if(document.mainform.cc_code.value=="")
	  {
		alert("Please enter the credit card code.");
		document.mainform.cc_code.focus();
		return false;
	  }
}
//  End -->
