function formCheck(theform) 
{
	if(theform.name.value=='') {
		alert('Name field cannot be empty')
		theform.name.focus()
		return false
	}

	if(theform.contact.value=='') {
		alert('Contact field cannot be empty')
		theform.contact.focus()
		return false
	}

	if(theform.email.value=='') {
		alert('Email field cannot be empty')
		theform.email.focus()
		return false
	}

	if(checkForValidEmailAddress(theform.email)==false) {
		alert('Please enter a valid e-mail address')
		theform.email.focus()
		return false
	}

	if ((theform.customer[0].checked==false) && (theform.customer[1].checked==false)) {
		alert('Please indicate if you are an existing customer')
		theform.customer[0].focus()
		return false
	}

	if(checkSelect(theform.products)==false) {
		alert('Please select the product you have purchased before')
		theform.products.focus()
		return false
	}

	if(checkSelect(theform.action)==false) {
		alert('Please select what you would like to do')
		theform.action.focus()
		return false
	}

	if(theform.enquiry.value=='') {
		alert('Enquiry / Comments field cannot be empty')
		theform.enquiry.focus()
		return false
	}

  return true
}

function checkSelect(theSelect)
{
	if (theSelect.options[0].selected == true) {
		return false;
	}
	return true;
}

function checkForValidEmailAddress(theinput)
{
	s=theinput.value

	if(s.search) {
		return (s.search(new RegExp("^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-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
}
