function validateFormData(form, tcode) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.name.value == "" || form.name.value == "Required field")
    errorMsg += 'Your name is required.\n';
	
  if (form.tel.value == "" || form.tel.value == "Required field")
    errorMsg += 'Your telephone number is required.\n';

 if (form.enquiry.value == "" || form.enquiry.value == "Required field")
    errorMsg += 'Some general details of your enquiry are required.\n';
	
  if (form.Email.value == "" || form.Email.value == "Required field")
  {
    errorMsg += 'An Email address is required\n';
	form.Email.focus();
  }
  else
  {
	x = form.Email.value.indexOf('@');
	y = form.Email.value.indexOf('.');

    if (x < 1 || x == (form.Email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'You must give a valid Email address.\n';
	  form.Email.focus();
	  form.Email.select();
	}
	  
    s = form.Email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'Please check your email address. It should not contain or have leading/trailing spaces \n';
	  form.Email.focus();
	  form.Email.select();
	}
  }	
  
  if (form.textcode.value != tcode)
    errorMsg += 'Please copy the security characters into the box provided.\n';
	
   if (errorMsg) 
	jAlert('<p align="left"><strong>Required fields:</strong>\n'+errorMsg+'</p>');
  document.returnValue = (errorMsg == '');
}

function validateAppraisalData(form, tcode) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.name.value == "" || form.name.value == "Required field")
    errorMsg += 'Your name is required.\n';
	
  if (form.email.value == "" || form.email.value == "Required field")
  {
    errorMsg += 'An email address is required\n';
	form.email.focus();
  }
  else
  {
	x = form.email.value.indexOf('@');
	y = form.email.value.indexOf('.');

    if (x < 1 || x == (form.email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'You must give a valid email address.\n';
	  form.email.focus();
	  form.email.select();
	}
	  
    s = form.email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'Please check your email address. It should not contain or have leading/trailing spaces \n';
	  form.email.focus();
	  form.email.select();
	}
  }	
  
  if (form.textcode.value != tcode)
    errorMsg += 'Please copy the security characters into the box provided.\n';

  
   if (errorMsg) 
	jAlert('<p align="left"><strong>Required fields:</strong>\n'+errorMsg+'</p>');
  document.returnValue = (errorMsg == '');
}



