// Below is for Include Callback form data checking
function validate_include_contact_brief(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
if (form.from.value == "" )
    errorMsg += 'Your Name is required\n';

if (form.duedate.value == "" )
    errorMsg += 'Your Due date  is required\n';

if (form.tel.value == "" )
    errorMsg += 'Your Telephone number is required\n';

  if (form.email.value == "" )
  {
    errorMsg += 'Your Email address is required\n';
	form.email.focus();
  }
   if (form.clinic.value == "" )
  {
    errorMsg += 'Please select a clinic\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 spaces\n';
	  form.email.focus();
	  form.email.select();
	}
  }		
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
  document.returnValue = (errorMsg == '');
}

function validate_include_comments(form, tcode) 
{
//  alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
if (form.postedby.value == "" )
    errorMsg += 'Your Name is required\n';

//if (form.Body.value == "" )
//   errorMsg += 'Your Comment is required\n';

if (form.textcode.value != tcode)
    errorMsg += 'Please copy the security characters into the box provided.\n';	 

if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
  document.returnValue = (errorMsg == '');
}

