function submitForm(theForm)
{
	//53 characters long
	var valResults = "The following field(s) need to be entered correctly:\n";

	if(theForm.firstname)
	{
		if (theForm.firstname.value == "")
		  valResults += "* First name\n";
		  
		if (theForm.surname.value == "")
		  valResults += "* Surname\n";
	}
	  
	if (theForm.address1.value == "")
	  valResults += "* Address line 1\n";
	  
	if (theForm.suburb.value == "")
	  valResults += "* Suburb\n";
	 
	if (theForm.postcode.value == "")
	  valResults += "* Postcode\n";
	  
	if (theForm.postal_address1.value == "")
	  valResults += "* Postal address line 1\n";
	  
	if (theForm.postal_suburb.value == "")
	  valResults += "* Postal address suburb\n";
	 
	if (theForm.postal_postcode.value == "")
	  valResults += "* Postal address postcode\n";
	  
	if (theForm.telephone_bh.value == "")
	  valResults += "* Phone number (business hours)\n";
	  
	if (theForm.email.value == "")
	  valResults += "* Email address\n"; 
	  
	if (theForm.email.value !="")
	{
	  if((theForm.email.value.indexOf("@") < 0) || (theForm.email.value.indexOf(".") < 0))
	      valResults += "* Email address\n";
	}
	
	if(theForm.username)
	{ 
		if (theForm.username.value == "")
		  valResults += "* Username\n";     
	}

	if (valResults.length < 54)
	{   
		var qualSelected = false;
		var x = 0;

		while((x < theForm.qualification.length) && (!qualSelected))
		{
		  if(theForm.qualification[x].checked)
		  {
				qualSelected = true;
		  }
		  
		  x++;
		} 

		if(qualSelected)
		{
		  if((!theForm.qualificationtype[0].checked) && (!theForm.qualificationtype[1].checked))
		  {
			  alert("Please select whether your qualification is in translation or interpreting.");
			  return false;
		  }	  
		}
		else
		{
			// A qualification has not been selected, but check to see if a qualification type has
		  if((theForm.qualificationtype[0].checked) || (theForm.qualificationtype[1].checked))
		  {
			  alert("Please select a qualification level. e.g. Diploma.");
			  return false;
		  }			  		  
		}    


	       
	  return true;
	}

	else   
	{       
	  alert(valResults);         
	  return false;
	}
	}

function submitContactForm(theForm)
{
    //53 characters long
    var valResults = "The following field(s) need to be entered correctly:\n";

    if (theForm.name.value == "")
        valResults += "* name\n";
    if (theForm.phoneNumber.value == "")
        valResults += "* phone number\n";
    if (theForm.message.value == "")
        valResults += "* message\n";
	if (theForm.captcha_code.value == "")
		valResults += "* security code";
		
    if (valResults.length <54)
    {
        return true;
    }

    else
    {
        alert(valResults);
        return false;
    }
}

function submitAdminContactForm(theForm)
{
    //53 characters long
    var valResults = "The following field(s) need to be entered correctly:\n";

    if (theForm.phoneNumber.value == "")
        valResults += "* phone number\n"
    if (theForm.message.value == "")
        valResults += "* change details";

    if (valResults.length <54)
    {
        return true;
    }

    else
    {
        alert(valResults);
        return false;
    }
}

function checkLoginForm(theForm)
{
	if(theForm.username.value == "")
	{
		alert("Please enter your username");
		theForm.username.focus();
		return false;
	}
	else if(theForm.password.value == "")
	{
		alert("Please enter your password");
		theForm.password.focus();
		return false;		
	}
}

function clearQuals()
{
	var theForm = document.update_form;
	var x = 0;

	while(x < theForm.qualification.length)
	{
		theForm.qualification[x].checked = false;
		x++;
	}
	
	theForm.qualificationtype[0].checked = false;
	theForm.qualificationtype[1].checked = false;				
}