


function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}

window.onload = externalLinks;



function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function CheckForm2( theform )

{

var result = false
  var theStr = new String(theform.email)
  var index = theStr.indexOf("@");

	var bMissingFields = false;
	var strFields = "";

	if( theform.name.value == '' ){
		bMissingFields = true;
		strFields += "     Name\n";
	}

	if( theform.Addr1.value == '' ){
		bMissingFields = true;
		strFields += "     Your Address \n";
	}


	if( theform.Postcode.value == '' ){
		bMissingFields = true;
		strFields += "     Postcode\n";
	}

  if (theform.Postcode.value != theform.Confirm_Postcode.value)
  {
       bMissingFields = true;
		strFields += "     Postcode do not match\n";
  }

	if( theform.phone.value == '' ){
		bMissingFields = true;
		strFields += "     Phone\n";
	}


	if( theform.Date.value == '' ){
		bMissingFields = true;
		strFields += "     Date\n";
	}

	if( theform.Pickup_Addr1.value == '' ){
		bMissingFields = true;
		strFields += "     Pickup Address\n";
	}

	/*if( theform.Pickup_Postcode.value == '' ){
		bMissingFields = true;
		strFields += "     Pickup Postcode\n";
	}*/
	

	if( theform.Destination_Addr1.value == '' ){
		bMissingFields = true;
		strFields += "     Destination Address\n";
	}


	if( theform.email.value == '' ){
		bMissingFields = true;
		strFields += "     Email\n";
	}

  if (theform.email.value != theform.email1.value)
  {
       bMissingFields = true;
		strFields += "     Emails do not match\n";
  }


  if (!isEmailAddr(theform.email.value))
  {
       bMissingFields = true;
		strFields += "     email address in the form yourname@yourdomain.com\n";
  }

  if (theform.email.value.length < 3)
  {
       bMissingFields = true;
		strFields += "     at least 3 characters in the email field\n";
  }


	if( bMissingFields ) {
		alert( "The following information has not been filled correctly:\n" + strFields );
		return false;
	}

  	return true;
}





	function CheckForm1( theform )

	{

		var bMissingFields = false;
		var strFields = "";

		if( theform.call.value == '' ){
			bMissingFields = true;
			strFields += "     Name\n";
		}

		if (theform.call.value.length < 8)
		  {
		       bMissingFields = true;
				strFields += "     at least 8 characters in the call back field\n";
		  }



		if( bMissingFields ) {
			alert( "The Call back field is not been filled correctly:\n");
			return false;
		}

	  	return true;
	}
	
	
			function copyAddress() {
	
				if (document.forms[0].elements.copycheckbox.checked == false) {
	
					return;
	
				}
	
				var addr = '';
				var postcode = '';
	
				var addr1 = document.forms[0].elements.Pickup_Addr1.value;
				var addr2 = document.forms[0].elements.Pickup_Addr2.value;
				var addr3 = document.forms[0].elements.Pickup_Addr3.value;
				var addr4 = document.forms[0].elements.Pickup_Addr4.value;
				var postcode = document.forms[0].elements.Pickup_Postcode.value;
	
				if (addr1) {
					document.forms[0].elements.Return_Addr1.value = addr1;
				}
	
				if (addr2) {
					document.forms[0].elements.Return_Addr2.value = addr2;
				}
	
				if (addr3) {
					document.forms[0].elements.Return_Addr3.value = addr3;
				}
	
				if (addr4) {
					document.forms[0].elements.Return_Addr4.value = addr4;
				}
	
				if (postcode) {
					document.forms[0].elements.Return_Postcode.value = postcode;
				}
	
				return;
			}
	
			function untick() {
	
				document.forms[0].elements.copycheckbox.checked = false;
	
			}
	
			function enableSearchBox(box,obj1) {
	
				if (document.layers) { //Netscape 4
	
					postcodeBox = document.postcodearea;
					countyBox = document.countyarea;
	
					if (box == 'county') {
						countyBox.display = 'none'; // Disable first, firefox fix
						countyBox.display = 'inline';
						postcodeBox.display = 'none';
						obj1.county.disabled = false;
						obj1.postcode.value = '';
					}
					else if (box == 'postcode') {
						countyBox.display = 'none';
						postcodeBox.display = 'inline';
						obj1.county.disabled = true;
					}
				}
	
				else if (document.all) { //IE 4 & Opera
	
					postcodeBox = document.all.postcodearea;
					countyBox = document.all.countyarea;
	
					if (box == 'county') {
						countyBox.style.display = 'none'; // Disable first, firefox fix
						countyBox.style.display = 'inline';
						postcodeBox.style.display = 'none';
						obj1.county.disabled = false;
						obj1.postcode.value = '';
					}
					else if (box == 'postcode') {
						countyBox.style.display = 'none';
						postcodeBox.style.display = 'inline';
						obj1.county.disabled = true;
					}
				}
	
				else if (document.getElementById) { //Netscape 6 & IE 5
	
					postcodeBox = document.getElementById('postcodearea');
					countyBox = document.getElementById('countyarea');
	
					if (box == 'county') {
						countyBox.style.display = 'none'; // Disable first, firefox fix
						countyBox.style.display = 'inline';
						postcodeBox.style.display = 'none';
						obj1.county.disabled = false;
						obj1.postcode.value = '';
					}
					else if (box == 'postcode') {
						countyBox.style.display = 'none';
						postcodeBox.style.display = 'inline';
						obj1.county.disabled = true;
					}
				}
			}
	
			var counter = 0;
	
			function onceOnly() {
	
				counter++;
	
				if (counter > 1) {
					alert('Your enquiry is being sent. Please click \'OK\' and wait a moment...');
					return false;
				}
				else {
					return true;
				}
	
		}