function formvalidate()
{
	//validFields is the variable that contains the number of compulsary items that have been completed
	var validFields = 0;

	//requiredFields is a list of the compulsary fields.  If you want a field made compulsary, add it in here.
	var requiredFields = new Array("firstname","lastname","company","contactnumber","contactemail","query");

	//Checking each of the fields to see if it has a value, if so, increment validFields
	for (i=0; i<requiredFields.length ;i++ )
	{
		if (document.getElementById(requiredFields[i]).value != "")
		{
			validFields = validFields+1;
		}
	}

	//if the number of completed fields doesn't equal the number of compulsary fields, alert the user.
	if (validFields != requiredFields.length)
	{
		alert("Please complete all fields marked * before submitting.");
	}

	//if the number of completed fields does equal the number of compulsary fields, submit the form.
	if (validFields == requiredFields.length)
	{
		//lastly we check they have supplied a valid email address, if so the form is submitted, if not they are prompted to enter one.
		if (document.getElementById("contactemail").value.indexOf("@") < 0)
		{
			alert("Please enter a valid e-mail address");
		}
		else
		{
			document.getElementById("emailform").submit();
			//alert("gone");
		}
	}
}