 <!--  Activate Cloaking Device
function getBrowserNameVersion()   {   
	document.forms[0].elements[0].value = navigator.appName + " " + navigator.appVersion;     
}
function setEmail()     {
	document.forms[0].elements[434].value = document.forms[0].useremail.value 
// 	document.forms[0].$Cc$.value = document.forms[0].useremail.value;
	return;
}
      // initialize counters and global variables
	var fulldaysw = 0
	var VoidSw = 0
      var EventOptSubTotal = 0
      var RideOptSubTotal = 0
      var ActivityOptSubTotal = 0
      var InflatablesOptSubTotal = 0
	var WeddingOptSubTotal = 0
	var FoodOptSubTotal = 0
	var BevOptSubTotal = 0
	var GrandTotal = 0
	var GrandTotal_adj = 0
	var addl_total = 0
	var credit_total = 0
	var adjustment_adds = 0
	var adjustment_subs = 0
	var deposit_amt = 0
	var EventBalDue = 0
	var adj_adds_sw = 0
	var adj_subs_sw = 0
	var qtyflag = 1
	var qtyflag2 = 1
	var TotalPeople = 0
	var TotalAdults = 0
	var Total5to10 = 0
	var TotalUnder5 = 0
	var newfield = 0
	var TotalPeopleSw = "ok"
	var Total5to10Sw = "ok"
	var TotalUnder5Sw = "ok"
	var alertHeadCtsw = 0
	var BuffetHours = 0
	var oldexHours = 0;   // value of Buffet hours from previous entry
	var entreCount = 0;
	var sideCount = 0;
	var AdultEntrePrice = 0
	var KidEntrePrice = 0
	var AdultSnackPrice = 0
	var KidSnackPrice = 0
	var AdultOptPrice = 0
	var KidOptPrice = 0
	var AdultServicePrice = 0
	var KidServicePrice = 0
	var AdultFoodPrice = 0
	var KidFoodPrice = 0
	var AdultBevCnt = 0
	var MinorBevCnt = 0
	var AdultSoftDrinkAmt = 0
	var MinorSoftDrinkAmt = 0
	var Under5SoftDrinkAmt = 0
	var AdultSpiritAmt = 0
	var LiquorLicAmt = 0
	var AdultBevAmt = 0
	var MinorBevAmt = 0
	var TotalFood = 0
	var TotalBev = 0
	var FoodBevSub = 0
	var SalesTax = 0
	var PrepFeeAmt = 0
	var FoodBevTotalAmt = 0
	var BevHoursQty = 0

// ************************************************************************
	// Position of sub total amounts used in AddITup function.
	// Keep these values current!!!!!!!!!!!!
	var FirstExtAmtPos = 9
	var OptForEventSTPos = 98
	var OptRidesSTpos = 125
	var OptActSTPos = 221
	var OptInflatablesSTPos = 271
	var OptWeddingSTPos = 310
	var StartOfEntrePos = 312
	var EndOfEntrePos = 331
	var StartOfOptCondPos = 335
	var EndOfOptCondPos = 345
	var StartOfSidePos = 346
	var EndOfSidePos = 363
	var StartOfDesertPos = 367
	var EndOfDesertPos = 382
	var StartOfSnackPos = 388
	var EndOfSnackPos = 397
	var StartOfOptItemPos = 404
	var EndOfOptItemPos = 408
	var AdultTotalEntrePos = 423
	var StartOfBevPos = 435
	var EndOfBevPos = 447
	var AdultSoftDrinkTotalPos = 451
	var GrandTotalPos = 493
	var GrandTotal_adjPos = 496
	var BalDuePos = 498
	var VenaCommStartPos = 513
	var VenaDollStartPos = 514
	var AdultExcessEntre = 2.00    // surcharge for addl entres
	var AdultExcessSides = 1.00    // surcharge for addl sides & deserts
	var BuffetExcessTime = 1.50    // surcharge for addl one hour service
	var Entre1to50 = 13.50           // Base prices for 2 entre and sides
	var Entre51to100 = 12.50
	var Entre101to150 = 11.50
	var Entre151to250 = 10.50
	var Entre251to500 = 9.75
	var Entre501to999 = 9.50
	var Entre1000up = 8.50
	var Entre3rd = 2.00            // Surcharge for 3rd entre
	// Beverage prices for 4 and 5 hours follow. 3 hour prices are contained as the value of the checkbox.
	Apepsi = new Array (3.00, 3.50, 3.75)
	Alemonade = new Array (3.00, 3.50, 3.75)
	Aicedtea = new Array (3.00, 3.50, 3.75)
	Awelches = new Array (3.00, 3.50, 3.75)
	Abottledwater = new Array (3.00, 3.50, 3.75)
	Acoffee = new Array (3.00, 3.50, 3.75)
	Ahotcider = new Array (3.00, 3.50, 3.75)
	Ahotchocolate = new Array (3.00, 3.50, 3.75)
	Astdbeer = new Array (6.75, 7.75, 8.75)
	Apremiumbeer = new Array (10.75, 11.75, 12.95)
	Awine = new Array (6.00, 7.00, 8.00)
	Amixeddrinks = new Array (14.95, 15.95, 16.95)
	Abrassrail = new Array (10.95, 11.95, 12.95)
	var LiquorLicFee = 100.00
// ************************************************************************
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device
// pad fields not entered with spaces (for email formatting purposes).
function padNum()   {   
	// Leave alone if field has something in it.    
	for (var i = FirstExtAmtPos; i < BalDuePos; i++){
		if (document.forms[0].elements[i].value == "") {
			document.forms[0].elements[i].value = "          ";
		}
	}
	// pad Vena's comment fields (12) 55 char fields and (12) 15 char fields
	var cc = VenaCommStartPos;
	var dd = VenaDollStartPos
	for (i = 0; i < 12; i++) {
		if (document.forms[0].elements[cc].value == "") {
			document.forms[0].elements[cc].value = "                                                       ";
		}
		if (document.forms[0].elements[dd].value == "") {
			document.forms[0].elements[cc].value = "               ";
		}
	cc = cc + 2;
	dd = dd + 2;
	}	
	// Put in a Y or N into checkbox field values
	if (document.forms[0].StdWeddingCake.checked)   {
		document.forms[0].StdWeddingCake.value = "Y"
	}
	else { 
		document.forms[0].StdWeddingCake.value = " "
		document.forms[0].StdWeddingCake.checked = true
	}
	for (i = StartOfEntrePos; i <= EndOfEntrePos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	for (i = StartOfOptCondPos; i <= EndOfOptCondPos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	for (i = StartOfSidePos; i <= EndOfSidePos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	for (i = StartOfDesertPos; i <= EndOfDesertPos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	for (i = StartOfSnackPos; i <= EndOfSnackPos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	for (i = StartOfOptItemPos; i <= EndOfOptItemPos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	for (i = StartOfBevPos; i <= EndOfBevPos; i++)   {
		if (document.forms[0].elements[i].checked)   {
			document.forms[0].elements[i].value = "Y"
		}
		else { 
			document.forms[0].elements[i].value = " "
			document.forms[0].elements[i].checked = true
		}
	}
	return true;   
}
// Checks the quantity fields for all integers.
function isNum(xx)   {   
	var str = document.forms[0].elements[xx].value; 
	// Return false if characters are not '0-9' .    
	for (var i = 0; i < str.length; i++){      
		var ch = str.substring(i, i + 1);      
		if ((ch < "0" || "9" < ch)) {
			qtyflag = 0
			return false;         
		}      
	}   
	return true;   
}
// Checks the quantity fields for all integers and/or decimal.
function isFraction(xx)   {   
	qtyflag = 1
	var str = xx; 
	// Return false if characters are not '0-9' .    
	for (var i = 0; i < str.length; i++){      
		var ch = str.substring(i, i + 1);      
		if ((ch < "0" || "9" < ch)) {
			if (ch != ".")   {
				qtyflag = 0
				return false;
			}
		}      
	}   
	return true;   
}
// round a field to nearest penny
function roundIt(value)     {
	var whole = Math.floor(value);
	var fract = (value - whole) * 100;
	result = whole + (Math.round(fract) / 100);
return result;
}
//---Test that aString is no shorter than minLength
function isMinLength(aString, minLength) 
{
	if (aString.length >= minLength)
      return true
   else
      return false
}
//---Test that aString is no longer than maxLength
function isMaxLength(aString, maxLength) 
{
	if (aString.length <= maxLength)
      return true
   else
      return false
}
//---Test that aString is exactly aLength
function isLength(aString, aLength)
{
   if (isMaxLength(aString, aLength) && 
         isMinLength(aString, aLength))
      return true
   else
      return false
}
function fmtPrice(value)   {
	if (value < 0)   {   value = 0;   }
	result=Math.floor(value)+".";   
	var cents=100*(value-Math.floor(value))+0.5;   
	result += Math.floor(cents/10);   
	result += Math.floor(cents%10);   
		if (isLength(result, 4)) {
			resultx="$     "+result;
			return resultx;
		}
		if (isLength(result, 5)) {
			resultx="$    "+result;
			return resultx;
		}
		if (isLength(result, 6)) {
			resultx="$   "+result;
			return resultx;
		}
		if (isLength(result, 7)) {
			resultx="$  "+result;
			return resultx;
		}
		if (isLength(result, 8)) {
			resultx="$ "+result;
			return resultx;
		}
		if (isLength(result, 9)) {
			resultx="$"+result;
			return resultx;
		}
	return result;   
}
// Round Buffet hours up to nearest half hour - minimum 2 hours 
function fmtBuffetHours(value)   {   
	if (value < 2)   { 
		value = 2;
		alert ("Warning! Minimum buffet time is two hours. Form is being set for 2 hours.");
	}
	var x = Math.floor(value);
	var y = value - x;
	if (y == 0)   {
		result = x;
		return result;
	}
	if (y > .5)   {
		result = x + 1;
		alert ("Warning! Buffet time must be in half hour increments. Form is being rounded up.");
		return result;
	}
	if (y < .5)   {
		result = x + .5;
		alert ("Warning! Buffet time must be in half hour increments. Form is being rounded up.");
		return result;
	}
	result = x + .5
	return result;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device
          // calculate extended prices - xx equals field position of extended amount
function calcit(xx, unitprice) {
	SubtractItOut(xx)
               // Is unit qty numeric?
		  qtyflag = 1
		 var yy = xx - 1;
		var qtyok = isNum(yy);
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
			document.forms[0].elements[yy].select();         
			document.forms[0].elements[yy].focus();         
			return;         
		}      
                var qtynum = document.forms[0].elements[yy].value;
		var extamt = qtynum * unitprice;
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	addITup (xx, extamt);
      return;          
}

	// is the event for a full day?
function iffullday(selection, xx, morning, afternoon, evening, fullday)     {
	fulldaysw = 0
	var tempindex = selection.selectedIndex
	if (tempindex == 4)   {
		fulldaysw = 1
	}
}

	// calc for yes or no options and for single selection lists - xx equals field position of extended amount
function calcyorn(selection, xx, unitprice1, unitprice2, unitprice3, unitprice4, unitprice5, unitprice6, unitprice7, unitprice8, unitprice9)     {
	SubtractItOut(xx)
	var tempindex = selection.selectedIndex
	var extamt = 0
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	if (tempindex == 1)   {
		extamt = unitprice1
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 2)   {
		extamt = unitprice2
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 3)   {
		extamt = unitprice3
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 4)   {
		extamt = unitprice4
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 5)   {
		extamt = unitprice5
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 6)   {
		extamt = unitprice6
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 7)   {
		extamt = unitprice7
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 8)   {
		extamt = unitprice8
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}
	if (tempindex == 9)   {
		extamt = unitprice9
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}

// If full day is selected, charge $1,900.00 for facilities
	if (xx == 7)     {
		if (fulldaysw == 1)     {
			extamt = 1900
			document.forms[0].elements[xx].value = fmtPrice(extamt);
		}
	}

// Charge additional $2 per head in excess of 200 people
	var excesscount = 0
	if (xx == 7 && TotalPeople > 200)     {
		excesscount = TotalPeople - 200
		excesscount = excesscount * 2
		extamt = extamt + excesscount
		document.forms[0].elements[xx].value = fmtPrice(extamt);
	}

	addITup (xx, extamt);
	return;
}
// Calculate Head count totals
function CalcHeads(xx)     {
	if (xx == 03)   {
		// Is this an attempt to change Total People?
		if ( TotalPeopleSw != "ok" )   {
			alert ("Changing Total People count causes this page to be reset.")
			reloadIt();
			return;
		}
	}
	if (xx == 04)   {
		// Is this an attempt to change Total under 5 kids?
		if ( TotalUnder5Sw != "ok" )   {
			alert ("Changing Kids under 5 count causes this page to be reset.")
			reloadIt();
			return;
		}
	}
	if (xx == 05)   {
		// Is this an attempt to change Total 5 to 10 kids?
		if ( Total5to10Sw != "ok" )   {
			alert ("Changing the count for kids between 5 and 10 causes this page to be reset.")
			reloadIt();
			return;
		}
	}
	// Is unit qty numeric?
	qtyflag = 1
	var qtyok = isNum(xx);
	if (qtyflag == 0) {         
	alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
		document.forms[0].elements[xx].select();         
		document.forms[0].elements[xx].focus();         
		return;         
	}      
	if ( xx == 03 )   {
		TotalPeopleSw = "ko"
		TotalPeople = document.forms[0].peopletotal.value
		if ( TotalUnder5Sw == "ok" )   {
			document.forms[0].peoplelessthan5old.select();         
			document.forms[0].peoplelessthan5old.focus();    
			return;
		}
		if ( Total5to10Sw == "ok" )   {
			document.forms[0].people5to10old.select();         
			document.forms[0].people5to10old.focus();    
			return;
		}
	}
	if ( xx == 04 )   {
		TotalUnder5Sw = "ko"
		TotalUnder5 = document.forms[0].peoplelessthan5old.value
		if ( TotalPeopleSw == "ok" )   {
			document.forms[0].peopletotal.select();         
			document.forms[0].peopletotal.focus();    
			return;
		}
		if ( Total5to10Sw == "ok" )   {
			document.forms[0].people5to10old.select();         
			document.forms[0].people5to10old.focus();    
			return;
		}
	}
	if ( xx == 05 )   {
		Total5to10Sw = "ko"
		Total5to10 = document.forms[0].people5to10old.value
		if ( TotalPeopleSw == "ok" )   {
			document.forms[0].peopletotal.select();         
			document.forms[0].peopletotal.focus();    
			return;
		}
		if ( TotalUnder5Sw == "ok" )   {
			document.forms[0].peoplelessthan5old.select();         
			document.forms[0].peoplelessthan5old.focus();    
			return;
		}
	}
	// Now we can set the totals for head counts
	TotalAdults = TotalPeople - TotalUnder5 - Total5to10
	if ( TotalAdults < 0 )   {
		alert ( "Kid totals are greater than total people. This is wrong. Check your head counts and re-enter." );
		TotalPeopleSw = "ok";
		TotalUnder5Sw = "ok";
		Total5to10Sw = "ok";
		alertHeadCtsw = 0;
		TotalPeople = 0;
		TotalAdults = 0;
		Total5to10 = 0;
		TotalUnder5 = 0;
		document.forms[0].peopletotal.value = 0;
		document.forms[0].peoplelessthan5old.value = 0;
		document.forms[0].people5to10old.value = 0;
		document.forms[0].peopletotal.select();
		document.forms[0].peopletotal.focus();
		return;
	}
	document.forms[0].AdultFoodCount.value = TotalAdults;
	document.forms[0].KidFoodCount.value = Total5to10;
	alertHeadCtsw = 0;
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device

// Calc for Games Packages where number of kids and number of hours are required
function CalcPkgePrice(xx)    {
	SubtractItOut(xx)
	// yy = index for number of kids field, zz = index for number of hours field
	var yy = xx - 2
	var zz = xx - 1
              // Is unit qty numeric?
		  qtyflag = 1
		var qtyok = isNum(yy);
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
			document.forms[0].elements[yy].select();         
			document.forms[0].elements[yy].focus();         
			return;         
		}      

		  qtyflag = 1
		qtyok = isNum(zz);
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
			document.forms[0].elements[zz].select();         
			document.forms[0].elements[zz].focus();         
			return;         
		}

	// now it's ok to calculate the extend amount
	var kidnum = document.forms[0].elements[yy].value;
	var hournum = document.forms[0].elements[zz].value;
	var over150 = kidnum - 150;
	if (over150 < 1)   {  over150 = 0   };
	// surcharge for more than 150 kids is $1.00 per kid per hour
	var over150chge = over150 * hournum * 1;
	var pkgeamt = hournum * 200 + over150chge;
	if (kidnum < 126)   { pkgeamt = hournum * 175  }
	if (kidnum < 101)   { pkgeamt = hournum * 150  }
	if (kidnum < 76)    { pkgeamt = hournum * 125  }
	if (kidnum < 51)    { pkgeamt = hournum * 100  }
	// minimum charge for the package is $175.00
	if (pkgeamt < 175)  { pkgeamt = 175 };
	if (kidnum == 0)    { pkgeamt = 0   };
	if (hournum == 0)   { pkgeamt = 0   };
	document.forms[0].elements[xx].value = fmtPrice(pkgeamt);
	addITup (xx, pkgeamt);
        return;          	
}
// calc price for Kids Fun-For-All Package
function CalcFunForAllPrice(xx)     {
	var yy = xx - 1;
              // Is unit qty numeric?
		  qtyflag = 1
		var qtyok = isNum(yy);
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
			document.forms[0].elements[yy].select();         
			document.forms[0].elements[yy].focus();         
			return;         
		}      
	// now it's ok to calculate the extend amount
	var kidnum = document.forms[0].elements[yy].value;
	var over100 = kidnum - 100;
	if (over100 < 1)   {  over100 = 0   };
	// surcharge for more than 100 kids is $5.00 per kid
	var over100chge = over100 * 5;
	var pkgeamt = 500 + over100chge;
	if (kidnum < 76)   { pkgeamt = 400  }
	if (kidnum < 51)   { pkgeamt = 325  }
	if (kidnum < 26)    { pkgeamt = 250  }
	if (kidnum == 0)    { pkgeamt = 0   };
	document.forms[0].elements[xx].value = fmtPrice(pkgeamt);
	addITup (xx, pkgeamt);
      return;          		
}
// ****************************************************************************************************************

// Process adjustment amounts
function calcAdj_adds()     {
              // Is unit qty numeric?
		var qtyok = isFraction(document.forms[0].adjustment_adds.value);
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
			return;         
		}      
	adj_adds_sw = 1
	var wk1 = 0 - document.forms[0].adjustment_adds.value
	if (adj_subs_sw == 0)  {
		GrandTotal_adj = GrandTotal - wk1
	}
	else   {
		GrandTotal_adj = GrandTotal_adj - wk1
	}
	document.forms[0].adjustment_adds.value = fmtPrice(document.forms[0].adjustment_adds.value);
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj);
	return;
}
function calcAdj_subs()     {
              // Is unit qty numeric?
		var qtyok = isFraction(document.forms[0].adjustment_subs.value);
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
			return;         
		}      
	adj_subs_sw = 1
// alert ("adj_adds_sw in subtract routine = " + adj_adds_sw)
	if (adj_adds_sw == 0)  {
		GrandTotal_adj = GrandTotal - document.forms[0].adjustment_subs.value
	}
	else   {
		GrandTotal_adj = GrandTotal_adj - document.forms[0].adjustment_subs.value
	}
	document.forms[0].adjustment_subs.value = fmtPrice(document.forms[0].adjustment_subs.value);
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj);
	return;
}

// Add to Grand total and appropriate subtotal *******************************************************************
function addITup(xx, extamt) {
	GrandTotal = extamt + GrandTotal;
	document.forms[0].GrandTotal.value = fmtPrice(GrandTotal);          
	// Does it get added to any sub total?
	if (xx < FirstExtAmtPos) { 
		document.forms[0].BaseLeaseTotal.value = fmtPrice(extamt);
		return; 
	}
	if (xx < OptForEventSTPos) {
		EventOptSubTotal = EventOptSubTotal + extamt;
		document.forms[0].elements[OptForEventSTPos].value = fmtPrice(EventOptSubTotal);
		document.forms[0].OptionsForEventTotal.value = fmtPrice(EventOptSubTotal);
		return;
		}
	if (xx < OptRidesSTpos) {
		RideOptSubTotal = RideOptSubTotal + extamt;
		document.forms[0].elements[OptRidesSTpos].value = fmtPrice(RideOptSubTotal);
		document.forms[0].RideOptionsTotal.value = fmtPrice(RideOptSubTotal);
		return;
		}
	if (xx < OptActSTPos) {
		ActivityOptSubTotal = ActivityOptSubTotal + extamt;
		document.forms[0].elements[OptActSTPos].value = fmtPrice(ActivityOptSubTotal);
		document.forms[0].ActivityOptionTotal.value = fmtPrice(ActivityOptSubTotal);
		return;
		}
	if (xx < OptInflatablesSTPos) {
		InflatablesOptSubTotal = InflatablesOptSubTotal + extamt;
		document.forms[0].elements[OptInflatablesSTPos].value = fmtPrice(InflatablesOptSubTotal);
		document.forms[0].InflatablesOptionTotal.value = fmtPrice(InflatablesOptSubTotal);
		return;
		}
	if (xx < OptWeddingSTPos) {
		WeddingOptSubTotal = WeddingOptSubTotal + extamt;
		document.forms[0].elements[OptWeddingSTPos].value = fmtPrice(WeddingOptSubTotal);
		document.forms[0].WeddingOptionTotal.value = fmtPrice(WeddingOptSubTotal);
		return;
		}
	return;
}
// Subtract from Grand Total and appropriate subtotal when user clicks on a qty field or yes or no field
function SubtractItOut(xx)     {
	if (alertHeadCtsw == 0)   {
		if (TotalPeopleSw == "ok" || TotalUnder5Sw == "ok" || Total5to10Sw == "ok")   {
			alert ("You did not enter all of the required head count information above. This form is invalid.");
			alertHeadCtsw = 1;
			return;
		}
	}
	if (alertHeadCtsw == 1)   {
		document.forms[0].elements[xx].value = "VOID";
		reloadIt();
		return;
	}
	var oldtextamount = document.forms[0].elements[xx].value
	// Get rid of $ sign for the line item and subtract from totals.
		removeDolSign (oldtextamount)
		oldtextamount = 0 - newfield
		addITup(xx, oldtextamount)
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device

// How much for wedding cake?
function WeddingCakeCalc(xx)     {

	if (document.forms[0].StdWeddingCake.checked)   {
		var subttlk = Total5to10 * document.forms[0].StdWeddingCake.value * .5;
		var subttl = TotalAdults * document.forms[0].StdWeddingCake.value;
		subttl = subttl + subttlk;
		document.forms[0].WeddingCakeExt.value = fmtPrice(subttl);
		addITup (xx, subttl);
		return;
	}

	var oldtextamount = document.forms[0].elements[xx].value
	// Get rid of $ sign for the line item and subtract from totals.
		removeDolSign (oldtextamount)
		oldtextamount = 0 - newfield
		addITup(xx, oldtextamount)
		document.forms[0].WeddingCakeExt.value = fmtPrice(0);
	return;
}

// Calculate total time for Buffet to 1/2 hour increment rounded up.
function BuffetHourCalc()     {
	if (alertHeadCtsw == 0)   {
		if (TotalPeopleSw == "ok" || TotalUnder5Sw == "ok" || Total5to10Sw == "ok")   {
			alert ("You did not enter all of the required head count information above. This form is invalid.");
			alertHeadCtsw = 1;
			return;
		}
	}
	var valuein = document.forms[0].TotalBuffetHours.value
	isFraction(valuein)
	if (qtyflag == 0) {         
		alert("\nThe Buffet Hours entered is invalid. \n\nPlease re-enter.");   
			document.forms[0].TotalBuffetHours.select();         
			document.forms[0].TotalBuffetHours.focus();         
		return;         
	}      
	
	if (valuein == 0)   {
		alert ("You have entered zero. This means you do not want any food items. All associated values have been reset to zero.");
		eraseFood();
		return;
	}

	document.forms[0].TotalBuffetHours.value = fmtBuffetHours(valuein);
	BuffetHours = document.forms[0].TotalBuffetHours.value;
	var newexHours = BuffetHours - 2;
	if (newexHours < 0)   { newexHours = 0   };
	var excessHours = newexHours - oldexHours;
	oldexHours = newexHours;
	var AdultDiff = excessHours * BuffetExcessTime * TotalAdults
	var KidDiff = excessHours * BuffetExcessTime * Total5to10 * .5
	AdultServicePrice = AdultServicePrice + AdultDiff;
	KidServicePrice = KidServicePrice + KidDiff;
	document.forms[0].AdultServiceSurcharge.value = fmtPrice(AdultServicePrice);
	document.forms[0].KidServiceSurcharge.value = fmtPrice(KidServicePrice);
	AdultFoodPrice = AdultFoodPrice + AdultDiff;
	KidFoodPrice = KidFoodPrice + KidDiff;
	document.forms[0].AdultTotalFood.value = fmtPrice(AdultFoodPrice);
	document.forms[0].KidTotalFood.value = fmtPrice(KidFoodPrice);
	var FoodDiff = AdultDiff + KidDiff;
	calcFoodBev(1, FoodDiff);
	return;
}
function chkPasswrd(xx)     {
	if (document.forms[0].Passwrd.value == "chateau")   {   return;   };
	document.forms[0].elements[xx].value = ""
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device


// Calculate Entres
function EntreCalc(xx)     {
	if (TotalPeople < 1)   {
		alert (" You need to supply head count information first.");
		document.forms[0].elements[xx].checked = false
		document.forms[0].peopletotal.select();         
		document.forms[0].peopletotal.focus();
		return;
	}
	if (BuffetHours < 2)   {
		alert ("You need to supply the total hours for Buffet service.");
		document.forms[0].elements[xx].checked = false
		document.forms[0].TotalBuffetHours.select();         
		document.forms[0].TotalBuffetHours.focus();	
		return;
	}
	var adultTot = 0;
	var kidTot = 0;
	var AddOrSub = -1;
	var zz = 0;
	if (document.forms[0].elements[xx].checked)   { AddOrSub = 1  }
	// If this is an entre calculate entre totals ****************************************************** 
	if (xx <= EndOfEntrePos)   {
		entreCount = entreCount + AddOrSub
		adultTot = adultTot + (document.forms[0].elements[xx].value * TotalAdults * AddOrSub);
		kidTot = kidTot + (document.forms[0].elements[xx].value * Total5to10 * .5 * AddOrSub);
		// If AddOrSub = +1 add in the entre
		if (AddOrSub == 1)   {
			if (entreCount > 3)   {
				adultTot = adultTot + (AdultExcessEntre * TotalAdults);
				kidTot = kidTot + (AdultExcessEntre * .5 * Total5to10);
			}
			if (entreCount == 3)   {
				adultTot = adultTot + (Entre3rd * TotalAdults);
				kidTot = kidTot + (Entre3rd * .5 * Total5to10);
			}
			if (entreCount == 1)   {
				if (TotalPeople > 999)   {
					adultTot = adultTot + (Entre1000up * TotalAdults);
					kidTot = kidTot + (Entre1000up * .5 * Total5to10);
				}
				if (TotalPeople < 1000)   {
					if (TotalPeople > 500)   {
						adultTot = adultTot + (Entre501to999 * TotalAdults);
						kidTot = kidTot + (Entre501to999 * .5 * Total5to10);
					}
				}
				if (TotalPeople < 501)   {
					if (TotalPeople > 250)   {
						adultTot = adultTot + (Entre251to500 * TotalAdults);
						kidTot = kidTot + (Entre251to500 * .5 * Total5to10);
					}
				}
				if (TotalPeople < 251)   {
					if (TotalPeople > 150)   {
						adultTot = adultTot + (Entre151to250 * TotalAdults);
						kidTot = kidTot + (Entre151to250 * .5 * Total5to10);
					}
				}
				if (TotalPeople < 151)   {
					if (TotalPeople > 100)   {
						adultTot = adultTot + (Entre101to150 * TotalAdults);
						kidTot = kidTot + (Entre101to150 * .5 * Total5to10);
					}
				}
				if (TotalPeople < 101)   {
					if (TotalPeople > 50)   {
						adultTot = adultTot + (Entre51to100 * TotalAdults);
						kidTot = kidTot + (Entre51to100 * .5 * Total5to10);
					}
				}
				if (TotalPeople < 51)   {
					adultTot = adultTot + (Entre1to50 * TotalAdults);
					kidTot = kidTot + (Entre1to50 * .5 * Total5to10);
				}
			}
			zz = AdultTotalEntrePos
			addupFood(zz, adultTot, kidTot)
			var Asubaside = 0;
			var Ksubaside = 0;
			// Do we have to subtract out a side???
			if (entreCount < 4 && sideCount >= entreCount)   {
				Asubaside = AdultExcessSides * TotalAdults * -1;
				Ksubaside = AdultExcessSides * Total5to10 * .5 * -1;
				zz = AdultTotalEntrePos
				addupFood(zz, Asubaside, Ksubaside)
				return;
			}
			return;
		}
		// AddOrSub = -1 so Remove the entre *** Entre Count has already been reduced by 1 ***
		if (entreCount > 2)   {
			adultTot = adultTot - (AdultExcessEntre * TotalAdults);
			kidTot = kidTot - (AdultExcessEntre * .5 * Total5to10);
		}
		if (entreCount == 2)   {
			adultTot = adultTot - (Entre3rd * TotalAdults);
			kidTot = kidTot - (Entre3rd * .5 * Total5to10);
		}
		if (entreCount == 0)   {
			if (TotalPeople > 999)   {
				adultTot = adultTot - (Entre1000up * TotalAdults);
				kidTot = kidTot - (Entre1000up * .5 * Total5to10);
			}
			if (TotalPeople < 1000)   {
				if (TotalPeople > 500)   {
					adultTot = adultTot - (Entre501to999 * TotalAdults);
					kidTot = kidTot - (Entre501to999 * .5 * Total5to10);
				}
			}
			if (TotalPeople < 501)   {
				if (TotalPeople > 250)   {
					adultTot = adultTot - (Entre251to500 * TotalAdults);
					kidTot = kidTot - (Entre251to500 * .5 * Total5to10);
				}
			}
			if (TotalPeople < 251)   {
				if (TotalPeople > 150)   {
					adultTot = adultTot - (Entre151to250 * TotalAdults);
					kidTot = kidTot - (Entre151to250 * .5 * Total5to10);
				}
			}
			if (TotalPeople < 151)   {
				if (TotalPeople > 100)   {
					adultTot = adultTot - (Entre101to150 * TotalAdults);
					kidTot = kidTot - (Entre101to150 * .5 * Total5to10);
				}
			}
			if (TotalPeople < 101)   {
				if (TotalPeople > 50)   {
					adultTot = adultTot - (Entre51to100 * TotalAdults);
					kidTot = kidTot - (Entre51to100 * .5 * Total5to10);
				}
			}
			if (TotalPeople < 51)   {
				adultTot = adultTot - (Entre1to50 * TotalAdults);
				kidTot = kidTot - (Entre1to50 * .5 * Total5to10);
			}
		}
		zz = AdultTotalEntrePos
		addupFood(zz, adultTot, kidTot)
		// Do we have to add in a side???
		var Aaddaside = 0
		var Kaddaside = 0
		if (entreCount <= 2 && sideCount > entreCount)   {
			Aaddaside = AdultExcessSides * TotalAdults;
			Kaddaside = AdultExcessSides * Total5to10 * .5;
			zz = AdultTotalEntrePos
			addupFood(zz, Aaddaside, Kaddaside)
			return;
		}
		return;
	}
	// If this is an optional condiment, calculate it *******************
	if (xx <= EndOfOptCondPos)   {
		adultTot = adultTot + (document.forms[0].elements[xx].value * TotalAdults * AddOrSub);
		kidTot = kidTot + (document.forms[0].elements[xx].value * Total5to10 * .5 * AddOrSub);
		zz = AdultTotalEntrePos
		addupFood(zz, adultTot, kidTot)		
		return;
	}
	// If this is a side or desert, calculate Sides ************************
	if (xx <= EndOfDesertPos)   {
		sideCount = sideCount + AddOrSub;
		adultTot = adultTot + (document.forms[0].elements[xx].value * TotalAdults * AddOrSub);
		kidTot = kidTot + (document.forms[0].elements[xx].value * Total5to10 * .5 * AddOrSub);
		// If AddOrSub = +1 add in the side
		if (AddOrSub == 1 && sideCount > entreCount)   {
			adultTot = adultTot + (AdultExcessSides * TotalAdults);
			kidTot = kidTot + (AdultExcessSides * Total5to10 * .5);
			zz = AdultTotalEntrePos
			addupFood(zz, adultTot, kidTot)
			return;
		}
		if (AddOrSub == 1 && sideCount > 3)   {
			adultTot = adultTot + (AdultExcessSides * TotalAdults);
			kidTot = kidTot + (AdultExcessSides * Total5to10 * .5);
			zz = AdultTotalEntrePos
			addupFood(zz, adultTot, kidTot)
			return;
		}
		if (AddOrSub == 1)   {
			zz = AdultTotalEntrePos
			addupFood(zz, adultTot, kidTot)
			return;   
		}
		// AddOrSub = -1 so Remove the side *** Side Count has already been reduced by 1 ***
		if (sideCount >= 3)   {
			adultTot = adultTot - (AdultExcessSides * TotalAdults);
			kidTot = kidTot - (AdultExcessSides * Total5to10 * .5);
			zz = AdultTotalEntrePos
			addupFood(zz, adultTot, kidTot)
			return;
		}
		if (sideCount >= entreCount)   {
			adultTot = adultTot - (AdultExcessSides * TotalAdults);
			kidTot = kidTot - (AdultExcessSides * Total5to10 * .5);
			zz = AdultTotalEntrePos
			addupFood(zz, adultTot, kidTot)
			return;
		}
		zz = AdultTotalEntrePos
		addupFood(zz, adultTot, kidTot)
		return;
	}
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device

function snackCalc(xx)     {
	if (TotalPeople < 1)   {
		alert (" You need to supply head count information first.");
		document.forms[0].elements[xx].checked = false
		document.forms[0].peopletotal.select();         
		document.forms[0].peopletotal.focus();
		return;
	}
	if (BuffetHours < 2)   {
		alert ("You need to supply the total hours for Buffet service.");
		document.forms[0].elements[xx].checked = false
		document.forms[0].TotalBuffetHours.select();         
		document.forms[0].TotalBuffetHours.focus();	
		return;
	}
	var AddOrSub = -1;
	var adultTot = 0;
	var kidTot = 0;
	if (document.forms[0].elements[xx].checked)   { AddOrSub = 1  }
	adultTot = (document.forms[0].elements[xx].value * TotalAdults * AddOrSub);
	kidTot = (document.forms[0].elements[xx].value * Total5to10 * .5 * AddOrSub);
	AdultSnackPrice = AdultSnackPrice + adultTot;
	KidSnackPrice = KidSnackPrice + kidTot;
	document.forms[0].AdultTotalSnacks.value = fmtPrice(AdultSnackPrice);
	document.forms[0].KidTotalSnacks.value = fmtPrice(KidSnackPrice);
	addupXtra(adultTot, kidTot)
	return;
}
// Currently, the only option is the ice sculpture which is not head count dependant.
function optionCalc(xx)     {
	if (TotalPeople < 1)   {
		alert (" You need to supply head count information first.");
		document.forms[0].elements[xx].checked = false
		document.forms[0].peopletotal.select();         
		document.forms[0].peopletotal.focus();
		return;
	}
	if (BuffetHours < 2)   {
		alert ("You need to supply the total hours for Buffet service.");
		document.forms[0].elements[xx].checked = false
		document.forms[0].TotalBuffetHours.select();         
		document.forms[0].TotalBuffetHours.focus();	
		return;
	}
	var AddOrSub = -1;
	var adultTot = 0;
	var kidTot = 0;
	if (document.forms[0].elements[xx].checked)   { AddOrSub = 1  }
	adultTot = (document.forms[0].elements[xx].value * AddOrSub);
	kidTot = 0 
	AdultOptPrice = AdultOptPrice + adultTot
	KidOptPrice = KidOptPrice + kidTot
	document.forms[0].AdultTotalOptions.value = fmtPrice(AdultOptPrice);
	document.forms[0].KidTotalOptions.value = fmtPrice(KidOptPrice);
	addupXtra(adultTot, kidTot)
	return;
}
function addupXtra(adultTot, kidTot)     {
	AdultFoodPrice = AdultFoodPrice + adultTot;
	KidFoodPrice = KidFoodPrice + kidTot;
	document.forms[0].AdultTotalFood.value = fmtPrice(AdultFoodPrice);
	document.forms[0].KidTotalFood.value = fmtPrice(KidFoodPrice);
	var FoodDiff = adultTot + kidTot;
	calcFoodBev(1, FoodDiff);
	return;
}
function addupFood(xx, adultTot, kidTot)     {
	var yy = xx + 1;
	AdultEntrePrice= AdultEntrePrice + adultTot;
	KidEntrePrice = KidEntrePrice + kidTot;
	document.forms[0].elements[xx].value = fmtPrice(AdultEntrePrice);
	document.forms[0].elements[yy].value = fmtPrice(KidEntrePrice);
	AdultFoodPrice = AdultFoodPrice + adultTot;
	KidFoodPrice = KidFoodPrice + kidTot;
	document.forms[0].AdultTotalFood.value = fmtPrice(AdultFoodPrice);
	document.forms[0].KidTotalFood.value = fmtPrice(KidFoodPrice);
	var FoodDiff = adultTot + kidTot;
	calcFoodBev(1, FoodDiff);
	return;
}
// Erase all food items and totals
function eraseFood()     {
	document.forms[0].AdultTotalEntreAndSide.value = 0;
	document.forms[0].KidTotalEntreAndSide.value = 0;
	document.forms[0].AdultTotalSnacks.value = 0;
	document.forms[0].KidTotalSnacks.value = 0;
	document.forms[0].AdultTotalOptions.value = 0;
	document.forms[0].KidTotalOptions.value = 0;
	document.forms[0].AdultTotalFood.value = 0;
	document.forms[0].KidTotalFood.value = 0;
	document.forms[0].AdultServiceSurcharge.value = 0;
	document.forms[0].KidServiceSurcharge.value = 0;
	AdultEntrePrice = 0
	KidEntrePrice = 0
	AdultSnackPrice = 0
	KidSnackPrice = 0
	AdultOptPrice = 0
	KidOptPrice = 0
	AdultServicePrice = 0
	KidServicePrice = 0
	// Subtract out all food items from summary totals
	var FoodDiff =  0 - AdultFoodPrice - KidFoodPrice;
	calcFoodBev(1, FoodDiff);
	TotalFood = 0	
	AdultFoodPrice = 0
	KidFoodPrice = 0
	BuffetHours = 0
	oldexHours = 0
	entreCount = 0
	sideCount = 0
	// Clear check boxes for all food items	
		clearCheckBoxes(StartOfEntrePos, EndOfEntrePos);
		clearCheckBoxes(StartOfOptCondPos, EndOfOptCondPos);
		clearCheckBoxes(StartOfSidePos, EndOfSidePos);
		clearCheckBoxes(StartOfDesertPos, EndOfDesertPos);
		clearCheckBoxes(StartOfSnackPos, EndOfSnackPos);
		clearCheckBoxes(StartOfOptItemPos, EndOfOptItemPos);
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device
// set beverage subtotals to clickabove
function resetBev()     {
	document.forms[0].AdultSoftDrinkTotal.value = "clickabove";
	document.forms[0].MinorSoftDrinkTotal.value = "clickabove";
	document.forms[0].MinorUnder5charge.value = "clickabove";
	document.forms[0].AdultSpiritTotal.value = "clickabove";
	document.forms[0].LiquorLicense.value = "clickabove";
	document.forms[0].AdultBevTotal.value = "clickabove";
	document.forms[0].MinorBevTotal.value = "clickabove";
	document.forms[0].TotalBevAmt.value = "Invalid";
	return;
}
// Routine to calc food (type = 1) and bev(type = 2) totals
function calcFoodBev (type, amt)     {
	if (type == 1)   {
		TotalFood = TotalFood + amt;
		document.forms[0].TotalFoodAmt.value = fmtPrice(TotalFood);
	}
	if (type == 2)   {
		TotalBev = TotalBev + amt;
		document.forms[0].TotalBevAmt.value = fmtPrice(TotalBev);
	}
	var oldFoodBevTotalAmt = FoodBevTotalAmt
	FoodBevTotalAmt = FoodBevTotalAmt - FoodBevSub;
	FoodBevSub = FoodBevSub + amt;
	document.forms[0].FoodBevSubTotal.value = fmtPrice(FoodBevSub);
	FoodBevTotalAmt = FoodBevTotalAmt + FoodBevSub;
	FoodBevTotalAmt = FoodBevTotalAmt - SalesTax;
	var unfnumb = FoodBevSub * .0775;            // add sales tax of 7.75 percent
	SalesTax = roundIt(unfnumb);
	document.forms[0].SalesTaxTotal.value = fmtPrice(SalesTax);
	FoodBevTotalAmt = FoodBevTotalAmt + SalesTax;
	FoodBevTotalAmt = FoodBevTotalAmt - PrepFeeAmt;
	unfnumb = FoodBevSub * .15;                  // add prep fee of 15 percent
	PrepFeeAmt = roundIt(unfnumb);
	document.forms[0].PrepFee.value = fmtPrice(PrepFeeAmt);
	FoodBevTotalAmt = FoodBevTotalAmt + PrepFeeAmt;
	document.forms[0].FoodBevTotal.value = fmtPrice(FoodBevTotalAmt);
	var granddiff = FoodBevTotalAmt - oldFoodBevTotalAmt;
	GrandTotal = GrandTotal + granddiff;
	document.forms[0].GrandTotal.value = fmtPrice(GrandTotal);
	return;
}
// function to calculate beverage costs
function calcBev()     {
	// Subtract old beverage costs from summary totals
	var bevdiff = 0 - TotalBev;
	calcFoodBev (2, bevdiff);
	// Clear old beverage costs
	AdultSoftDrinkAmt = 0
	MinorSoftDrinkAmt = 0
	Under5SoftDrinkAmt = 0
	AdultSpiritAmt = 0
	LiquorLicAmt = 0
	AdultBevAmt = 0
	MinorBevAmt = 0
	document.forms[0].AdultSoftDrinkTotal.value = fmtPrice(AdultSoftDrinkAmt);
	document.forms[0].MinorSoftDrinkTotal.value = fmtPrice(MinorSoftDrinkAmt);
	document.forms[0].MinorUnder5charge.value = fmtPrice(Under5SoftDrinkAmt);
	document.forms[0].AdultSpiritTotal.value = fmtPrice(AdultSpiritAmt);
	document.forms[0].LiquorLicense.value = fmtPrice(LiquorLicAmt);
	document.forms[0].AdultBevTotal.value = fmtPrice(AdultBevAmt);
	document.forms[0].MinorBevTotal.value = fmtPrice(MinorBevAmt);
	if (BevHoursQty == 0)   {
		clearCheckBoxes(StartOfBevPos, EndOfBevPos)
		return;
	}
	// add in new beverage amount
	var softdrinkcnt = 0
	var BrassRailsw = 0
	if (document.forms[0].BrassRail.checked)   {
		BrassRailsw = 1
	}
	if (document.forms[0].WWMixedDrinks.checked)   {
		BrassRailsw = 1
	}
	var aa = BevHoursQty - 3;   // set position of array index
	if (document.forms[0].pepsi.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		if (BrassRailsw == 0)   {
			AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Apepsi[aa] * AdultBevCnt);
		}
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Apepsi[aa] * MinorBevCnt);
	}
	if (document.forms[0].lemonade.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Alemonade[aa] * AdultBevCnt);
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Alemonade[aa] * MinorBevCnt);
	}
	if (document.forms[0].icedtea.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		if (BrassRailsw == 0)   {
			AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Aicedtea[aa] * AdultBevCnt);
		}
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Aicedtea[aa] * MinorBevCnt);
	}
	if (document.forms[0].welches.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Awelches[aa] * AdultBevCnt);
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Awelches[aa] * MinorBevCnt);
	}
	if (document.forms[0].bottledwater.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Abottledwater[aa] * AdultBevCnt);
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Abottledwater[aa] * MinorBevCnt);
	}
	if (document.forms[0].coffee.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Acoffee[aa] * AdultBevCnt);
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Acoffee[aa] * MinorBevCnt);
	}
	if (document.forms[0].HotCider.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Ahotcider[aa] * AdultBevCnt);
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Ahotcider[aa] * MinorBevCnt);
	}
	if (document.forms[0].HotChocolate.checked)   {
		softdrinkcnt = softdrinkcnt + 1;
		AdultSoftDrinkAmt = AdultSoftDrinkAmt + (Ahotchocolate[aa] * AdultBevCnt);
		MinorSoftDrinkAmt = MinorSoftDrinkAmt + (Ahotchocolate[aa] * MinorBevCnt);
	}
	if (document.forms[0].StdBeer.checked)   {
		LiquorLicAmt = LiquorLicFee;
		AdultSpiritAmt = AdultSpiritAmt + (Astdbeer[aa] * AdultBevCnt);
	}
	if (document.forms[0].PremiumBeer.checked)   {
		LiquorLicAmt = LiquorLicFee;
		AdultSpiritAmt = AdultSpiritAmt + (Apremiumbeer[aa] * AdultBevCnt);
	}
	if (document.forms[0].wine.checked)   {
		LiquorLicAmt = LiquorLicFee;
		AdultSpiritAmt = AdultSpiritAmt + (Awine[aa] * AdultBevCnt);
	}
	if (document.forms[0].WWMixedDrinks.checked)   {
		LiquorLicAmt = LiquorLicFee;
		AdultSpiritAmt = AdultSpiritAmt + (Amixeddrinks[aa] * AdultBevCnt);
	}
	if (document.forms[0].BrassRail.checked)   {
		LiquorLicAmt = LiquorLicFee;
		AdultSpiritAmt = AdultSpiritAmt + (Abrassrail[aa] * AdultBevCnt);
	}
// Give a discount based on the number of soft drink types ordered
// disabled 03/29/01
//	var unfnumb = 0;
//	if (softdrinkcnt > 2)   {
//		unfnumb = AdultSoftDrinkAmt * .8;
//		AdultSoftDrinkAmt = roundIt(unfnumb);
//		unfnumb = MinorSoftDrinkAmt * .8;
//		MinorSoftDrinkAmt = roundIt(unfnumb);
//	}
//	if (softdrinkcnt == 2)   {
//		unfnumb = AdultSoftDrinkAmt * .9;
//		AdultSoftDrinkAmt = roundIt(unfnumb);
//		unfnumb = MinorSoftDrinkAmt * .9;
//		MinorSoftDrinkAmt = roundIt(unfnumb);
//	}

//	Charge $1.00 for kids under 5 years old
	Under5SoftDrinkAmt = TotalUnder5 * 1
	AdultBevAmt = AdultSoftDrinkAmt + AdultSpiritAmt + LiquorLicAmt;
	MinorBevAmt = MinorSoftDrinkAmt + Under5SoftDrinkAmt;
	document.forms[0].AdultSoftDrinkTotal.value = fmtPrice(AdultSoftDrinkAmt);
	document.forms[0].MinorSoftDrinkTotal.value = fmtPrice(MinorSoftDrinkAmt);
	document.forms[0].MinorUnder5charge.value = fmtPrice(Under5SoftDrinkAmt);
	document.forms[0].AdultSpiritTotal.value = fmtPrice(AdultSpiritAmt);
	document.forms[0].LiquorLicense.value = fmtPrice(LiquorLicAmt);
	document.forms[0].AdultBevTotal.value = fmtPrice(AdultBevAmt);
	document.forms[0].MinorBevTotal.value = fmtPrice(MinorBevAmt);
	bevdiff = AdultBevAmt + MinorBevAmt;
	calcFoodBev (2, bevdiff);
	return;
}
// Process input for number of adults and hours of service for beverages in the following 2 functions
function checkAdultInput(xx)     {
	qtyflag = 1
	var qtyok = isNum(xx);
	if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");
		document.forms[0].elements[xx].focus();
		document.forms[0].elements[xx].select();
		return false;         
	}      
	var inqty = document.forms[0].AdultInput.value ;
	if (inqty > TotalAdults)   {
		alert("\nYour input for number of adults is greater than the number calculated from your input at the beginning of this form. \nBased on your prior input, your adult count cannot exceed " + TotalAdults + ". Please re-enter.");
		document.forms[0].elements[xx].focus();
		document.forms[0].elements[xx].select();
		return false;
	}
	AdultBevCnt = inqty;
	document.forms[0].AdultBevCount.value = AdultBevCnt;
	MinorBevCnt = TotalPeople - AdultBevCnt - TotalUnder5;
	document.forms[0].MinorBevCount.value = MinorBevCnt;
	document.forms[0].Under5BevCount.value = TotalUnder5;
	return true;
}
function checkBevHours(xx)     {
	qtyflag = 1
	var qtyok = isNum(xx);
	if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");
		document.forms[0].elements[xx].focus();
		document.forms[0].elements[xx].select();
		return;         
	}      
	var inqty = document.forms[0].BevHours.value ;
	if (inqty > 5 || (inqty < 3 && inqty != 0))   {
		alert("\nYour input for number of hours for beverage service must be 0, 3, 4 or 5. Please re-enter.");
		document.forms[0].elements[xx].focus();
		document.forms[0].elements[xx].select();
		return;
	}
	BevHoursQty = inqty;
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device

function clearCheckBoxes(xx, yy)     {
	for (var i = xx; i <= yy; i++){      
		document.forms[0].elements[i].checked = false     
	}   
	return;
}
//Function to remove $ sign in a string of 10 characters
function removeDolSign(aString)     {
   var startValue = 0
   var endValue = aString.length
	newfield = 0
	var nf1 = " "
	var nf2 = " "
	var nf3 = " "
	var nf4 = " "
	var nf5 = " "
	var nf6 = " "
	var nf7 = " "
	var nf8 = " "
	var nf9 = " "
	var nf10 = " "
   //Build string one character at a time
   for (var i = startValue; i < endValue; i++)   {
		if (i == 0) { nf1 = " " }
		if (i == 1) { nf2 = aString.charAt(i) }
		if (i == 2) { nf3 = aString.charAt(i) }
		if (i == 3) { nf4 = aString.charAt(i) }
		if (i == 4) { nf5 = aString.charAt(i) }
		if (i == 5) { nf6 = aString.charAt(i) }
		if (i == 6) { nf7 = aString.charAt(i) }
		if (i == 7) { nf8 = aString.charAt(i) }
		if (i == 8) { nf9 = aString.charAt(i) }
		if (i == 9) { nf10 = aString.charAt(i) }
		newfield = nf1+nf2+nf3+nf4+nf5+nf6+nf7+nf8+nf9+nf10
   }
	return;
}
function IllegalChange(xx)     {
	if (document.forms[0].elements[xx].value == "")   { return;  }
	alert("\nAn extended amount or head count field has been improperly altered or is incorrect. \n\nPlease start from the beginning.");
	document.forms[0].elements[xx].value = "VOID"
	VoidSw = 1
	reloadIt();
	document.forms[0].EventType.select();         
	document.forms[0].EventType.focus();
	return;
}
function warnFirst(xx)     {
	document.forms[0].elements[xx].blur();
	alert ("Warning!!! If you continue to change this field, you will invalidate this form.");
	return;
}
// reload the page if something illegal happens
function reloadIt()     {
	alert ( "This page is being reset. If the page doesn't reset, it means your browser doesn't support this function, and you should exit this page and then return. This will enable you to start all over. If you do so, PLEASE enter the head count information as instructed.");
	resetVars()
	document.forms[0].peopletotal.value = 0;
	document.forms[0].peoplelessthan5old.value = 0;
	document.forms[0].people5to10old.value = 0;
	document.forms[0].VoidTag.value = "This form is VOID - Do not use.";
	// Clear check boxes for all food items	
		clearCheckBoxes(StartOfEntrePos, EndOfEntrePos);
		clearCheckBoxes(StartOfOptCondPos, EndOfOptCondPos);
		clearCheckBoxes(StartOfSidePos, EndOfSidePos);
		clearCheckBoxes(StartOfDesertPos, EndOfDesertPos);
		clearCheckBoxes(StartOfSnackPos, EndOfSnackPos);
		clearCheckBoxes(StartOfOptItemPos, EndOfOptItemPos);
	document.forms[0].reset();
	document.forms[0].EventType.select();         
	document.forms[0].EventType.focus();
	return;
}
// Reset Global Variables
function resetVars()     {
	VoidSw = 0
      EventOptSubTotal = 0
      RideOptSubTotal = 0
      ActivityOptSubTotal = 0
      InflatablesOptSubTotal = 0
	WeddingOptSubTotal = 0
	FoodOptSubTotal = 0
	BevOptSubTotal = 0
	GrandTotal = 0
	addl_total = 0
	credit_total = 0
	adjustment_adds = 0
	adjustment_subs = 0
	GrandTotal_adj = 0
	EventBalDue = 0
	adj_adds_sw = 0
	adj_subs_sw = 0
	deposit_amt = 0
	qtyflag = 1
	TotalPeople = 0
	TotalAdults = 0
	Total5to10 = 0
	TotalUnder5 = 0
	newfield = 0
	TotalPeopleSw = "ok"
	Total5to10Sw = "ok"
	TotalUnder5Sw = "ok"
	alertHeadCtsw = 0
	BuffetHours = 0
	oldexHours = 0
	entreCount = 0
	sideCount = 0
	AdultEntrePrice = 0
	KidEntrePrice = 0
	AdultSnackPrice = 0
	KidSnackPrice = 0
	AdultOptPrice = 0
	KidOptPrice = 0
	AdultServicePrice = 0
	KidServicePrice = 0
	AdultFoodPrice = 0
	KidFoodPrice = 0
	AdultBevCnt = 0
	MinorBevCnt = 0
	AdultSoftDrinkAmt = 0
	MinorSoftDrinkAmt = 0
	Under5SoftDrinkAmt = 0
	AdultSpiritAmt = 0
	LiquorLicAmt = 0
	AdultBevAmt = 0
	MinorBevAmt = 0
	TotalFood = 0
	TotalBev = 0
	FoodBevSub = 0
	SalesTax = 0
	PrepFeeAmt = 0
	FoodBevTotalAmt = 0
	BevHoursQty = 0
	return;
}
// This guy is trying to mess with the void field
function noNo()     {
	if (document.forms[0].VoidTag.value == "" && VoidSw == 0)   {   return;   };
	document.forms[0].VoidTag.value = "This form is VOID - Do not use.";
	alert ("Aw c'mon, don't mess with this field.");
	return;
}
// De-activate and re-activate comments tags (Cloaking) to prevent PageMill
// from inserting false end of comments tags later in this code.
// I believe there is a bug in PageMill.
// deactivate Cloaking -->
 <!--  Re-activate Cloaking Device

// Process deposit amount
function calcDeposit()     {
	deposit_amt = document.forms[0].DepRcvd.value
	isFraction(deposit_amt)
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
		document.forms[0].DepRcvd.select();         
		document.forms[0].DepRcvd.focus();
			return;         
		}    
	var baldue = GrandTotal_adj - deposit_amt
//	if (adj_adds_sw == 1)     {  baldue = GrandTotal_adj - deposit_amt   }
//	if (adj_subs_sw == 1)     {  baldue = GrandTotal_adj - deposit_amt   }
	document.forms[0].DepRcvd.value = fmtPrice(deposit_amt);
	document.forms[0].EventBalDue.value = fmtPrice(baldue);
	return;
}

// calculate manual additions and credits
function figureAdj_adds(xx)     {
	isFraction(document.forms[0].elements[xx].value)
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
		document.forms[0].elements[xx].select();         
		document.forms[0].elements[xx].focus();
			return;         
		}      
	var work_amt = 0 - document.forms[0].elements[xx].value
	addl_total = addl_total - work_amt
	document.forms[0].addl_total.value = fmtPrice(addl_total)
	adjustment_adds = adjustment_adds - work_amt
	document.forms[0].adjustment_adds.value = fmtPrice(adjustment_adds)
	work_amt = 0 - adjustment_adds
	GrandTotal_adj = GrandTotal - work_amt - credit_total
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj)
	EventBalDue = GrandTotal_adj - deposit_amt
	document.forms[0].EventBalDue.value = fmtPrice(EventBalDue)
}

function figureAdj_credits(xx)     {
	isFraction(document.forms[0].elements[xx].value)
		if (qtyflag == 0) {         
		alert("\nThe Quantity fields accept only numbers. \n\nPlease re-enter a number.");   
		document.forms[0].elements[xx].select();         
		document.forms[0].elements[xx].focus();
			return;         
		}      
	var work_amt = document.forms[0].elements[xx].value
	var recip_amt = 0 - document.forms[0].elements[xx].value
	credit_total = credit_total - recip_amt
	document.forms[0].credit_total.value = fmtPrice(credit_total)
	adjustment_subs = adjustment_subs - recip_amt
	document.forms[0].adjustment_subs.value = fmtPrice(adjustment_subs)
	var recip_adds = 0 - adjustment_adds
	GrandTotal_adj = GrandTotal - recip_adds - credit_total
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj)
	EventBalDue = GrandTotal_adj - deposit_amt
	document.forms[0].EventBalDue.value = fmtPrice(EventBalDue)
}

// subtract out additions and/or credits upon focusing on a field
function takeout_adds(xx)     {
	var work_amt = document.forms[0].elements[xx].value
	addl_total = addl_total - work_amt
	document.forms[0].addl_total.value = fmtPrice(addl_total)
	adjustment_adds = adjustment_adds - work_amt
	document.forms[0].adjustment_adds.value = fmtPrice(adjustment_adds)
	var recip_adds = 0 - adjustment_adds
	GrandTotal_adj = GrandTotal - recip_adds - credit_total
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj)
	EventBalDue = GrandTotal_adj - deposit_amt
	document.forms[0].EventBalDue.value = fmtPrice(EventBalDue)
}

function takeout_credits(xx)     {
	var work_amt = document.forms[0].elements[xx].value
	var recip_amt = 0 - document.forms[0].elements[xx].value
	credit_total = credit_total - work_amt
	document.forms[0].credit_total.value = fmtPrice(credit_total)
	adjustment_subs = adjustment_subs - work_amt
	document.forms[0].adjustment_subs.value = fmtPrice(adjustment_subs)
	var recip_adds = 0 - adjustment_adds
	GrandTotal_adj = GrandTotal - recip_adds - credit_total
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj)
	EventBalDue = GrandTotal_adj - deposit_amt
	document.forms[0].EventBalDue.value = fmtPrice(EventBalDue)
}

function recalc_totals()     {
	addl_total = 0
	var work_amt = 0 - document.forms[0].addl1.value
	addl_total = addl_total - work_amt
	var work_amt = 0 - document.forms[0].addl2.value
	addl_total = addl_total - work_amt
	var work_amt = 0 - document.forms[0].addl3.value
	addl_total = addl_total - work_amt
	var work_amt = 0 - document.forms[0].addl4.value
	addl_total = addl_total - work_amt
	var work_amt = 0 - document.forms[0].addl5.value
	addl_total = addl_total - work_amt
	document.forms[0].addl_total.value = fmtPrice(addl_total)
	document.forms[0].adjustment_adds.value = fmtPrice(addl_total)
	credit_total = 0
	var work_amt = 0 - document.forms[0].credit1.value
	credit_total = credit_total - work_amt
	var work_amt = 0 - document.forms[0].credit2.value
	credit_total = credit_total - work_amt
	var work_amt = 0 - document.forms[0].credit3.value
	credit_total = credit_total - work_amt
	var work_amt = 0 - document.forms[0].credit4.value
	credit_total = credit_total - work_amt
	var work_amt = 0 - document.forms[0].credit5.value
	credit_total = credit_total - work_amt
	document.forms[0].credit_total.value = fmtPrice(credit_total)
	document.forms[0].adjustment_subs.value = fmtPrice(credit_total)
	var recip_adds = 0 - addl_total
	GrandTotal_adj = GrandTotal - recip_adds - credit_total
	document.forms[0].GrandTotal_adj.value = fmtPrice(GrandTotal_adj)
	EventBalDue = GrandTotal_adj - deposit_amt
	document.forms[0].EventBalDue.value = fmtPrice(EventBalDue)
}
// deactivate Cloaking -->
