function ValidateForm(theform) 
{
	if(theform.name.value=='') {
		alert('Please provide your name')
		theform.name.focus()
		return false
	}

	if(theform.document.value=='') {
		alert('Please provide a document')
		theform.document.focus()
		return false
	}

	if(theform.company.value=='') {
		alert('Please specify company name')
		theform.company.focus()
		return false
	}

	if(theform.message.value=='') {
		alert('Message cannot be empty')
		theform.message.focus()
		return false
	}

	if(theform.telephone.value=='') {
		alert('Please provide a contact number')
		theform.telephone.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
	}

	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
}
