function validateForm() {
	document.supportForm.valid.value = "false";

	// Name
	if ((document.supportForm.name.value == null) || (document.supportForm.name.value == "") || (document.supportForm.name.value == " ")) {
		alert ("Please fill in your full name in the 'Full name' field.");
		document.supportForm.name.focus();
		document.supportForm.name.select();
		//event.returnValue=false;
		return false;
	}

	// company
	if ((document.supportForm.company.value == null) || (document.supportForm.company.value == "") || (document.supportForm.company.value == " ")) {
		alert ("Please fill in the company you represent in the 'Company' field.");
		document.supportForm.company.focus();
		document.supportForm.company.select();
		//event.returnValue=false;
		return false;
	}

	// E-mail
	if ((document.supportForm.email.value == null) || (document.supportForm.email.value == "") || (document.supportForm.email.value == " ")) {
		alert ("The given e-mail address is not a valid address.");
		document.supportForm.email.focus();
		document.supportForm.email.select();
		//event.returnValue=false;
		return false;
	} else if (emailCheck(document.supportForm.email.value) == false) {
		alert ("The given e-mail address is not a valid address.");
		document.supportForm.email.focus();
		document.supportForm.email.select();
		//event.returnValue=false;
		return false;
	}

	// phone
	if ((document.supportForm.phone.value == null) || (document.supportForm.phone.value == "") || (document.supportForm.phone.value == " ")) {
		alert ("Please fill in your phone number including country and area code in the 'Telephone' field. I.e. +1-555-123-1234");
		document.supportForm.phone.focus();
		document.supportForm.phone.select();
		//event.returnValue=false;
		return false;
	}

	// subject
	if ((document.supportForm.subject.value == null) || (document.supportForm.subject.value == "") || (document.supportForm.subject.value == " ")) {
		alert ("Please fill in the 'Subject' field.");
		document.supportForm.subject.focus();
		document.supportForm.subject.select();
		//event.returnValue=false;
		return false;
	}

	// message
	if ((document.supportForm.message.value == null) || (document.supportForm.message.value == "") || (document.supportForm.message.value == " ")) {
		alert ("Please state your question in the 'Message' field	.");
		document.supportForm.message.focus();
		document.supportForm.message.select();
		//event.returnValue=false;
		return false;
	}

	document.supportForm.valid.value = "true";
	//event.returnValue=true;
	return true;
}


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 seems incorrect (check @ and .'s)")
		return false
	}
	
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) {
    // user is not valid
    //alert("The username doesn't seem to be valid.")
    return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
    // this is an IP address
	  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) {
   	 // the address must end in a two letter or three letter word.
	   // 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;
}