<!--
//verify for netscape/mozilla
var isNS4 = (navigator.appName=="Netscape")?1:0;
var bShownCampWarning = false;


function checkKeypress(intKey) {
	if (!(intKey==8 || intKey==46 || intKey==37 || intKey==39 || intKey==9)) 
		return true;
	return false;
}

function cent(amount) {
     return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

function subtotal(what) {
	//Set the dates for price changes: Feb 1, June1
	today = new Date();
	Feb1 = new Date();	Feb1.setMonth(1);	Feb1.setDate(1);	Feb1.setHours(0);	Feb1.setMinutes(0);	Feb1.setSeconds(0); Feb1.setYear(2012);
	June1 = new Date();	June1.setMonth(5);	June1.setDate(1);	June1.setHours(0);	June1.setMinutes(0);	June1.setSeconds(0); June1.setYear(2012);

	
	//Validate Camping
	qty3DayPasses = Math.round((what.Adult3DayQuantity.value - 0) + (what.Youth3DayQuantity.value - 0));
	qtyCamping = 	Math.round((what.CampingReservedQuantity.value - 0) + (what.CampingGeneralQuantity.value - 0)+(what.CampingFamilyQuantity.value - 0)+(what.CampingHandicapReservedQuantity.value - 0)); //+ (what.CampingGeneralFamilyQuantity.value - 0)
	
	 if (qtyCamping > 0)	{
		if ((qtyCamping*2) > qty3DayPasses) {
			alert("You must order 2 3-day event passes per camp site.");
			bShownCampWarning = true;
		}	
	}
	 
	
	
	what.DateTicketOrdered.value = today;
	//Set the prices based on today's date
	if(today.getTime() < June1.getTime()){
		if(today.getTime() < Feb1.getTime()){
		//booked before Feb1
			what.Adult3DayPrice.value = '165'; 		//3-Day Adult Event Pass 
			what.Youth3DayPrice.value = '165'; 		//3-Day Youth Event Pass 
			what.KickOffPartyPrice.value = '30'; 	//Kick-Off Party 
			what.ReservedBCDEPrice.value = '255'; 	//Reserved Seating (B,C,D,&E) 
			what.ReservedAFPrice.value = '235'; 	//Reserved Seating (A&F) 
			what.VIPPrice.value = '700'; 			//VIP Seating
			what.AdultSingleDayPrice.value = '80'; 	//Single Day Adult Pass
			what.CampingReservedPrice.value = '100'; //Reserved Camping
			what.CampingHandicapReservedPrice.value = '100'; // Handicap Reserved Camping
			what.CampingGeneralPrice.value = '100'; 	//General Camping
			what.CampingGeneralFamilyPrice.value = '100'; 	//General Camping			
			what.CampingFamilyPrice.value = '100'; 	//Family Camping
    	}
		else {
		//booked before June1 but after Jan31
			what.Adult3DayPrice.value = '190'; 		//3-Day Adult Event Pass 
			what.Youth3DayPrice.value = '165'; 		//3-Day Youth Event Pass 
			what.KickOffPartyPrice.value = '30'; 	//Kick-Off Party 
			what.ReservedBCDEPrice.value = '275'; 	//Reserved Seating (B,C,D,&E) 
			what.ReservedAFPrice.value = '255'; 	//Reserved Seating (A&F) 
			what.VIPPrice.value = '750'; 			//VIP Seating
			what.AdultSingleDayPrice.value = '90'; 	//Single Day Adult Pass
			what.CampingReservedPrice.value = '120';	//Reserved Camping
			what.CampingHandicapReservedPrice.value = '120'; // Handicap Reserved Camping
			what.CampingGeneralPrice.value = '120'; 	//General Camping
			what.CampingGeneralFamilyPrice.value = '120'; 	//General Camping	
			what.CampingFamilyPrice.value = '120'; 	//Family Camping
		}
	}
	else{
	//booked after May31
		what.Adult3DayPrice.value = '210'; 		//3-Day Adult Event Pass 
		what.Youth3DayPrice.value = '165'; 		//3-Day Youth Event Pass 
		what.KickOffPartyPrice.value = '40'; 	//Kick-Off Party 
		what.ReservedBCDEPrice.value = '275'; 	//Reserved Seating (B,C,D,&E) 
		what.ReservedAFPrice.value = '255'; 	//Reserved Seating (A&F) 
		what.VIPPrice.value = '750'; 			//VIP Seating
		what.AdultSingleDayPrice.value = '90'; 	//Single Day Adult Pass
		what.CampingReservedPrice.value = '120';	//Reserved Camping
		what.CampingHandicapReservedPrice.value = '120'; // Handicap Reserved Camping
		what.CampingGeneralPrice.value = '120'; 	//General Camping
		what.CampingGeneralFamilyPrice.value = '120'; 	//General Camping	
		what.CampingFamilyPrice.value = '120'; 	//Family Camping
	}
	MunicipalFeePrice = 5;
	TicketmasterFeePrice = 7;
	HandlingFeePrice = 10;
	
	//Calculate the Ticket subtotals
	what.Adult3DaySubtotal.value = cent(Math.round(((what.Adult3DayQuantity.value - 0) * (what.Adult3DayPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 		//3-Day Adult Event Pass 
	what.Youth3DaySubtotal.value = cent(Math.round(((what.Youth3DayQuantity.value - 0) * (what.Youth3DayPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 		//3-Day Youth Event Pass 
	what.KickOffPartySubtotal.value = cent(Math.round(((what.KickOffPartyQuantity.value - 0) * (what.KickOffPartyPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Kick-Off Party 
	what.ReservedBCDESubtotal.value = cent(Math.round(((what.ReservedBCDEQuantity.value - 0) * (what.ReservedBCDEPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Reserved Seating (B,C,D,&E) 
	what.ReservedAFSubtotal.value = cent(Math.round(((what.ReservedAFQuantity.value - 0) * (what.ReservedAFPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Reserved Seating (A&F) 
	what.VIPSubtotal.value = cent(Math.round(((what.VIPQuantity.value - 0) * (what.VIPPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 			//VIP Seating
	what.AdultSingleDaySubtotalFriday.value = cent(Math.round(((what.AdultSingleDayQuantityFriday.value - 0) * (what.AdultSingleDayPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Single Day Adult Pass
	what.AdultSingleDaySubtotalSaturday.value = cent(Math.round(((what.AdultSingleDayQuantitySaturday.value - 0) * (what.AdultSingleDayPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Single Day Adult Pass
	what.AdultSingleDaySubtotalSunday.value = cent(Math.round(((what.AdultSingleDayQuantitySunday.value - 0) * (what.AdultSingleDayPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Single Day Adult Pass
	what.CampingReservedSubtotal.value = cent(Math.round(((what.CampingReservedQuantity.value - 0) * (what.CampingReservedPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2));	//Reserved Camping
	
	what.CampingHandicapReservedSubtotal.value = cent(Math.round(((what.CampingHandicapReservedQuantity.value - 0) * (what.CampingHandicapReservedPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2));	//Handicap Reserved Camping
	
	what.CampingGeneralSubtotal.value = cent(Math.round(((what.CampingGeneralQuantity.value - 0) * (what.CampingGeneralPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//General Camping
	what.CampingFamilySubtotal.value = cent(Math.round(((what.CampingFamilyQuantity.value - 0) * (what.CampingFamilyPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//Family Camping
	//what.CampingGeneralFamilySubtotal.value = cent(Math.round(((what.CampingGeneralFamilyQuantity.value - 0) * (what.CampingGeneralFamilyPrice.value - 0))*Math.pow(10,2))/Math.pow(10,2)); 	//General Camping
	//what.CampingGeneralFamilySubtotal.value=0;
 
	
	//Calculate the Municipal Fee subtotal
	MunicipalFeeQuantity = ((what.Adult3DayQuantity.value-0) + (what.Youth3DayQuantity.value-0) + (what.KickOffPartyQuantity.value-0) + (what.ReservedBCDEQuantity.value-0) + (what.ReservedAFQuantity.value-0) + (what.VIPQuantity.value-0) + (what.AdultSingleDayQuantityFriday.value-0) + (what.AdultSingleDayQuantitySaturday.value-0)+ (what.AdultSingleDayQuantitySunday.value-0)+ (what.CampingReservedQuantity.value-0)+ (what.CampingHandicapReservedQuantity.value-0) + (what.CampingGeneralQuantity.value-0)  + (what.CampingFamilyQuantity.value-0)); //+ (what.CampingGeneralFamilyQuantity.value-0)
	what.MunicipalFeeSubtotal.value = cent(Math.round(((MunicipalFeeQuantity - 0) * (MunicipalFeePrice - 0))*Math.pow(10,2))/Math.pow(10,2));
	
	//Calculate the Ticketmaster Fee subtotal
	TicketmasterFeeQuantity = ((what.Adult3DayQuantity.value-0) + (what.Youth3DayQuantity.value-0) + (what.KickOffPartyQuantity.value-0) + (what.ReservedBCDEQuantity.value-0) + (what.ReservedAFQuantity.value-0) + (what.VIPQuantity.value-0) + (what.AdultSingleDayQuantityFriday.value-0)+ (what.AdultSingleDayQuantitySaturday.value-0)+ (what.AdultSingleDayQuantitySunday.value-0) + (what.CampingReservedQuantity.value-0)+ (what.CampingHandicapReservedQuantity.value-0) + (what.CampingGeneralQuantity.value-0)  + (what.CampingFamilyQuantity.value-0)); // + (what.CampingGeneralFamilyQuantity.value-0)
	what.TicketmasterFeeSubtotal.value = cent(Math.round(((TicketmasterFeeQuantity - 0) * (TicketmasterFeePrice - 0))*Math.pow(10,2))/Math.pow(10,2));
	
	//Calculate the grand total by summing the subtotals
    var grandTotal = 0;
	
	//Add the Handling and Mail Charges Fee
	grandTotal = (HandlingFeePrice + (what.Adult3DaySubtotal.value-0) + (what.Youth3DaySubtotal.value-0) + (what.KickOffPartySubtotal.value-0) + (what.ReservedBCDESubtotal.value-0) + (what.ReservedAFSubtotal.value-0) + (what.VIPSubtotal.value-0) + (what.AdultSingleDaySubtotalFriday.value-0) + (what.AdultSingleDaySubtotalSaturday.value-0)+ (what.AdultSingleDaySubtotalSunday.value-0)  + (what.CampingReservedSubtotal.value-0) + (what.CampingHandicapReservedSubtotal.value-0) + (what.CampingGeneralSubtotal.value-0)  + (what.CampingFamilySubtotal.value-0) + (what.MunicipalFeeSubtotal.value-0) + (what.TicketmasterFeeSubtotal.value-0)); //+ (what.CampingGeneralFamilySubtotal.value-0)
	what.grandTotal.value = cent(Math.round((grandTotal)*Math.pow(10,2))/Math.pow(10,2));
}
//--> 
