function validateForm() {

// Check name value is input

var name = document.form.name.value
var namePattern = /^[a-z0-9A-Z\\' \\']+$/

if (!namePattern.test(name)) {
 alert ("Please enter your name using only letters and / or numbers")
 return false
}


// Check company name using name regexp
if (document.form.company.value) {
var company = document.form.company.value

if (!namePattern.test(company)) {
 alert ("Please enter your company name using only letters and / or numbers")
 return false
 }
}

// Check sitetype drop down box is selected

if (document.form.sitetype.value == '') {
 alert ("Please select the type of site you're interested in")
 return false
}


// Check tel no is only numbers

if (document.form.tel.value) {

var telno = document.form.tel.value
var telPattern = /^[0-9\\' \\'\\+]+$/

if (!telPattern.test(telno)) {
 alert ("Please enter your telephone number using only numbers and spaces")
 return false
 }
}


// Check comment value is valid

if (document.form.comment.value) {
var comment = document.form.comment.value
var commentPattern = /^[a-z0-9A-Z\?!$£&\,\.\\' \\']+$/

if (!commentPattern.test(comment)) {
 alert ("Sorry, your comment includes invalid characters. Please use only letters and / or numbers.")
 return false
 }
}



// Validate email address

    var inputValue = document.form.email.value
    var foundAt = false
    var foundDot = false

    // Step through the inputValue looking for
    // "@" and "."

    for (var i=0; i<=inputValue.length; i++) {
      if (inputValue.charAt(i) == "@" ) {
          foundAt = true
      }
      else if (inputValue.charAt(i) == ".") {
          foundDot = true
      }
    }

    // If both "@" and "." were found, assume
    // the e-mail address is valid; otherwise,
    // return false so the calling code knows
    // the e-mail address is invalid.

    if (foundAt && foundDot) {
        return true
    }
    else {
    alert ("Please enter a valid email address")
        return false
    }



}


// Confirm deletion of an object

function confirmDelete()
{
var agree=confirm("Are you sure you want to delete?");
if (agree)
	return true ;
else
	return false ;
}