// STANDARD.js

	//*************************
	//Main menu rollover functions from Macromedia (fireworks)
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	

	var paymentSubmitted = false;


	//*************************
	//calculateLineValue(thisline)
	//this function will calculate the line value based upon the line entered in the ticket
	function calculateLineValue(){
		
		//get the values
		qty   		= selectValues("AdultQty","value");
		price 		= document.getElementById("AdultPrice").value;
		lineValue	= qty * price;
	
		//update the html
		document.getElementById("AdultValue").innerHTML = "&pound;" + lineValue.toFixed(2);	
		
		//check for group discount!
		if(qty >= 12 && Number(document.getElementById("DiscountValue").value) > 0){
			//calculate the total discount
			discountQty 		= qty;
			discountPrice 		= Number(document.getElementById("DiscountValue").value);
			discountLineValue	= discountPrice * discountQty;
			
			//show the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "show";
		} else {
			//calculate the total discount
			discountQty 		= 0;
			discountPrice 		= 0.00;
			discountLineValue	= 0.00;
			
			//hide the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "hide";
		}
		
		//calculate the total value
		totalValue = 0.00;
		totalValue = lineValue - discountLineValue;
		
		
		//picnic packages
		if(document.getElementById("4PicnicPrice")){
			qtyPicnic4 		= selectValues("4PicnicQty","value");
			pricePicnic4 	= document.getElementById("4PicnicPrice").value;
			linePicnic4		= qtyPicnic4 * pricePicnic4;

			//update the html
			document.getElementById("Picnic4").innerHTML = "&pound;" + linePicnic4.toFixed(2);	
		}
		else {
			linePicnic4 = 0;
		}

		if(document.getElementById("6PicnicPrice")){
			qtyPicnic6 		= selectValues("6PicnicQty","value");
			pricePicnic6 	= document.getElementById("6PicnicPrice").value;
			linePicnic6		= qtyPicnic6 * pricePicnic6;

			//update the html
			document.getElementById("Picnic6").innerHTML = "&pound;" + linePicnic6.toFixed(2);	
		}
		else {
			linePicnic6 = 0;
		}
		
		//get package values
		if(document.getElementById("PackageAActive").value == "Y"){
			qtyPackageA   		= selectValues("AdultQtyPackageA","value");
			pricePackageA 		= document.getElementById("AdultPricePackageA").value;
			lineValuePackageA	= qtyPackageA * pricePackageA;

			//update the html
			document.getElementById("AdultValuePackageA").innerHTML = "&pound;" + lineValuePackageA.toFixed(2);	
		}
		else {
			lineValuePackageA	= 0;
		}

		if(document.getElementById("PackageBActive").value == "Y"){
			qtyPackageB   		= selectValues("AdultQtyPackageB","value");
			pricePackageB 		= document.getElementById("AdultPricePackageB").value;
			lineValuePackageB	= qtyPackageB * pricePackageB;

			//update the html
			document.getElementById("AdultValuePackageB").innerHTML = "&pound;" + lineValuePackageB.toFixed(2);	
		}
		else {
			lineValuePackageB	= 0;
		}

		if(document.getElementById("PackageCActive").value == "Y"){
			qtyPackageC   		= selectValues("AdultQtyPackageC","value");
			pricePackageC 		= document.getElementById("AdultPricePackageC").value;
			lineValuePackageC	= qtyPackageC * pricePackageC;

			//update the html
			document.getElementById("AdultValuePackageC").innerHTML = "&pound;" + lineValuePackageC.toFixed(2);	
		}
		else {
			lineValuePackageC	= 0;
		}
	
		if(document.getElementById("PackageDActive").value == "Y"){
			qtyPackageD   		= selectValues("AdultQtyPackageD","value");
			pricePackageD 		= document.getElementById("AdultPricePackageD").value;
			lineValuePackageD	= qtyPackageD * pricePackageD;

			//update the html
			document.getElementById("AdultValuePackageD").innerHTML = "&pound;" + lineValuePackageD.toFixed(2);	
		}
		else {
			lineValuePackageD	= 0;
		}

		

		if(document.getElementById("ExpressGyleActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageGyle   	= selectValues("AdultExpressGyleQty","value");
			priceBusPackageGyle		= document.getElementById("AdultExpressGylePrice").value;
			lineValueBusPackageGyle	= qtyBusPackageGyle * priceBusPackageGyle;

			//update the html
			document.getElementById("AdultExpressGyle").innerHTML = "&pound;" + lineValueBusPackageGyle.toFixed(2);	

			
			//calculate express only
			qtyBusOnlyGyle   		= selectValues("ExpressOnlyGyleQty","value");
			priceBusOnlyGyle		= document.getElementById("ExpressOnlyGylePrice").value;
			lineValueBusOnlyGyle	= qtyBusOnlyGyle * priceBusOnlyGyle;

			//update the html
			document.getElementById("ExpressOnlyGyle").innerHTML = "&pound;" + lineValueBusOnlyGyle.toFixed(2);	
		}
		else {
			lineValueBusPackageGyle	= 0;
			lineValueBusOnlyGyle	= 0;
		}
		

		if(document.getElementById("ExpressWaverleyActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageWaverley   	= selectValues("AdultExpressWaverleyQty","value");
			priceBusPackageWaverley		= document.getElementById("AdultExpressWaverleyPrice").value;
			lineValueBusPackageWaverley	= qtyBusPackageWaverley * priceBusPackageWaverley;

			//update the html
			document.getElementById("AdultExpressWaverley").innerHTML = "&pound;" + lineValueBusPackageWaverley.toFixed(2);	

			
			//calculate express only
			qtyBusOnlyWaverley   		= selectValues("ExpressOnlyWaverleyQty","value");
			priceBusOnlyWaverley		= document.getElementById("ExpressOnlyWaverleyPrice").value;
			lineValueBusOnlyWaverley	= qtyBusOnlyWaverley * priceBusOnlyWaverley;

			//update the html
			document.getElementById("ExpressOnlyWaverley").innerHTML = "&pound;" + lineValueBusOnlyWaverley.toFixed(2);	
		}
		else {
			lineValueBusPackageWaverley	= 0;
			lineValueBusOnlyWaverley	= 0;
		}

		//calculate picnic package total
		picnicTotal = linePicnic4 + linePicnic6;

		//calculate express total
		expressTotal = lineValueBusPackageGyle + lineValueBusOnlyGyle + lineValueBusPackageWaverley + lineValueBusOnlyWaverley;
		
		//calculate group package total
		groupTotalValue = lineValuePackageA + lineValuePackageB + lineValuePackageC + lineValuePackageD;
		
		//calculate the final total value
		totalValue = totalValue + groupTotalValue + expressTotal + picnicTotal;
		
		//set the total value
		document.getElementById("TotalValue").innerHTML = "&pound;" + totalValue.toFixed(2);

	}
	//*************************

	//*************************
	//calculateLineValue2009()
	//this function will calculate the line value based upon the line entered in the ticket
	function calculateLineValue2009(){
		
		//get the values
		qty   		= selectValues("AdultQty","value");
		price 		= document.getElementById("AdultPrice").value;
		lineValue	= qty * price;
	
		//update the html
		document.getElementById("AdultValue").innerHTML = "&pound;" + lineValue.toFixed(2);	
		
		//check for group discount!
		if(qty >= 10 && qty < 20 && Number(document.getElementById("DiscountValue").value) > 0){
			//calculate the total discount
			discountQty 		= qty;
			discountPrice 		= Number(document.getElementById("DiscountValue").value);
			discountLineValue	= discountPrice * discountQty;
			
			//show the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "show";
		} else if(qty >= 20 && Number(document.getElementById("DiscountValue20").value) > 0){
			//calculate the total discount
			discountQty 		= qty;
			discountPrice 		= Number(document.getElementById("DiscountValue20").value);
			discountLineValue	= discountPrice * discountQty;
			
			//show the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "show";
		} else {
			//calculate the total discount
			discountQty 		= 0;
			discountPrice 		= 0.00;
			discountLineValue	= 0.00;
			
			//hide the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "hide";
		}
		
		//calculate the total value
		totalValue = 0.00;
		totalValue = lineValue - discountLineValue;
		
		
		//picnic packages
		if(document.getElementById("4PicnicPrice")){
			qtyPicnic4 		= selectValues("4PicnicQty","value");
			pricePicnic4 	= document.getElementById("4PicnicPrice").value;
			linePicnic4		= qtyPicnic4 * pricePicnic4;

			//update the html
			document.getElementById("Picnic4").innerHTML = "&pound;" + linePicnic4.toFixed(2);	
		}
		else {
			linePicnic4 = 0;
		}

		if(document.getElementById("6PicnicPrice")){
			qtyPicnic6 		= selectValues("6PicnicQty","value");
			pricePicnic6 	= document.getElementById("6PicnicPrice").value;
			linePicnic6		= qtyPicnic6 * pricePicnic6;

			//update the html
			document.getElementById("Picnic6").innerHTML = "&pound;" + linePicnic6.toFixed(2);	
		}
		else {
			linePicnic6 = 0;
		}


		//get package values
		if(document.getElementById("PackageAActive").value == "Y"){
			qtyPackageA   		= selectValues("AdultQtyPackageA","value");
			pricePackageA 		= document.getElementById("AdultPricePackageA").value;
			lineValuePackageA	= qtyPackageA * pricePackageA;

			//update the html
			document.getElementById("AdultValuePackageA").innerHTML = "&pound;" + lineValuePackageA.toFixed(2);	
		}
		else {
			lineValuePackageA	= 0;
		}

		if(document.getElementById("PackageBActive").value == "Y"){
			qtyPackageB   		= selectValues("AdultQtyPackageB","value");
			pricePackageB 		= document.getElementById("AdultPricePackageB").value;
			lineValuePackageB	= qtyPackageB * pricePackageB;

			//update the html
			document.getElementById("AdultValuePackageB").innerHTML = "&pound;" + lineValuePackageB.toFixed(2);	
		}
		else {
			lineValuePackageB	= 0;
		}

		if(document.getElementById("PackageCActive").value == "Y"){
			qtyPackageC   		= selectValues("AdultQtyPackageC","value");
			pricePackageC 		= document.getElementById("AdultPricePackageC").value;
			lineValuePackageC	= qtyPackageC * pricePackageC;

			//update the html
			document.getElementById("AdultValuePackageC").innerHTML = "&pound;" + lineValuePackageC.toFixed(2);	
		}
		else {
			lineValuePackageC	= 0;
		}
	
		if(document.getElementById("PackageDActive").value == "Y"){
			qtyPackageD   		= selectValues("AdultQtyPackageD","value");
			pricePackageD 		= document.getElementById("AdultPricePackageD").value;
			lineValuePackageD	= qtyPackageD * pricePackageD;

			//update the html
			document.getElementById("AdultValuePackageD").innerHTML = "&pound;" + lineValuePackageD.toFixed(2);	
		}
		else {
			lineValuePackageD	= 0;
		}

		

		if(document.getElementById("ExpressGyleActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageGyle   	= selectValues("AdultExpressGyleQty","value");
			priceBusPackageGyle		= document.getElementById("AdultExpressGylePrice").value;
			lineValueBusPackageGyle	= qtyBusPackageGyle * priceBusPackageGyle;

			//update the html
			document.getElementById("AdultExpressGyle").innerHTML = "&pound;" + lineValueBusPackageGyle.toFixed(2);	

			
			//calculate express only
			qtyBusOnlyGyle   		= selectValues("ExpressOnlyGyleQty","value");
			priceBusOnlyGyle		= document.getElementById("ExpressOnlyGylePrice").value;
			lineValueBusOnlyGyle	= qtyBusOnlyGyle * priceBusOnlyGyle;

			//update the html
			document.getElementById("ExpressOnlyGyle").innerHTML = "&pound;" + lineValueBusOnlyGyle.toFixed(2);	
		}
		else {
			lineValueBusPackageGyle	= 0;
			lineValueBusOnlyGyle	= 0;
		}
		

		if(document.getElementById("ExpressWaverleyActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageWaverley   	= selectValues("AdultExpressWaverleyQty","value");
			priceBusPackageWaverley		= document.getElementById("AdultExpressWaverleyPrice").value;
			lineValueBusPackageWaverley	= qtyBusPackageWaverley * priceBusPackageWaverley;

			//update the html
			document.getElementById("AdultExpressWaverley").innerHTML = "&pound;" + lineValueBusPackageWaverley.toFixed(2);	

			
			//calculate express only
			qtyBusOnlyWaverley   		= selectValues("ExpressOnlyWaverleyQty","value");
			priceBusOnlyWaverley		= document.getElementById("ExpressOnlyWaverleyPrice").value;
			lineValueBusOnlyWaverley	= qtyBusOnlyWaverley * priceBusOnlyWaverley;

			//update the html
			document.getElementById("ExpressOnlyWaverley").innerHTML = "&pound;" + lineValueBusOnlyWaverley.toFixed(2);	
		}
		else {
			lineValueBusPackageWaverley	= 0;
			lineValueBusOnlyWaverley	= 0;
		}

	
		//calculate picnic package total
		picnicTotal = linePicnic4 + linePicnic6;

		//calculate express total
		expressTotal = lineValueBusPackageGyle + lineValueBusOnlyGyle + lineValueBusPackageWaverley + lineValueBusOnlyWaverley;
		
		//calculate group package total
		groupTotalValue = lineValuePackageA + lineValuePackageB + lineValuePackageC + lineValuePackageD;
		
		//calculate the final total value
		totalValue = totalValue + groupTotalValue + expressTotal + picnicTotal;
		
		//set the total value
		document.getElementById("TotalValue").innerHTML = "&pound;" + totalValue.toFixed(2);
	}
	//*************************	
	
	



	//*************************
	//calculateLineValue2010()
	//this function will calculate the line value based upon the line entered in the ticket
	function calculateLineValue2010(){
		
		//get the values
		qty   		= selectValues("AdultQty","value");
		price 		= document.getElementById("AdultPrice").value;
		lineValue	= qty * price;
	
		//update the html
		document.getElementById("AdultValue").innerHTML = "&pound;" + lineValue.toFixed(2);	
		
		//check for group discount!
		if(qty >= 15 && qty < 25 && Number(document.getElementById("DiscountValue").value) > 0){
			//calculate the total discount
			discountQty 		= qty;
			discountPrice 		= Number(document.getElementById("DiscountValue").value);
			discountLineValue	= discountPrice * discountQty;
			
			//show the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "show";
		} else if(qty >= 25 && Number(document.getElementById("DiscountValue20").value) > 0){
			//calculate the total discount
			discountQty 		= qty;
			discountPrice 		= Number(document.getElementById("DiscountValue20").value);
			discountLineValue	= discountPrice * discountQty;
			
			//show the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "show";
		} else {
			//calculate the total discount
			discountQty 		= 0;
			discountPrice 		= 0.00;
			discountLineValue	= 0.00;
			
			//hide the line!
			document.getElementById("GroupDiscountPrice").innerHTML = "&pound;" + discountPrice.toFixed(2);
			document.getElementById("GroupDiscountQty").innerHTML = discountQty;
			document.getElementById("GroupDiscountLineValue").innerHTML = "-&pound;" + discountLineValue.toFixed(2);
			document.getElementById("GroupDiscount").className = "hide";
		}
		
		//calculate the total value
		totalValue = 0.00;
		totalValue = lineValue - discountLineValue;
		
		
		//picnic packages
		if(document.getElementById("4PicnicPrice")){
			qtyPicnic4 		= selectValues("4PicnicQty","value");
			pricePicnic4 	= document.getElementById("4PicnicPrice").value;
			linePicnic4		= qtyPicnic4 * pricePicnic4;

			//update the html
			document.getElementById("Picnic4").innerHTML = "&pound;" + linePicnic4.toFixed(2);	
		}
		else {
			linePicnic4 = 0;
		}

		if(document.getElementById("6PicnicPrice")){
			qtyPicnic6 		= selectValues("6PicnicQty","value");
			pricePicnic6 	= document.getElementById("6PicnicPrice").value;
			linePicnic6		= qtyPicnic6 * pricePicnic6;

			//update the html
			document.getElementById("Picnic6").innerHTML = "&pound;" + linePicnic6.toFixed(2);	
		}
		else {
			linePicnic6 = 0;
		}


		//get package values
		if(document.getElementById("PackageAActive").value == "Y"){
			qtyPackageA   		= selectValues("AdultQtyPackageA","value");
			pricePackageA 		= document.getElementById("AdultPricePackageA").value;
			lineValuePackageA	= qtyPackageA * pricePackageA;

			//update the html
			document.getElementById("AdultValuePackageA").innerHTML = "&pound;" + lineValuePackageA.toFixed(2);	
		}
		else {
			lineValuePackageA	= 0;
		}

		if(document.getElementById("PackageBActive").value == "Y"){
			qtyPackageB   		= selectValues("AdultQtyPackageB","value");
			pricePackageB 		= document.getElementById("AdultPricePackageB").value;
			lineValuePackageB	= qtyPackageB * pricePackageB;

			//update the html
			document.getElementById("AdultValuePackageB").innerHTML = "&pound;" + lineValuePackageB.toFixed(2);	
		}
		else {
			lineValuePackageB	= 0;
		}

		if(document.getElementById("PackageCActive").value == "Y"){
			qtyPackageC   		= selectValues("AdultQtyPackageC","value");
			pricePackageC 		= document.getElementById("AdultPricePackageC").value;
			lineValuePackageC	= qtyPackageC * pricePackageC;

			//update the html
			document.getElementById("AdultValuePackageC").innerHTML = "&pound;" + lineValuePackageC.toFixed(2);	
		}
		else {
			lineValuePackageC	= 0;
		}
	
		if(document.getElementById("PackageDActive").value == "Y"){
			qtyPackageD   		= selectValues("AdultQtyPackageD","value");
			pricePackageD 		= document.getElementById("AdultPricePackageD").value;
			lineValuePackageD	= qtyPackageD * pricePackageD;

			//update the html
			document.getElementById("AdultValuePackageD").innerHTML = "&pound;" + lineValuePackageD.toFixed(2);	
		}
		else {
			lineValuePackageD	= 0;
		}

		

		if(document.getElementById("ExpressGyleActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageGyle   	= selectValues("AdultExpressGyleQty","value");
			priceBusPackageGyle		= document.getElementById("AdultExpressGylePrice").value;
			lineValueBusPackageGyle	= qtyBusPackageGyle * priceBusPackageGyle;

			//update the html
			document.getElementById("AdultExpressGyle").innerHTML = "&pound;" + lineValueBusPackageGyle.toFixed(2);	

			
			//calculate express only
			qtyBusOnlyGyle   		= selectValues("ExpressOnlyGyleQty","value");
			priceBusOnlyGyle		= document.getElementById("ExpressOnlyGylePrice").value;
			lineValueBusOnlyGyle	= qtyBusOnlyGyle * priceBusOnlyGyle;

			//update the html
			document.getElementById("ExpressOnlyGyle").innerHTML = "&pound;" + lineValueBusOnlyGyle.toFixed(2);	
		}
		else {
			lineValueBusPackageGyle	= 0;
			lineValueBusOnlyGyle	= 0;
		}
		

		if(document.getElementById("ExpressWaverleyActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageWaverley   	= selectValues("AdultExpressWaverleyQty","value");
			priceBusPackageWaverley		= document.getElementById("AdultExpressWaverleyPrice").value;
			lineValueBusPackageWaverley	= qtyBusPackageWaverley * priceBusPackageWaverley;

			//update the html
			document.getElementById("AdultExpressWaverley").innerHTML = "&pound;" + lineValueBusPackageWaverley.toFixed(2);	

			
			//calculate express only
			qtyBusOnlyWaverley   		= selectValues("ExpressOnlyWaverleyQty","value");
			priceBusOnlyWaverley		= document.getElementById("ExpressOnlyWaverleyPrice").value;
			lineValueBusOnlyWaverley	= qtyBusOnlyWaverley * priceBusOnlyWaverley;

			//update the html
			document.getElementById("ExpressOnlyWaverley").innerHTML = "&pound;" + lineValueBusOnlyWaverley.toFixed(2);	
		}
		else {
			lineValueBusPackageWaverley	= 0;
			lineValueBusOnlyWaverley	= 0;
		}

	
		//calculate picnic package total
		picnicTotal = linePicnic4 + linePicnic6;

		//calculate express total
		expressTotal = lineValueBusPackageGyle + lineValueBusOnlyGyle + lineValueBusPackageWaverley + lineValueBusOnlyWaverley;
		
		//calculate group package total
		groupTotalValue = lineValuePackageA + lineValuePackageB + lineValuePackageC + lineValuePackageD;
		
		//calculate the final total value
		totalValue = totalValue + groupTotalValue + expressTotal + picnicTotal;
		
		//set the total value
		document.getElementById("TotalValue").innerHTML = "&pound;" + totalValue.toFixed(2);
	}
	//*************************



	
	

	//*************************
	//calculateExpressLineValue(thisline)
	//this function will calculate the line value based upon the line entered in the ticket
	function calculateExpressLineValue(){
		
		//get the values
		qty   		= 0;
		price 		= document.getElementById("AdultPrice").value;
		lineValue	= 0;
	
		//calculate the total discount
		discountQty 		= 0;
		discountPrice 		= 0.00;
		discountLineValue	= 0.00;
		
		//calculate the total value
		totalValue = 0.00;
		totalValue = lineValue - discountLineValue;
		
		if(document.getElementById("ExpressGyleActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageGyle   	= 0;
			priceBusPackageGyle		= document.getElementById("AdultExpressGylePrice").value;
			lineValueBusPackageGyle	= qtyBusPackageGyle * priceBusPackageGyle;
			
			//calculate express only
			qtyBusOnlyGyle   		= selectValues("ExpressOnlyGyleQty","value");
			priceBusOnlyGyle		= document.getElementById("ExpressOnlyGylePrice").value;
			lineValueBusOnlyGyle	= qtyBusOnlyGyle * priceBusOnlyGyle;

			//update the html
			document.getElementById("ExpressOnlyGyle").innerHTML = "&pound;" + lineValueBusOnlyGyle.toFixed(2);	
		}
		else {
			lineValueBusPackageGyle	= 0;
			lineValueBusOnlyGyle	= 0;
		}
		

		if(document.getElementById("ExpressWaverleyActive").value == "Y"){
			//calculate ticket and express
			qtyBusPackageWaverley   	= 0;
			priceBusPackageWaverley		= document.getElementById("AdultExpressWaverleyPrice").value;
			lineValueBusPackageWaverley	= qtyBusPackageWaverley * priceBusPackageWaverley;
			
			//calculate express only
			qtyBusOnlyWaverley   		= selectValues("ExpressOnlyWaverleyQty","value");
			priceBusOnlyWaverley		= document.getElementById("ExpressOnlyWaverleyPrice").value;
			lineValueBusOnlyWaverley	= qtyBusOnlyWaverley * priceBusOnlyWaverley;

			//update the html
			document.getElementById("ExpressOnlyWaverley").innerHTML = "&pound;" + lineValueBusOnlyWaverley.toFixed(2);	
		}
		else {
			lineValueBusPackageWaverley	= 0;
			lineValueBusOnlyWaverley	= 0;
		}

	
		//calculate express total
		expressTotal = lineValueBusPackageGyle + lineValueBusOnlyGyle + lineValueBusPackageWaverley + lineValueBusOnlyWaverley;
		
		//calculate group package total
		groupTotalValue = 0;
		
		//calculate the final total value
		totalValue = totalValue + groupTotalValue + expressTotal;
		
		//set the total value
		document.getElementById("TotalValue").innerHTML = "&pound;" + totalValue.toFixed(2);

	}


	//*************************
	//checkboxValue(thisid)
	//function to return the checked value of a checkbox
	function checkboxValue(thisid,type){
				
		checkbox = new Object(document.getElementById(thisid));
		
		if(type=="checked"){
			return checkbox.checked;	
		}
		
		if(type=="value" && checkbox.checked){
			return checkbox.value;	
		} else {
			return "";	
		}
				
	}


	//*************************
	//selectValues(thisid,thiselement)
	//function to access parts of a select box value...the label, value or selectedIndex
	function selectValues(thisid,thiselement){
	
		var si 		= document.getElementById(thisid).selectedIndex;
		var value   = document.getElementById(thisid).options[si].value
		var label	= document.getElementById(thisid).options[si].text;
		var output 	= new String("");
		
		switch(thiselement){
		
			case "selectedIndex":
				output = si;
				break;
			case "value":
				output = value;
				break;
			case "label":
				output = label;
				break;
			default:
				output = value;
		}
		
		//return the output
		return output;
	}


	//*************************
	//validateAnnualMembership()
	//function to validate step 3 of the buy tickets online form!
	function validateAnnualMembership(){
		
		//initialise the error variables
		errorList 		= "";
		errorCount 		= 0;
		errorMessage 	= "";
		
		//get the required values	
		title 			= document.getElementById("Title").value;
		forename 		= document.getElementById("Forename").value;
		surname 		= document.getElementById("Surname").value;
		address1 		= document.getElementById("Address1").value;
		postcode 		= document.getElementById("Postcode").value;
		email 			= document.getElementById("Email").value;
		cardType 		= selectValues("CardType","value");
		cardName 		= document.getElementById("CardName").value;
		cardNumber 		= document.getElementById("CardNumber").value;
		cardExpiryMonth = selectValues("CardExpiryMonth","value");
		cardExpiryYear 	= selectValues("CardExpiryYear","value");
		cardCVC			= document.getElementById("CardCVC").value;
		confirmed		= checkboxValue("Confirmed","checked")	
		
		//title
		if(isBlank(title)){
			errorList 	+= "\n- You must enter your title.     ";
			errorCount 	+= 1;
		}
		//forename
		if(isBlank(forename)){
			errorList 	+= "\n- You must enter your forename.     ";
			errorCount 	+= 1;
		}
		//surname
		if(isBlank(surname)){
			errorList 	+= "\n- You must enter your surname.     ";
			errorCount 	+= 1;
		}
		//address1
		if(isBlank(address1)){
			errorList 	+= "\n- You must enter the first line of your address.     ";
			errorCount 	+= 1;
		}
		//postcode
		if(isBlank(postcode)){
			errorList 	+= "\n- You must enter your postcode.     ";
			errorCount 	+= 1;
		}
		//email
		if(!isEmail(email)){
			errorList 	+= "\n- You must enter a valid email address.     ";
			errorCount 	+= 1;
		}
		//cardType
		if(isBlank(cardType)){
			errorList 	+= "\n- You must select a card type.     ";
			errorCount 	+= 1;
		}
		//cardName
		if(isBlank(cardName)){
			errorList 	+= "\n- You must enter the name of the cardholder.     ";
			errorCount 	+= 1;
		}
		//cardNumber
		if(cardNumber.length < 16 || !isNumeric(cardNumber)){
			errorList 	+= "\n- Card Number must be at least 16 characters long and contain numbers only.     ";
			errorCount 	+= 1;
		}
		//cardExpiryMonth!
		if(isBlank(cardExpiryMonth)){
			errorList 	+= "\n- You must select the month your card expires.     ";
			errorCount 	+= 1;
		} 
		//cardExpiryYear!
		if(isBlank(cardExpiryYear)){
			errorList 	+= "\n- You must select the year your card expires.     ";
			errorCount 	+= 1;
		}
		//has the card expired?
		if(!isBlank(cardExpiryMonth) && !isBlank(cardExpiryYear)){

			//create the dates
			cardExpiry = Number(String(cardExpiryYear) + String(cardExpiryMonth));
			currentYearMonth = Number(String(document.getElementById("CurrentYear").value) + String(document.getElementById("CurrentMonth").value));
			
			//check the dates against one another
			if(cardExpiry < currentYearMonth){
				errorList 	+= "\n- The expiry date you have entered has passed. Please check if your card has expired.     ";
				errorCount 	+= 1;
			}
		}
		//cardCVC
		if(cardCVC.length < 3 || !isNumeric(cardCVC)){
			errorList 	+= "\n- You must enter your CVC Number.     ";
			errorCount 	+= 1;
		}
		if(!confirmed){
			errorList 	+= "\n- You must agree to the terms and conditions by checking the box above the continue button.     ";
			errorCount 	+= 1;
		}
		
		//check for errors!
		if(errorCount > 0){
			
			if(errorCount == 1){
				errorMessage = "The following error occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
			} else {
				errorMessage = "The following errors occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
			}
			alert(errorMessage);
			return false;
		} else {
			return true;
		}
		
	}

	
	//*************************
	//validateBuyTicketsOnline()
	//function to validate step 3 of the buy tickets online form!
	function validateBuyTicketsOnline(){
		
		
		if(paymentSubmitted == false){
		
			//initialise the error variables
			errorList 		= "";
			errorCount 		= 0;
			errorMessage 	= "";
					
			//get the required values	
			title 			= document.getElementById("Title").value;
			forename 		= document.getElementById("Forename").value;
			surname 		= document.getElementById("Surname").value;
			address1 		= document.getElementById("Address1").value;
			postcode 		= document.getElementById("Postcode").value;
			email 			= document.getElementById("Email").value;
			cardType 		= selectValues("CardType","value");
			cardName 		= document.getElementById("CardName").value;
			cardNumber 		= document.getElementById("CardNumber").value;
			cardExpiryMonth = selectValues("CardExpiryMonth","value");
			cardExpiryYear 	= selectValues("CardExpiryYear","value");
			cardCVC			= document.getElementById("CardCVC").value;
			confirmed		= checkboxValue("Confirmed","checked")	
			
			//title
			if(isBlank(title)){
				errorList 	+= "\n- You must enter your title.     ";
				errorCount 	+= 1;
			}
			//forename
			if(isBlank(forename)){
				errorList 	+= "\n- You must enter your forename.     ";
				errorCount 	+= 1;
			}
			//surname
			if(isBlank(surname)){
				errorList 	+= "\n- You must enter your surname.     ";
				errorCount 	+= 1;
			}
			//address1
			if(isBlank(address1)){
				errorList 	+= "\n- You must enter the first line of your address.     ";
				errorCount 	+= 1;
			}
			//postcode
			if(isBlank(postcode)){
				errorList 	+= "\n- You must enter your postcode.     ";
				errorCount 	+= 1;
			}
			//email
			if(!isEmail(email)){
				errorList 	+= "\n- You must enter a valid email address.     ";
				errorCount 	+= 1;
			}
			//cardType
			if(isBlank(cardType)){
				errorList 	+= "\n- You must select a card type.     ";
				errorCount 	+= 1;
			}
			//cardName
			if(isBlank(cardName)){
				errorList 	+= "\n- You must enter the name of the cardholder.     ";
				errorCount 	+= 1;
			}
			//cardNumber
			if(cardNumber.length < 16 || !isNumeric(cardNumber)){
				errorList 	+= "\n- Card Number must be at least 16 characters long and contain numbers only.     ";
				errorCount 	+= 1;
			}
			//cardExpiryMonth!
			if(isBlank(cardExpiryMonth)){
				errorList 	+= "\n- You must select the month your card expires.     ";
				errorCount 	+= 1;
			} 
			//cardExpiryYear!
			if(isBlank(cardExpiryYear)){
				errorList 	+= "\n- You must select the year your card expires.     ";
				errorCount 	+= 1;
			}
			//has the card expired?
			if(!isBlank(cardExpiryMonth) && !isBlank(cardExpiryYear)){
	
				//create the dates
				cardExpiry = Number(String(cardExpiryYear) + String(cardExpiryMonth));
				currentYearMonth = Number(String(document.getElementById("CurrentYear").value) + String(document.getElementById("CurrentMonth").value));
				
				//check the dates against one another
				if(cardExpiry < currentYearMonth){
					errorList 	+= "\n- The expiry date you have entered has passed. Please check if your card has expired.     ";
					errorCount 	+= 1;
				}
			}
			//cardCVC
			if(cardCVC.length < 3 || !isNumeric(cardCVC)){
				errorList 	+= "\n- You must enter your CVC Number.     ";
				errorCount 	+= 1;
			}
			if(!confirmed){
				errorList 	+= "\n- You must agree to the terms and conditions by checking the box above the continue button.     ";
				errorCount 	+= 1;
			}
			
			//check for errors!
			if(errorCount > 0){
				
				if(errorCount == 1){
					errorMessage = "The following error occurred whilst processing your details.     ";
					errorMessage += "\n" + errorList + "\n";
					errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
				} else {
					errorMessage = "The following errors occurred whilst processing your details.     ";
					errorMessage += "\n" + errorList + "\n";
					errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
				}
				alert(errorMessage);
				return false;
			} else {
				return true;
				paymentSubmitted = true;
			}
		} else {
			return false;	
		}		
	}

	
	//*************************
	//validateFreeTicketsOnline()
	//function to validate step 3 of the free tickets online form!
	function validateFreeTicketsOnline(){
		
		//initialise the error variables
		errorList 		= "";
		errorCount 		= 0;
		errorMessage 	= "";
		
		//get the required values	
		title 			= document.getElementById("Title").value;
		forename 		= document.getElementById("Forename").value;
		surname 		= document.getElementById("Surname").value;
		address1 		= document.getElementById("Address1").value;
		postcode 		= document.getElementById("Postcode").value;
		email 			= document.getElementById("Email").value;
		confirmed		= checkboxValue("Confirmed","checked")	
		
		//title
		if(isBlank(title)){
			errorList 	+= "\n- You must enter your title.     ";
			errorCount 	+= 1;
		}
		//forename
		if(isBlank(forename)){
			errorList 	+= "\n- You must enter your forename.     ";
			errorCount 	+= 1;
		}
		//surname
		if(isBlank(surname)){
			errorList 	+= "\n- You must enter your surname.     ";
			errorCount 	+= 1;
		}
		//address1
		if(isBlank(address1)){
			errorList 	+= "\n- You must enter the first line of your address.     ";
			errorCount 	+= 1;
		}
		//postcode
		if(isBlank(postcode)){
			errorList 	+= "\n- You must enter your postcode.     ";
			errorCount 	+= 1;
		}
		//email
		if(!isEmail(email)){
			errorList 	+= "\n- You must enter a valid email address.     ";
			errorCount 	+= 1;
		}
		
		//check for errors!
		if(errorCount > 0){
			
			if(errorCount == 1){
				errorMessage = "The following error occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
			} else {
				errorMessage = "The following errors occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
			}
			alert(errorMessage);
			return false;
		} else {
			return true;
		}
		
	}


	//*************************
	//checkboxValue(thisid)
	//function to return the checked value of a checkbox
	function checkboxValue(thisid,type){
				
		checkbox = new Object(document.getElementById(thisid));
		
		if(type=="checked"){
			return checkbox.checked;	
		}
		
		if(type=="value" && checkbox.checked){
			return checkbox.value;	
		} else {
			return "";	
		}
				
	}


	//*************************
	//validationCuddyClub();
	//function to validate the details from the cuddy club application form
	function validationCuddyClub(){
		
		//initialise the error variables
		errorList 		= "";
		errorCount 		= 0;
		errorMessage 	= "";
		
		//get the required values	
		title 			= document.getElementById("Title").value;
		forename 		= document.getElementById("Forename").value;
		surname 		= document.getElementById("Surname").value;
		address1 		= document.getElementById("Address1").value;
		postcode 		= document.getElementById("Postcode").value;
		dateOfBirth		= document.getElementById("DateOfBirth").value;
		email 			= document.getElementById("Email").value;
		cardType 		= selectValues("CardType","value");
		cardName 		= document.getElementById("CardName").value;
		cardNumber 		= document.getElementById("CardNumber").value;
		cardExpiryMonth = selectValues("CardExpiryMonth","value");
		cardExpiryYear 	= selectValues("CardExpiryYear","value");
		cardCVC			= document.getElementById("CardCVC").value;
		confirmed		= checkboxValue("Confirmed","checked")	
		
		//title
		if(isBlank(title)){
			errorList 	+= "\n- You must enter your title.     ";
			errorCount 	+= 1;
		}
		//forename
		if(isBlank(forename)){
			errorList 	+= "\n- You must enter your forename.     ";
			errorCount 	+= 1;
		}
		//surname
		if(isBlank(surname)){
			errorList 	+= "\n- You must enter your surname.     ";
			errorCount 	+= 1;
		}
		//address1
		if(isBlank(address1)){
			errorList 	+= "\n- You must enter the first line of your address.     ";
			errorCount 	+= 1;
		}
		//postcode
		if(isBlank(postcode)){
			errorList 	+= "\n- You must enter your postcode.     ";
			errorCount 	+= 1;
		}
		//dateOfBirth
		if(isBlank(dateOfBirth)){
			errorList 	+= "\n- You must enter the member's date of birth.     ";
			errorCount 	+= 1;
		}
		//email
		if(!isEmail(email)){
			errorList 	+= "\n- You must enter a valid email address.     ";
			errorCount 	+= 1;
		}
		//cardType
		if(isBlank(cardType)){
			errorList 	+= "\n- You must select a card type.     ";
			errorCount 	+= 1;
		}
		//cardName
		if(isBlank(cardName)){
			errorList 	+= "\n- You must enter the name of the cardholder.     ";
			errorCount 	+= 1;
		}
		//cardNumber
		if(cardNumber.length < 16 || !isNumeric(cardNumber)){
			errorList 	+= "\n- Card Number must be at least 16 characters long and contain numbers only.     ";
			errorCount 	+= 1;
		}
		//cardExpiryMonth!
		if(isBlank(cardExpiryMonth)){
			errorList 	+= "\n- You must select the month your card expires.     ";
			errorCount 	+= 1;
		} 
		//cardExpiryYear!
		if(isBlank(cardExpiryYear)){
			errorList 	+= "\n- You must select the year your card expires.     ";
			errorCount 	+= 1;
		}
		//has the card expired?
		if(!isBlank(cardExpiryMonth) && !isBlank(cardExpiryYear)){

			//create the dates
			cardExpiry = Number(String(cardExpiryYear) + String(cardExpiryMonth));
			currentYearMonth = Number(String(document.getElementById("CurrentYear").value) + String(document.getElementById("CurrentMonth").value));
			
			//check the dates against one another
			if(cardExpiry < currentYearMonth){
				errorList 	+= "\n- The expiry date you have entered has passed. Please check if your card has expired.     ";
				errorCount 	+= 1;
			}
		}
		//cardCVC
		if(cardCVC.length < 3 || !isNumeric(cardCVC)){
			errorList 	+= "\n- You must enter your CVC Number.     ";
			errorCount 	+= 1;
		}
		if(!confirmed){
			errorList 	+= "\n- You must agree to the terms and conditions by checking the box above the continue button.     ";
			errorCount 	+= 1;
		}
		
		//check for errors!
		if(errorCount > 0){
			
			if(errorCount == 1){
				errorMessage = "The following error occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
			} else {
				errorMessage = "The following errors occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
			}
			alert(errorMessage);
			return false;
		} else {
			return true;
		}
		
	}


	//*************************
	//validationJuniorMembers();
	//function to validate the details from the junior members club application form
	function validationJuniorMembers(){
		
		//initialise the error variables
		errorList 		= "";
		errorCount 		= 0;
		errorMessage 	= "";
		
		//get the required values	
		title 			= document.getElementById("Title").value;
		forename 		= document.getElementById("Forename").value;
		surname 		= document.getElementById("Surname").value;
		address1 		= document.getElementById("Address1").value;
		postcode 		= document.getElementById("Postcode").value;
		dateOfBirth		= document.getElementById("DateOfBirth").value;
		email 			= document.getElementById("Email").value;
		
		//title
		if(isBlank(title)){
			errorList 	+= "\n- You must enter your title.     ";
			errorCount 	+= 1;
		}
		//forename
		if(isBlank(forename)){
			errorList 	+= "\n- You must enter your forename.     ";
			errorCount 	+= 1;
		}
		//surname
		if(isBlank(surname)){
			errorList 	+= "\n- You must enter your surname.     ";
			errorCount 	+= 1;
		}
		//address1
		if(isBlank(address1)){
			errorList 	+= "\n- You must enter the first line of your address.     ";
			errorCount 	+= 1;
		}
		//postcode
		if(isBlank(postcode)){
			errorList 	+= "\n- You must enter your postcode.     ";
			errorCount 	+= 1;
		}
		//dateOfBirth
		if(isBlank(dateOfBirth)){
			errorList 	+= "\n- You must enter the member's date of birth.     ";
			errorCount 	+= 1;
		}
		//email
		if(!isEmail(email)){
			errorList 	+= "\n- You must enter a valid email address.     ";
			errorCount 	+= 1;
		}
		
		//check for errors!
		if(errorCount > 0){
			
			if(errorCount == 1){
				errorMessage = "The following error occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
			} else {
				errorMessage = "The following errors occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
			}
			alert(errorMessage);
			return false;
		} else {
			return true;
		}
		
	}


	//*************************
	//validateMailingList();
	//function to validate the mailing list details
	function validateMailingList(){
		
		//initialise the error variables
		errorList 		= "";
		errorCount 		= 0;
		errorMessage 	= "";
		
		//get the required values	
		title 			= document.getElementById("Title").value;
		forename 		= document.getElementById("Forename").value;
		surname 		= document.getElementById("Surname").value;
		address1 		= document.getElementById("Address1").value;
		postcode 		= document.getElementById("Postcode").value;
		email 			= document.getElementById("Email").value;
		
		//title
		if(isBlank(title)){
			errorList 	+= "\n- You must enter your title.     ";
			errorCount 	+= 1;
		}
		//forename
		if(isBlank(forename)){
			errorList 	+= "\n- You must enter your forename.     ";
			errorCount 	+= 1;
		}
		//surname
		if(isBlank(surname)){
			errorList 	+= "\n- You must enter your surname.     ";
			errorCount 	+= 1;
		}
		//address1
		if(isBlank(address1)){
			errorList 	+= "\n- You must enter the first line of your address.     ";
			errorCount 	+= 1;
		}
		//postcode
		if(isBlank(postcode)){
			errorList 	+= "\n- You must enter your postcode.     ";
			errorCount 	+= 1;
		}
		//email
		if(!isEmail(email)){
			errorList 	+= "\n- You must enter a valid email address.     ";
			errorCount 	+= 1;
		}
		
		//check for errors!
		if(errorCount > 0){
			
			if(errorCount == 1){
				errorMessage = "The following error occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
			} else {
				errorMessage = "The following errors occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
			}
			alert(errorMessage);
			return false;
		} else {
			return true;
		}
		
	}


	//*************************
	//validateMailingListRemove();
	//function to validate the removal email address
	function validateMailingListRemove(){
				
		//initialise the error variables
		errorList 		= "";
		errorCount 		= 0;
		errorMessage 	= "";
		
		//get the required values	
		email = document.getElementById("Email").value;
		
		//email
		if(!isEmail(email)){
			errorList 	+= "\n- You must enter a valid email address.     ";
			errorCount 	+= 1;
		}
		
		//check for errors!
		if(errorCount > 0){
			
			if(errorCount == 1){
				errorMessage = "The following error occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix this error before clicking 'Continue'.     ";
			} else {
				errorMessage = "The following errors occurred whilst processing your details.     ";
				errorMessage += "\n" + errorList + "\n";
				errorMessage += "\nPlease fix these errors before clicking 'Continue'.     ";	
			}
			alert(errorMessage);
			return false;
		} else {
			return true;
		}
		
	}


	//*************************
	//validateTicketSelection();
	//function to check the number of tickets selected...
	function validateTicketSelection(){

		//initialise the error vars
		errorList 	  = "";
		errorCount 	  = 0;
		errorMessage  = "";

		//assign initial 
		qtyPackageA = 0;
		qtyPackageB = 0;
		qtyPackageC = 0;
		qtyPackageD = 0;

		qtyAdultGyle	 	= 0;
		qtyExpressGyle 		= 0;
		qtyAdultWaverley 	= 0;
		qtyExpressWaverley 	= 0;

		qtyPicnic4	= 0;
		qtyPicnic6	= 0;


		//get the values
		adultQty = selectValues("AdultQty","value");
		//childQty = selectValues("ChildQty","value");
		
		//get picnic values
		if(document.getElementById("4PicnicQty")){
			qtyPicnic4 = selectValues("4PicnicQty","value");
		}
		if(document.getElementById("6PicnicQty")){
			qtyPicnic6 = selectValues("6PicnicQty","value");
		}


		//get package values
		if(document.getElementById("PackageAActive").value == "Y"){
			qtyPackageA = selectValues("AdultQtyPackageA","value");
		}
		if(document.getElementById("PackageBActive").value == "Y"){
			qtyPackageB = selectValues("AdultQtyPackageB","value");
		}
		if(document.getElementById("PackageCActive").value == "Y"){
			qtyPackageC = selectValues("AdultQtyPackageC","value");
		}
		if(document.getElementById("PackageDActive").value == "Y"){
			qtyPackageD = selectValues("AdultQtyPackageD","value");
		}
		
		//get express values
		busGyle 	= document.getElementById("ExpressGyleActive").value
		busWaverley = document.getElementById("ExpressWaverleyActive").value

		if(busGyle == 'Y'){
			qtyAdultGyle	 	= selectValues("AdultExpressGyleQty","value");
			qtyExpressGyle 		= selectValues("ExpressOnlyGyleQty","value");
		}
		if(busWaverley == 'Y'){
			qtyAdultWaverley 	= selectValues("AdultExpressWaverleyQty","value");
			qtyExpressWaverley 	= selectValues("ExpressOnlyWaverleyQty","value");
		}
		

		
		//get tickets options available
		if(busGyle == 'Y' && busWaverley == 'Y'){
			busPackages = 'Both';		
		}
		else if(busWaverley == 'Y'){
			busPackages = 'Waverley';
		}
		else {
			busPackages = 'N';
		}
		


				
		switch(busPackages){

			//both express tickets available 
			case 'Both':
				if(qtyAdultGyle == 0 && qtyExpressGyle == 0 && qtyAdultWaverley == 0 && qtyExpressWaverley == 0 && adultQty == 0 && qtyPackageA == 0 && qtyPackageB == 0 && qtyPackageC == 0 && qtyPackageD == 0){
					//is there at least 1 adult ticket or 1 bus ticket?
					errorList 	+= "Sorry, you must select at least 1 adult ticket or Racecourse Express to continue."; 
					errorCount 	+= 1;
					errorMessage = errorList;
					alert(errorMessage);
					return false;
				}
				else {
					return true;	
				}			
			
			//waverley express tickets only
			case 'Waverley':
				if(qtyAdultWaverley == 0 && qtyExpressWaverley == 0 && adultQty == 0 && qtyPackageA == 0 && qtyPackageB == 0 && qtyPackageC == 0 && qtyPackageD == 0){
					//is there at least 1 adult ticket or 1 bus ticket?
					errorList 	+= "Sorry, you must select at least 1 adult ticket or Racecourse Express to continue."; 
					errorCount 	+= 1;
					errorMessage = errorList;
					alert(errorMessage);
					return false;
				}
				else {
					return true;	
				}			
			
			//no express tickets available
			default:
				if(adultQty == 0 && qtyPackageA == 0 && qtyPackageB == 0 && qtyPackageC == 0 && qtyPackageD == 0 && qtyPicnic4 == 0 && qtyPicnic6 == 0){
					//is there at least 1 adult ticket?
					errorList 	+= "Sorry, you must select at least 1 adult ticket to continue."; 
					errorCount 	+= 1;
					errorMessage = errorList;
					alert(errorMessage);
					return false;
				}
				else {
					return true;	
				}
		}

	}	


/* ------------------------- JS VALIDATION TOOLS ------------------------- */	

	//*************************
	//isBlank
	//function to check if there is a value present.
	function isBlank(val){
		if(val==null){return true;}
		if(val.length==0) {return true;}
		return false;     
	}


	//*************************
	//isEmail
	//function to check the validity of an email
	function isEmail(email) {
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
			return true
		}
		else {
			return false;	
		}
	}
	

	//*************************
	//isInteger
	//function to check if a value is numeric
	function isInteger(txt){
	
		var validChars = "0123456789";
		var isNumber=true;
		var char;
	
		for(i=0;i<txt.length && isNumber == true; i++){
			char = txt.charAt(i);
			if(validChars.indexOf(char) == -1){
				isNumber = false;
			}
		}
		
		//return the value;
		return isNumber;
	}
	

	//*************************
	//isNull
	//function to check if a value isNull!
	function isNull(val){return(val==null);}


	//*************************
	//isNumeric
	//function to check if a value is numeric
	function isNumeric(txt){
	
		var validChars = "0123456789.";
		var isNumber=true;
		var char;
	
		for(i=0;i<txt.length && isNumber == true; i++){
			char = txt.charAt(i);
			if(validChars.indexOf(char) == -1){
				isNumber = false;
			}
		}
		
		//return the value;
		return isNumber;
	}
