function check(bname,bvalue) {
      var formObj = document.appl;
      if (bname == "f14") {
	    formObj.special_needs.value=bvalue;
	    return true;}
      else if (bname == "f15") {
	    formObj.smoker.value=bvalue;
	    return true;}
      else if (bname == "f16") {
	    formObj.car_parking.value=bvalue;
	    return true;}
      else if (bname == "f17") {
	    formObj.internet_access.value=bvalue;
	    return true;}
 	return true;
	}
function mailForm1() {
	var formObj = document.appl;
	formObj.method="post";
      formObj.action="contact_us_form_send.asp";
      //1 check required fields
	if (!validateForm1()) {
        return false;}
      //Validate the email address
      if (!formObj.f9.value == "") {
	    if (!emailCheckF9(formObj.f9.value)) {
          return false;}
	    }
      if (!formObj.f10.value == "") {
	    if (!emailCheckF10(formObj.f10.value)) {
          return false;}
	    }
      //Validation complete 
      formObj.submit(); 
 	return true;
	}
function validateForm1() {
	var formObj = document.appl;
      if (formObj.f1.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nYour full name.");
	    formObj.f1.focus();
	    return false;}
      else if (formObj.f2.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nStreet Address.");
	    formObj.f2.focus();
	    return false;}
      else if (formObj.f3.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nTown/City Address.");
	    formObj.f3.focus();
	    return false;}
      else if (formObj.f4.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nCounty/State address.");
	    formObj.f4.focus();
	    return false;}
      else if (formObj.f5.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nPostcode.");
	    formObj.f5.focus();
	    return false;}
      else if (formObj.f7.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nCompany/Employers Name.");
	    formObj.f7.focus();
	    return false;}
      else if (formObj.f8.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete the required field: \n\nPosition/Title.");
	    formObj.f8.focus();
	    return false;}
      else if (formObj.f9.value == "" && formObj.f10.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete one of the e-Mail fields: \n\nBusiness or Personal.");
	    formObj.f9.focus();
	    return false;}
      else if (formObj.f11.value == "" && formObj.f12.value == "" && formObj.f13.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease complete one of the telephone fields: \n\nBusiness, Home or Mobile/cell.");
	    formObj.f11.focus();
	    return false;}
      //else if (formObj.special_needs.value == "") {
	    //alert("Prelude Properties Booking Form\n\nPlease indicate whether you have special needs: \n\nY or N.");
	    //return false;}
      //else if (formObj.smoker.value == "") {
	    //alert("Prelude Properties Booking Form\n\nPlease indicate whether you are a smoker: \n\nY or N.");
	    //return false;}
      //else if (formObj.car_parking.value == "") {
	    //alert("Prelude Properties Booking Form\n\nPlease indicate whether you need car parking facilities: \n\nY or N.");
	    //return false;}
      //else if (formObj.internet_access.value == "") {
	    //alert("Prelude Properties Booking Form\n\nPlease indicate whether you need Internet access: \n\nY or N.");
	    //return false;}
      else if (formObj.f19.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease indicate your 1st choice of accommodation.");
	    formObj.f19.focus();
	    return false;}
      else if (formObj.f20.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease indicate your 2nd choice of accommodation.");
	    formObj.f20.focus();
	    return false;}
      else if (formObj.f21.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease indicate your 3rd choice of accommodation.");
	    formObj.f21.focus();
	    return false;}
	else if (!DateFromCheck()) {
	    return false;}
	else if (!DateToCheck()) {
	    return false;}
      else if (formObj.f18.value == "") {
	    alert("Prelude Properties Booking Form\n\nPlease indicate how you heard of Prelude Properties.");
	    formObj.f18.focus();
	    return false;}
      //else if (formObj.f22.value == "" && formObj.special_needs.value =="y") {
	    //alert("Prelude Properties Booking Form\n\nPlease detail your special needs in the Comments area.");
	    //formObj.f22.focus();
	    //return false;}
      return true;
      }
function emailCheckF9 (emailStr) {
/* Script url: http://javascript.internet.com/forms/check-email.html */
/* Assign appropriate text for alerts according to whose email address
   is currently being validated. */
var formObj = document.appl;
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */
/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Your business e-Mail address appears to be incorrect.\n\nPlease check that you have included the @ and all .'s");
       formObj.f9.focus();
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("Your business e-Mail address appears to be incorrect.\n\nThe username doesn't seem to be valid.")
     formObj.f9.focus();
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Your business e-Mail address appears to be incorrect.\n\nDestination IP address is invalid!")
               formObj.f9.focus();
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Your business e-Mail address appears to be incorrect.\n\nThe domain name doesn't seem to be valid.")
       formObj.f9.focus();
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("Your business e-Mail address appears to be incorrect.\n\nThe address must end in a three-letter domain, or two letter country.")
     formObj.f9.focus();
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="Your business e-Mail address appears to be incorrect.\n\nThis address is missing a hostname!"
   alert(errStr)
     formObj.f9.focus();
   return false
}

// If we've gotten this far, everything's valid!
return true;
}

function emailCheckF10 (emailStr) {
/* Script url: http://javascript.internet.com/forms/check-email.html */
/* Assign appropriate text for alerts according to whose email address
   is currently being validated. */
var formObj = document.appl;
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */
/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Your personal e-Mail address appears to be incorrect.\n\nPlease check that you have included the @ and all .'s");
       formObj.f10.focus();
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("Your personal e-Mail address appears to be incorrect.\n\nThe username doesn't seem to be valid.")
     formObj.f10.focus();
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Your personal e-Mail address appears to be incorrect.\n\nDestination IP address is invalid!")
               formObj.f10.focus();
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Your personal e-Mail address appears to be incorrect.\n\nThe domain name doesn't seem to be valid.")
       formObj.f10.focus();
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("Your personal e-Mail address appears to be incorrect.\n\nThe address must end in a three-letter domain, or two letter country.")
     formObj.f10.focus();
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="Your personal e-Mail address appears to be incorrect.\n\nThis address is missing a hostname!"
   alert(errStr)
     formObj.f10.focus();
   return false
}

// If we've gotten this far, everything's valid!
return true;
}

function DateFromCheck() {
// Check to see if user has altered Date From field
 var formObj = document.appl;
 var FrmDy = formObj.FirstSelectDay.options[formObj.FirstSelectDay.selectedIndex].value; 
 var FrmMn = formObj.FirstSelectMonth.options[formObj.FirstSelectMonth.selectedIndex].value; 
 var FrmYr = NowYear; 
 var FrmDyMnYr = FrmDy + FrmMn + FrmYr; 
 if (FrmDyMnYr==formObj.DateFrom.value) {
     alert("Prelude Properties Booking Form\n\nPlease select a date on which you wish to commence your stay with us");
     formObj.FirstSelectDay.focus();
     return false
    }
 return true;
}
function DateToCheck() {
// Check to see if user has altered Date To field
 var formObj = document.appl;
 var ToDy = formObj.LastSelectDay.options[formObj.LastSelectDay.selectedIndex].value; 
 var ToMn = formObj.LastSelectMonth.options[formObj.LastSelectMonth.selectedIndex].value; 
 var ToYr = NowYear; 
 var ToDyMnYr = ToDy + ToMn + ToYr; 
 if (ToDyMnYr==formObj.DateFrom.value) {
     alert("Prelude Properties Booking Form\n\nPlease select a date on which you wish to complete your stay with us");
     formObj.LastSelectDay.focus();
     return false
    }
 return true;
}
