// JavaScript Document

function isEmailAddr(email)
{
	var result = false
	var theStr = new String(email)
	var index = theStr.indexOf("@");
	if (index > 0)
	{
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
	}
	return result;
}
	
function check()
{
	if(document.query.name.value == "")
	{
		alert("Name not given");
		document.query.name.focus();
		return false;
	}
	
	if(document.query.address.value == "")
	{
		alert("Address not given");
		document.query.address.focus();
		return false;
	}

	if(document.query.telephone.value == "")
	{
		alert("Telephone not given");
		document.query.telephone.focus();
		return false;
	}
	
	if(document.query.mobile.value == "")
	{
		alert("Mobile not given");
		document.query.mobile.focus();
		return false;
	}

	if(document.query.email.value == "")
	{
		alert("Email Address not given");
		document.query.email.focus();
		return false;
	}
	
	if(!isEmailAddr(document.query.email.value))
	{
		alert("Please provide correct email address in the form: yourname@yourdomain.com");
		document.query.email.focus();
		return false;
	}
	
	if(document.query.generalquery.value == "")
	{
		alert("Enquiry not given");
		document.query.generalquery.focus();
		return false;
	}
	
	if(document.query.hearabout.value == "")
	{
		alert("Where did you hear about us?");
		document.query.hearabout.focus();
		return false;
	}
}	

