
	{ 
	self.name="BODY"; 
	} 

	function createRequestObject(lnk) {
		//function to parse querystring values to determine textfield name for which 
		//co-ordinates have to be capture in order to position the calendar there
		
	  FORM_DATA = new Object();
	  separator = ',';
	  query = lnk;
	  qu = query
	  query = query.substring((query.indexOf('?')) + 1);
	  
	  if (query.length < 1) { return false; }  // Perhaps we got some bad data?
	  keypairs = new Object();
	  numKP = 1;
	  
	  while (query.indexOf('&') > -1) {
		keypairs[numKP] = query.substring(0,query.indexOf('&'));
		query = query.substring((query.indexOf('&')) + 1);
		numKP++;  
	  }
	  keypairs[numKP] = query;
	  for (i in keypairs) {
		keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
		keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
		while (keyValue.indexOf('+') > -1) {
		  keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
		}
		keyValue = unescape(keyValue);
		if (FORM_DATA[keyName]) {
		  FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
		} else {
		  FORM_DATA[keyName] = keyValue;
		}
	  }
	  return FORM_DATA;
	}


	//Specify iframe to display. Change src and other attributes except "position" and "left/top":
	function OpenCalendar(lnk){
		parent.document.getElementById("calendar").src = lnk;
		
		FORM_DATA = createRequestObject(lnk);
		var Element=FORM_DATA['Element'];  
		openiframe(Element);
	}

	function closeiframe(){
		parent.document.getElementById("calendar").style.display="none";
	}

	function openiframe(Element){
		/*//////////Uncomment to revert back to the iframe appearing next to the button pressed//////////
		var PositionFromTop = 25;
		var PositionFromLeft = -100;
	
		elementid=parent.document.getElementById(Element)
		while( elementid != null ){
		PositionFromTop += elementid.offsetTop;
		PositionFromLeft += elementid.offsetLeft;
		elementid = elementid.offsetParent;
		}
		//alert(" link:"+PositionFromTop);
		
		  if (document.all) {
			// IE
			parent.document.getElementById("calendar").style.posTop=PositionFromTop ;
			parent.document.getElementById("calendar").style.posLeft=PositionFromLeft ;
			parent.document.getElementById("calendar").style.display="block";	  
		  // } else if (document.layers) {
		  //  alert((pos.top + date_edit.clientHeight) + "px");
		  //  calendar_widget.top = (pos.top + date_edit.clientHeight) + "px";
		  //  calendar_widget.left = pos.left + "px";
		  } else {
			// Mozilla
			parent.document.getElementById("calendar").style.position = 'absolute';
			parent.document.getElementById("calendar").style.top = PositionFromTop + "px";
			parent.document.getElementById("calendar").style.left = PositionFromLeft + "px";
			parent.document.getElementById("calendar").style.display = "block";
		  };
		PositionFromTop = 0;
		PositionFromLeft = 0;		
		/////////////////////////////////////////////////////////////////////////////////////////////*/
		  if (document.all) {
			// IE
			parent.document.getElementById("calendar").style.display="block";	  
		  // } else if (document.layers) {
		  //  alert((pos.top + date_edit.clientHeight) + "px");
		  //  calendar_widget.top = (pos.top + date_edit.clientHeight) + "px";
		  //  calendar_widget.left = pos.left + "px";
		  } else {
			// Mozilla
			parent.document.getElementById("calendar").style.display = "block";
		  };
	}
	
	
	function sendToEmailrequestForm(BookingDate, Item, Qty){
		var requestURL;
		requestURL = 'requestBooking.asp?BookingDate='+BookingDate+'&Item='+Item+'&Qty='+Qty;		
		parent.window.location.href = (requestURL);
	}
	
	
	function requestOnly(BookingDate, Item, Qty){
		var requestConfirmation = false;
		requestConfirmation=confirm('Bookings for this date can only be made by email request only. \nPress OK to be forwarded to the booking email request form');
		if (requestConfirmation==true){				
			
			sendToEmailrequestForm(BookingDate, Item, Qty);
			closeiframe();
		}else{
			//closeiframe();
		}
	}




	var update = false;

	function updatetrue(id){
	  update = true;
	  parent.document.getElementById(id).src = "../images/update_basket_high.gif"
	  
	}

	function changeStep1(){
	if (update ==true){
		
		alert('You have changed your order. \nPlease update your order before proceeding to the next step');
		}else if (document.forms['basket'].elements['subtotal'].value <1 ) {
			alert('\nYou must add an item to your order before proceeding to the next step');
			
		}else{
			//document.location.href = '<%=Application("website")%>/basket/step2.asp'}
			document.location.href = 'step2.asp'}
	}
		
	function changeStep2(){
	if (update ==true){
		
		alert('You have changed your order. \nPlease update your order before proceeding to the next step');
		}else{
			//document.location.href = '<%=Application("securesite")%>/basket/step3.asp'}
			document.location.href = 'step3.asp'}
	}

	function isInteger(s){
		var i;
		for (i = 0; i < s.length; i++){   
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		// All characters are numbers.
		return true;
	}

	function stripCharsInBag(s, bag){
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++){   
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}

	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
		// EXCEPT for centurial years which are not also divisible by 400.
		return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}

	function DaysArray(n) {
		for (var i = 1; i <= n; i++) {
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
	   } 
	   return this
	}

	function isDate(dtStr){
	  var dtCh= "/";
	  var minYear=1900;
	  var maxYear=2100;
		//var daysInMonth = DaysArray(12);
		var daysInMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strDay=dtStr.substring(0,pos1)
		var strMonth=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			//alert("The date format should be : dd/mm/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			//alert("Please enter a valid month")
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			//alert("Please enter a valid day")
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			//alert("Please enter a valid date")
			return false
		}
	return true
	}

	function isValidNumber(val){
		  if(val==null){return false;}
		  if (val.length==0){return false;}
		  var DecimalFound = false
		  for (var i = 0; i < val.length; i++) {
				var ch = val.charAt(i)
				if (i == 0 && ch == "-") {
					  continue
				}
				if (ch == "." && !DecimalFound) {
					  DecimalFound = true
					  continue
				}
				if (ch < "0" || ch > "9") {
					  return false
				}
		  }
		  return true
	}

	//validation
 	function submitBasket(operation, page) {		
         var noproducts = document.forms['basket'].elements['productcount'].value
         var flag = true;
         var dateflag = true;
         var quantityflag = true;
    		 var noquantityflag = true;
    		 var quantityExceededflag = true;
    		 var optionflag = true;
    		 var quantityTotal = 0;
    		 var quantityTotalFlag = true;
         var msg = "";
		     var productoptions  = document.forms['basket'].elements['productoptions' + i];
         
         for (var i = 1; i <= noproducts; i++) { 
              document.forms['basket'].elements['date' + i].style.backgroundColor = "#FFFFFF";             
              document.forms['basket'].elements['date' + i].disabled=false;
              document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFFFFF";	
      			  document.forms['basket'].elements['productoptions' + i].style.backgroundColor = "#FFFFFF";
      			  document.forms['basket'].elements['selectedProductOptionid' + i].value = "";
      			  document.forms['basket'].elements['selectedProductOption' + i].value = "";
			  
				
            	if (document.forms['basket'].elements['quantity' + i].value==""){
            		document.forms['basket'].elements['quantity' + i].value = 0  
            	}else{
					if (isValidNumber(document.forms['basket'].elements['quantity' + i].value)==false  ){            		
						flag = false;
						quantityflag=false;
						document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";
						if (isDate(document.forms['basket'].elements['date' + i].value)==false){
							dateflag=false;
							document.forms['basket'].elements['date' + i].style.backgroundColor = "#FFCC00";
						}
						if( document.forms['basket'].elements['productHasOption' + i].value == 1 && document.forms['basket'].elements['productoptions' + i].value ==""){
							optionflag=false;
							document.forms['basket'].elements['productoptions' + i].style.backgroundColor = "#FFCC00";							
						}
						
					}else{
						if (parseInt(document.forms['basket'].elements['quantity' + i].value)  > 0 && isDate(document.forms['basket'].elements['date' + i].value)==false){
							flag = false;
							dateflag=false;
							document.forms['basket'].elements['date' + i].style.backgroundColor = "#FFCC00";
							if( document.forms['basket'].elements['productHasOption' + i].value == 1 && document.forms['basket'].elements['productoptions' + i].value ==""){
								optionflag=false;
								document.forms['basket'].elements['productoptions' + i].style.backgroundColor = "#FFCC00";							
							}
						}						
					}
					if (page == 'step1')
					{
					//S1789, Bryan
					//both to ensure quantity is even, for certain products
					if ((document.forms['basket'].elements['SectionId' +i].value == 7) && (document.forms['basket'].elements['quantity' + i].value <= 8) && (document.forms['basket'].elements['quantity' + i].value % 2 == 1))
					    {
					        flag=false;
					        document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";
					        msg = msg + '\nPlease note all tables are for even numbers only for “'+ document.forms['basket'].elements['formattedTItle' + i].value+' – '+document.forms['basket'].elements['date' + i].value+'” \nPlease select an even number in the quantity box.';
					    }
					
					
					
					if ((document.forms['basket'].elements['SectionId' +i].value == 6) && (document.forms['basket'].elements['productid' +i].value==20 || document.forms['basket'].elements['productid' +i].value==21 || document.forms['basket'].elements['productid' +i].value==95 || document.forms['basket'].elements['productid' +i].value==96) && (document.forms['basket'].elements['quantity' + i].value <= 8) && (document.forms['basket'].elements['quantity' + i].value % 2 == 1))
					    {
					        flag=false;
					        document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";
					        msg = msg + '\nPlease note all tables are for even numbers only for “'+ document.forms['basket'].elements['formattedTItle' + i].value+' – '+document.forms['basket'].elements['date' + i].value+'” \nPlease select an even number in the quantity box.';
					    }
					}
					//End Of S1789, Bryan
					
					if (document.forms['basket'].elements['quantity' + i].value > 8 && document.forms['basket'].elements['step'].value == 1){
						var maxConfirmation = false;
						maxConfirmation=confirm('A maximum of 8 people can be booked for ' + document.forms['basket'].elements['producttitle' + i].value + ' ('+ document.forms['basket'].elements['date' + i].value +'). \nBookings of more than 8 people can be requested by emailing us. \n\nClick OK to be sent to the email booking request form or Cancel');
						if (maxConfirmation==false){
							flag=false;
							document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";	
							msg = msg + '\n Please enter a quantity value between 1 and 8';
						}else{
							
							sendToEmailrequestForm(document.forms['basket'].elements['date' + i].value, document.forms['basket'].elements['productid' + i].value, document.forms['basket'].elements['quantity' + i].value);
							flag=false;
							msg = msg + '\n You are being sent to the email booking request form';
						}
					}
					
            	}
				if (parseInt(document.forms['basket'].elements['quantity' + i].value)  > 0 && isDate(document.forms['basket'].elements['date' + i].value)==true && document.forms['basket'].elements['productHasOption' + i].value == 1 && document.forms['basket'].elements['productoptions' + i].value ==""){
					flag = false;
					optionflag=false;
					document.forms['basket'].elements['productoptions' + i].style.backgroundColor = "#FFCC00";							
				}
				if (parseInt(document.forms['basket'].elements['quantity' + i].value)  == 0 && isDate(document.forms['basket'].elements['date' + i].value)==false && document.forms['basket'].elements['productHasOption' + i].value == 1 && document.forms['basket'].elements['productoptions' + i].value !=""){
					flag = false;
					dateflag=false;
					quantityflag=false;
					document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";							
					document.forms['basket'].elements['date' + i].style.backgroundColor = "#FFCC00";							
				}
				//capture details of the option selected for the extra
				if (document.forms['basket'].elements['productHasOption' + i].value == 1 && document.forms['basket'].elements['productoptions' + i].value !="" && document.forms['basket'].elements['add' + i].value ==1){
					document.forms['basket'].elements['selectedProductOptionid' + i].value = document.forms['basket'].elements['productoptions' + i].value ;
			 		document.forms['basket'].elements['selectedProductOption' + i].value = document.forms['basket'].elements['productoptions' + i].options[document.forms['basket'].elements['productoptions' + i].selectedIndex].text;							
					
				}
				//check to ensure cruise quantity enetered doesnt exceed availability
				if (document.forms['basket'].elements['step'].value == 1 && document.forms['basket'].elements['BasketExtraID' + i].value < 1){
					if (parseInt(document.forms['basket'].elements['quantity' + i].value) > parseInt(document.forms['basket'].elements['quantityAvailable' + i].value) && (dateflag==true) ){
						if(document.forms['basket'].elements['quantity' + i].value <= 8){
							flag= false;
							quantityExceededflag = false;
							document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";
							msg = msg + '\n\nDue to limited availability there are only ' + document.forms['basket'].elements['quantityAvailable' + i].value + ' places \navailable for ' + document.forms['basket'].elements['producttitle' + i].value + ' on ' + document.forms['basket'].elements['date' + i].value +'.\nPlease enter a different quantity ' ; 
						}
					}
				}
				if (parseInt(document.forms['basket'].elements['quantity' + i].value)  == 0 && isDate(document.forms['basket'].elements['date' + i].value)==true){
					flag=false;
					quantityflag= false;
					document.forms['basket'].elements['quantity' + i].style.backgroundColor = "#FFCC00";
				}
				if(document.forms['basket'].elements['BasketItemID' + i].value > 0 ){
					if(document.forms['basket'].elements['remove' + i].checked == true){
						var removeConfirmation = false;
						removeConfirmation=confirm('By removing ' + document.forms['basket'].elements['producttitle' + i].value + ' ('+ document.forms['basket'].elements['date' + i].value +') from your order \nyou will also remove any extras linked to it \n\nClick OK to remove the selected item(s) or Cancel');
						if (removeConfirmation==false){
							flag=false;
							msg = msg + '\n' + document.forms['basket'].elements['producttitle' + i].value + ' ('+ document.forms['basket'].elements['date' + i].value +') was not removed';
						}					
					}				
				}
				quantityTotal = quantityTotal + document.forms['basket'].elements['quantity' + i].value;

				
  	     }
  	     if (quantityTotal == 0){
			flag=false;
			quantityTotalFlag = false;
		 }
		 
  	     if (flag==true){
  	         document.forms['basket'].elements['operation'].value = operation;
				     document.forms['basket'].submit();
  	         
  	     }else{
   	       
		   if (quantityTotalFlag==false){
              msg = msg + '\nPlease select an item and then click update to update your basket';  
           } 
		   if (quantityflag==false){
              msg = msg + '\nPlease enter a value from 1 to 8';  
           } 
  	       if (dateflag==false){
  	          msg = msg + '\nDates are not in the correct format (dd/mm/yyyy)';  	           
  	       }
		   if (quantityExceededflag==false){
              //msg = msg + '\nPlease enter a value from 0 to 99';  
           } 
		    if (optionflag==false){
  	          msg = msg + '\nPlease select an option';  	           
  	       }
  	        alert(msg);
            return false;
         }
	}


  	//to hide and display the extras options on basket step2
	function toggle(id) {
		el = document.getElementById("row-" + id);
		if (el.style.display == 'none') {
		
			version=0
			if (navigator.appVersion.indexOf("MSIE")!=-1){
			temp=navigator.appVersion.split("MSIE")
			version=parseFloat(temp[1])
			}
		
			if (version>=5.5){ //NON IE browser will return 0
			  // IE
			  el.style.display = 'block';
			}else{
			  // Firefox
			  el.style.display = 'table-row';
			}  
		  
		} else {
		  el.style.display = 'none';
		}
	}

	
	function VerifyPhoneNumber(UserPhoneNumber) {
		var Message = 1
		var Integers = "+0123456789 "
		var i = 0
		
		if (UserPhoneNumber.length ==0 ) {
			AlertUser = AlertUser + " - Your daytime contact number\n"
			return false
			}
		if (UserPhoneNumber.length <11 && UserPhoneNumber.length >16) {
			AlertUser = AlertUser + " - Your daytime contact number\n"
			return false
		}
		for (i =0; i <= UserPhoneNumber.length -1; i++) {
			if (Integers.indexOf(UserPhoneNumber.charAt(i)) == -1) {
				AlertUser = AlertUser + " - A phone number containing valid numeric charachters\n"
				return false
			} 
		} 
		return true
	}

	function checkPostCode (toCheck) {
	  var alpha1 = "[abcdefghijklmnoprstuwyz]";                       // Character 1
	  var alpha2 = "[abcdefghklmnopqrstuvwxy]";                       // Character 2
	  var alpha3 = "[abcdefghjkstuw]";                                // Character 3
	  var alpha4 = "[abehmnprvwxy]";                                  // Character 4
	  var alpha5 = "[abdefghjlnpqrstuwxyz]";                          // Character 5
	
	  var pcexp = new Array ();
	
	  pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1,2})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
	  pcexp.push (new RegExp ("^(" + alpha1 + "{1}[0-9]{1}" + alpha3 + "{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
	  pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1}" + alpha4 +"{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
	  pcexp.push (/^(GIR)(\s*)(0AA)$/i);
	  pcexp.push (/^(bfpo)(\s*)([0-9]{1,4})$/i);
	  pcexp.push (/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);
	  
	  var postCode = toCheck;
	  var valid = false;
	
	  for ( var i=0; i<pcexp.length; i++) {
		if (pcexp[i].test(postCode)) {
		  pcexp[i].exec(postCode);
		  postCode = RegExp.$1.toUpperCase() + " " + RegExp.$3.toUpperCase();
		  postCode = postCode.replace (/C\/O\s*/,"c/o ");
		  valid = true;
		  break;
		}
	  }
	  if (valid) {return postCode;} else return false;
	}


	function VerifyEmailAddress(EmailAddress) {
	  var Message = 0;
	  if (window.RegExp) {
		var Email1 = "a";
		var Email2 = new RegExp(Email1);
		if (Email2.test(Email1)) Message = 1;
	  }
	  if (!Message) 
		return (EmailAddress.indexOf(".") > 2) && (EmailAddress.indexOf("@") > 0);
		var leftSection = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var rightSection = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	    return (!leftSection.test(EmailAddress) && rightSection.test(EmailAddress));
	}


  	function submitPersonalDetails() {
		
		var x = new Boolean("True")
		var y = new Boolean("False")
		document.personalDetails.txtTitle.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtForename.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtSurname.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtAdd1.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtTown.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtPostcode.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtCountry.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtEmail.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtEmail2.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtContactNumber.style.backgroundColor = "#FFFFFF";
		document.personalDetails.txtAgree.style.backgroundColor = "#FFFFFF";

		Flag = y
		AlertUser = "\nYou have not provided the following valid information\n\n" 
				
		if (document.personalDetails.txtTitle.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Title\n"
				document.personalDetails.txtTitle.style.backgroundColor = "#FFCC00"
			};
		if (document.personalDetails.txtForename.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Forename\n"
				document.personalDetails.txtForename.style.backgroundColor = "#FFCC00"
			};
		if (document.personalDetails.txtSurname.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Surname\n"
				document.personalDetails.txtSurname.style.backgroundColor = "#FFCC00"
			};
		if (document.personalDetails.txtAdd1.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Address Line 1\n"
				document.personalDetails.txtAdd1.style.backgroundColor = "#FFCC00"				
			};
		if (document.personalDetails.txtTown.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Town/City\n"
				document.personalDetails.txtTown.style.backgroundColor = "#FFCC00"				
			};	 
		if (document.personalDetails.txtCountry.value == "UK"){				
    		if (checkPostCode(document.personalDetails.txtPostcode.value) == false){
    				Flag = x
    				AlertUser = AlertUser + " - A valid postcode\n"
    				document.personalDetails.txtPostcode.style.backgroundColor = "#FFCC00"				
    			};
    };																
		if (document.personalDetails.txtCountry.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Country\n"
				document.personalDetails.txtCountry.style.backgroundColor = "#FFCC00"				
			};																
		if (VerifyEmailAddress(document.personalDetails.txtEmail.value) == "0"){
				Flag = x
				AlertUser = AlertUser + " - A valid Email Address\n"
				document.personalDetails.txtEmail.style.backgroundColor = "#FFCC00"		
			};
		if (VerifyEmailAddress(document.personalDetails.txtEmail2.value) == "0"){
				Flag = x
				AlertUser = AlertUser + " - A valid confirmation Email Address\n"
				document.personalDetails.txtEmail2.style.backgroundColor = "#FFCC00"		
			};
		if (document.personalDetails.txtEmail.value != document.personalDetails.txtEmail2.value){
				Flag = x
				AlertUser = AlertUser + " - Matching Email Addresses\n"
				document.personalDetails.txtEmail.style.backgroundColor = "#FFCC00"	
				document.personalDetails.txtEmail2.style.backgroundColor = "#FFCC00"	
			};
		if (VerifyPhoneNumber(document.personalDetails.txtContactNumber.value) == false){
				Flag = x
				document.personalDetails.txtContactNumber.style.backgroundColor = "#FFCC00"		
			};
		if (document.personalDetails.txtAgree.checked == false){
				Flag = x
				AlertUser = AlertUser + " - You must agree to the terms & conditions\n"
				document.personalDetails.txtAgree.style.backgroundColor = "#FFCC00"		
			};
			
		if (Flag == x){
				AlertUser = AlertUser + "\nPlease correct these to continue"
				alert(AlertUser)				
			}else{
				document.personalDetails.submit()
			};				
		}

  	function submitRequestBooking() {
		
		var x = new Boolean("True")
		var y = new Boolean("False")
		document.requestBooking.txtItem.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtBookingDate.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtBookingDate2.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtQty.style.backgroundColor = "#FFFFFF";

		document.requestBooking.txtTitle.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtForename.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtSurname.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtAdd1.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtTown.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtPostcode.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtCountry.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtEmail.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtEmail2.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtContactNumber.style.backgroundColor = "#FFFFFF";
		document.requestBooking.txtAgree.style.backgroundColor = "#FFFFFF";

		Flag = y
		AlertUser = "\nYou have not provided the following valid information\n\n" 
		
		

		if (document.requestBooking.txtBookingDate.value == "" || isDate(document.requestBooking.txtBookingDate.value)==false){
				Flag = x
				AlertUser = AlertUser + " - A valid date in the format (dd/mm/yyyy)\n"
				document.requestBooking.txtBookingDate.style.backgroundColor = "#FFCC00"
		};
		if (document.requestBooking.txtBookingDate2.value != ""){
			if (document.requestBooking.txtBookingDate2.value == "DD/MM/YYYY"){
			}else{
				if (isDate(document.requestBooking.txtBookingDate2.value)==false){				
					Flag = x
					AlertUser = AlertUser + " - A valid date in the format (dd/mm/yyyy)\n"
					document.requestBooking.txtBookingDate2.style.backgroundColor = "#FFCC00"
				}else{
					if(document.requestBooking.txtBookingDate.value == document.requestBooking.txtBookingDate2.value){
						Flag = x
						AlertUser = AlertUser + " - The alternative Booking Date should be different to the Booking Date \n"	
						document.requestBooking.txtBookingDate2.style.backgroundColor = "#FFCC00"
					}
				}
			}
		}else{
			document.requestBooking.txtBookingDate2.value = "DD/MM/YYYY"
		};		
		if (isValidNumber(document.requestBooking.txtQty.value)==true){	
			if(document.requestBooking.txtQty.value==0 || document.requestBooking.txtQty.value >999){
				Flag = x				
				AlertUser = AlertUser + " - A quantity value between 1 and 999 \n"
				document.requestBooking.txtQty.style.backgroundColor = "#FFCC00"
			}
			//S1789, Bryan
			var product_id = document.requestBooking.product_id.value
			if (product_id == "20" || product_id == "21" || product_id == "95" || product_id == "96"){
			    
			    if (document.requestBooking.txtQty.value % 2 == 1)
				{
			        Flag = x		
			        AlertUser = AlertUser + " - Quantity value for this product must be an even number \n"
				    document.requestBooking.txtQty.style.backgroundColor = "#FFCC00"
				}
			}
			//End Of S1789, Bryan
		}else{
			Flag = x				
			AlertUser = AlertUser + " - A quantity value between 1 and 999 \n"
			document.requestBooking.txtQty.style.backgroundColor = "#FFCC00"
		};
				
		if (document.requestBooking.txtTitle.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Title\n"
				document.requestBooking.txtTitle.style.backgroundColor = "#FFCC00"
		};
		if (document.requestBooking.txtForename.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Forename\n"
				document.requestBooking.txtForename.style.backgroundColor = "#FFCC00"
		};
		if (document.requestBooking.txtSurname.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Surname\n"
				document.requestBooking.txtSurname.style.backgroundColor = "#FFCC00"
		};
		if (document.requestBooking.txtAdd1.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Address Line 1\n"
				document.requestBooking.txtAdd1.style.backgroundColor = "#FFCC00"				
		};
		if (document.requestBooking.txtTown.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Town/City\n"
				document.requestBooking.txtTown.style.backgroundColor = "#FFCC00"				
		};
		if (document.requestBooking.txtCountry.value == "UK"){		
		if (checkPostCode(document.requestBooking.txtPostcode.value) == false){
				Flag = x
				AlertUser = AlertUser + " - A valid postcode\n"
				document.requestBooking.txtPostcode.style.backgroundColor = "#FFCC00"				
		};
		};
		if (document.requestBooking.txtCountry.value == ""){
				Flag = x
				AlertUser = AlertUser + " - Country\n"
				document.requestBooking.txtCountry.style.backgroundColor = "#FFCC00"				
		};																
		if (VerifyEmailAddress(document.requestBooking.txtEmail.value) == "0"){
				Flag = x
				AlertUser = AlertUser + " - A valid Email Address\n"
				document.requestBooking.txtEmail.style.backgroundColor = "#FFCC00"		
		};
		if (VerifyEmailAddress(document.requestBooking.txtEmail2.value) == "0"){
				Flag = x
				AlertUser = AlertUser + " - A valid confirmation Email Address\n"
				document.requestBooking.txtEmail2.style.backgroundColor = "#FFCC00"		
		};
		if (document.requestBooking.txtEmail.value != document.requestBooking.txtEmail2.value){
				Flag = x
				AlertUser = AlertUser + " - Matching Email Addresses\n"
				document.requestBooking.txtEmail.style.backgroundColor = "#FFCC00"	
				document.requestBooking.txtEmail2.style.backgroundColor = "#FFCC00"	
		};
		if (VerifyPhoneNumber(document.requestBooking.txtContactNumber.value) == false){
				Flag = x
				document.requestBooking.txtContactNumber.style.backgroundColor = "#FFCC00"		
		};
		if (document.requestBooking.txtAgree.checked == false){
				Flag = x
				AlertUser = AlertUser + " - You must agree to the terms & conditions\n"
				document.requestBooking.txtAgree.style.backgroundColor = "#FFCC00"		
		};
			
		if (Flag == x){
				AlertUser = AlertUser + "\nPlease correct these to continue"
				alert(AlertUser)				
		}else{
				document.requestBooking.submit()
		};				
	}

