			function addPriceDatedExp(fieldCounter){
				var theValue = document.aspnetForm.hiddenPrice.value;
				var theIndexSelected = document.getElementById("availDropDown").selectedIndex;
				var tempPrice = theValue * theIndexSelected + ".00";
				this.document.getElementById("totalPriceDiv").innerHTML = tempPrice;
				this.document.getElementById("eventPlaces").innerHTML = theIndexSelected;
				var NumberOfPlaces = document.aspnetForm.hiddenNumberOfPlaces.value;
				this.document.getElementById("placesRemaining").innerHTML = NumberOfPlaces -  theIndexSelected; 
				this.document.getElementById("placesRequired").value= theIndexSelected; 
				this.document.getElementById("finalCost").value= theValue * theIndexSelected; 

				// collapse all the fields first, then expand the right number
		        for (j = 1; j < 7 ; j++){
					var fieldCounter = "driverRow" + j;
					document.getElementById(fieldCounter).style.display = 'none';
				}
				for (i = 1; i < theIndexSelected +1; i++){
					var fieldCounter = "driverRow" + i;
					document.getElementById(fieldCounter).style.display = 'block';
				} 
			}
			function displayFieldsExperiences(fieldType, fieldcount, extraType){ // shows the extra fields and counts up the amounts for the extras. Closes them all first. 
			for (j = 1; j < 5; j++){
				var fieldCounter = fieldType + j;
				document.getElementById(fieldCounter).style.display = 'none';
			}
			var decPrice = 0; 
			decPrice = document.getElementById('eventPrice').innerHTML; 
			var priceCounter = fieldcount; 
			decPrice = decPrice * fieldcount + ".00" ;
			
			document.getElementById('finalPrice').innerHTML  = decPrice; 
			document.getElementById('hiddenFinalPrice').value = decPrice;  // hidden value
		
			for (i = 1; i < fieldcount + 1; i++){
				var fieldCounter = fieldType + i;
				document.getElementById(fieldCounter).style.display = '';
			} 
	   }
			function addPriceVoucher(fieldCounter){
				var theValue = document.aspnetForm.hiddenPrice.value;
				var theIndexSelected = document.aspnetForm.availDropDown.selectedIndex;
				theIndexSelected += 1;
				this.document.getElementById("totalPriceDiv").innerHTML = theValue * theIndexSelected  + ".00";
				this.document.getElementById("eventPlaces").innerHTML = theIndexSelected;
				var NumberOfPlaces = document.aspnetForm.hiddenNumberOfPlaces.value;
				this.document.getElementById("placesRequired").innerText = theIndexSelected; 
				this.document.getElementById("finalCost").innerText = theValue * theIndexSelected; 
				this.document.aspnetForm.hiddenTotalPrice.value= theValue * theIndexSelected; 
				this.document.aspnetForm.hiddenNumberOfPlaces.value = theIndexSelected; 

				// collapse all the fields first, then expand the right number
		        for (j = 1; j < 7 ; j++){
					var fieldCounter = "driverRow" + j;
					document.getElementById(fieldCounter).style.display = 'none';
				}
				for (i = 1; i < theIndexSelected +1; i++){
					var fieldCounter = "driverRow" + i;
					document.getElementById(fieldCounter).style.display = 'block';
				} 
			}
			
      function displayFields(fieldType, fieldcount, extraType){ // shows the extra fields and counts up the amounts for the extras. Closes them all first. 
                                                                    // a bit interesting to get it to work with both passengers and drivers 
        for (j = 1; j < 6; j++){
            var fieldCounter = fieldType + j;
            document.getElementById(fieldCounter).style.display = 'none';
        }
    
        fieldcount = fieldcount + 1; 
        var addedPrice = 0;  
        var theEventPrice = 0;
        theEventPrice = parseInt(theEventPrice);
    
        for (i = 1; i < fieldcount; i++){
            var fieldCounter = fieldType + i;
            document.getElementById(fieldCounter).style.display = 'block';
            var finalField = fieldType + extraType; 
            var drPrice = document.getElementById(finalField).innerHTML; 
            addedPrice += parseInt(drPrice); 
        } 
        var finalField = fieldType +"final";
        document.getElementById(finalField).innerHTML =  addedPrice.toString(); // collect values to calculate final price    
        theEventPrice = parseFloat(document.getElementById('totalCost').innerHTML);  
        var tempDRf = parseInt(document.getElementById('driverRowfinal').innerHTML); 
        var tempPRf = parseInt(document.getElementById('passengerRowfinal').innerHTML);
        
        theEventPrice = parseInt(theEventPrice) + parseInt(tempPRf) + parseInt(tempDRf); 
        document.getElementById('divPricePaidTotal').innerHTML = theEventPrice +".00"; 
        this.document.aspnetForm.HiddenFieldTotalPrice.value= theEventPrice ; 
   }
   function OpenInfoPage(id)
	{
		var infoPage = window.open("http://www2.trackdays.co.uk/eventinfo.aspx?event="+id,"trackdayseventinfo","width=385,height=400,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
		infoPage.focus();
	}

	function setTDDropdowns()
	{
		if  (document.getElementById('carOrBike').value == "Bike" )
		{
			document.getElementById('driverCount').disabled = true;
			document.getElementById('completeDriverRow').style.display = 'none';
			document.getElementById('passengerCount').disabled = true;
			document.getElementById('completePassengerRow').style.display = 'none';
			
		}
	}

	function showPresentationPack() {
	    var packPage = window.open("/presentationPackDisplay.aspx", "packInfo", "width=585,height=400,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
	    packPage.focus();
	}
