<!--

function validateSubmission(thisform) {
 with (thisform){
    thisName = contact_named.value;
	thisTelNo = tel_no.value;
	thisEmail = email_address.value;
    if ((thisName == "Your Name") || (isEmpty(thisName))) {
      alert ("Please enter a valid name.");
	  contact_named.focus();
      return false;
	}
	if ((thisTelNo == "Tel. No.") || (isEmpty(thisTelNo))) {
      alert ("Please enter a valid telephone number.");
	  tel_no.focus();
      return false;
	}
    if (isEmail(thisEmail)) {
      return true;
    } else {
      alert ("Please enter a valid email address.");
	  email_address,focus();
      return false;
    }
   }
  }
  
	// Check whether string s is empty.
	function isEmpty(s)
	{   
	  return ((s == null) || (s.length == 0))
	}
  
	function trim(s)
	{
	  if (s.substr(0, 1) == " ")
	  {
	    s = trim(s.substr(1, s.length - 1))
	  }
	  if (s.substr(s.length - 1, 1) == " ")
	  {
	    s = trim(s.substr(0, s.length - 1))
	  }
	  return s
	}

	// Returns true if string s is empty or 
	// whitespace characters only.

	function isWhitespace (s)
	{
	  // whitespace characters
	  var whitespace = " \t\n\r";   
	  var i;

	  // Is s empty?
	  if (isEmpty(s))
	  {
	    return true
	  }
	  // Search through string's characters one by one
	  // until we find a non-whitespace character.
	  // When we do, return false; if we don't, return true.
	  for (i = 0; i < s.length; i++)
	  {   
		// Check that current character isn't whitespace.
		var c = s.charAt(i);

		if (whitespace.indexOf(c) == -1)
		{
		  return false
		}
	  }
	  // All characters are whitespace.
	  return true;
	}
  
	// isEmail (STRING s)
	// 
	// Email address must be of form a@b.c ... in other words:
	// * there must be at least one character before the @
	// * there must be at least one character before and after the .
	// * the characters @ and . are both required
	//
	// For explanation of optional argument emptyOK,
	// see comments of function isInteger.

	function isEmail (s)
	{   
	  
	  var sValue = trim(s)
	  var sLength = sValue.length
	  
	  if (isEmpty(trim(s))) {
      return false
	  }
	   
	  // is s whitespace?
	  if (isWhitespace(sValue)) {
	    return false
	  }
	    
	  // there must be >= 1 character before @, so we
	  // start looking at character position 1 
	  // (i.e. second character)
	  var i, j

	  // look for @. There has to be one, and it can't be in the
	  // first or last positions.
	  i = sValue.indexOf("@")
	  if ((i < 1) || (i == sLength - 1)) {
	    return false
	  }
	  // Check there are no more @ after the first
	  if (sValue.indexOf("@", i + 1) != -1) {
	    return false
	  }
	  // look for . which can't be the character after the @
	  // and can't be the last character
	  j = sValue.indexOf(".", i + 1)
	  if ((j == i + 1) || (j == sLength - 1) || (j == -1)) {
	    return false
	  }
	  if ((sValue.indexOf(" ") != -1) 
	   || (sValue.indexOf("\t") != -1) 
	   || (sValue.indexOf("\n") != -1) 
	   || (sValue.indexOf("\r") != -1))
	  {
	    return false
	  }
	  // Must be OK
      return true
	}

// -->
