	function toDouble(num)

	{ // this function thanks to: http://members.aol.com/grassblad/html/orderform1.html

		// roll the number up or down to 2 decimal places

		num = Math.round(num * 100);

		num = parseFloat(num / 100);

		// if the number is an integer add the zero cents and return

		if( num == parseInt(num) )

			return(num + ".00");

		// see if the number is missing one trailing zero

		if((num * 10) == parseInt(num * 10))

			return(num + "0");

		// if the number got this far, it has two decimal places, 

		// so just return it

		return(num);

	}





	function liveGetValue(layerid)

	{

		var statement = '';

		if (document.all) 

		  statement += "document.all['" + layerid + "'].innerHTML";	     

		else if (document.getElementById)           

		  statement += "document.getElementById('" + layerid + "').innerHTML"; 

		value = eval(statement);

		return value;

	}



	function liveSetValue(layerid, htmlcode)

	{

		var statement = '';

		if (document.all) 

		  statement += "document.all['" + layerid + "'].innerHTML = '" + htmlcode + "';";	     

		else if (document.getElementById)           

		  statement += "document.getElementById('" + layerid + "').innerHTML = '" + htmlcode + "';"; 

		eval(statement);    

	}



	function formGetValue(layerid)

	{

		var statement = '';

		if (document.all) 

		  statement += "document.all['" + layerid + "'].value";	     

		else if (document.getElementById)           

		  statement += "document.getElementById('" + layerid + "').value"; 

		value = eval(statement);

		return value;

	}



	function formSetValue(layerid, htmlcode)

	{

		var statement = '';

		if (document.all) 

		  statement += "document.all['" + layerid + "'].value = '" + htmlcode + "';";	     

		else if (document.getElementById)           

		  statement += "document.getElementById('" + layerid + "').value = '" + htmlcode + "';"; 

		eval(statement);    

	}



	////THIS FUNCTION IS FOR TESTING PURPOSE ONLY

	/*function donateHandlerCaller()

	{

		alert("donateHandlerCaller is called");

		////if (subtotalvalue == 0)

			////alert("subtotalvalue = to 0");

		alert("now calling donateHandler");

			donateHandler();

		/*else if (subtotalvalue != 0)

			alert("subtotalvalue is not = to 0");

			subtotalvalue = 0;

			donateHandler();

	}*/



	function donateHandler()

	{		

		totalvalue = parseFloat(liveGetValue("total"),10);

		oldvalue = formGetValue("donateprev");

		newvalue = formGetValue("donate");

		/*MORE TESTING
		if(oldvalue == 0)

			alert("oldvalue = 0!");

		else if (oldvalue != 0)

			alert("oldvalue is not = 0");

			oldvalue = formGetValue("donateprev");

			alert(oldvalue);

			alert(newvalue);*/


		

		

		if (newvalue < oldvalue)

		{

			//alert(newvalue);

			liveSetValue("total",toDouble(totalvalue - (oldvalue - newvalue)));

			formSetValue("donateprev", newvalue);

			formSetValue("donate",newvalue);

		}

		else

		{

			if (newvalue == oldvalue) {}

			else

			{

				var change = newvalue - oldvalue;			
//alert(newvalue);
				liveSetValue("total",toDouble(change + totalvalue));

				formSetValue("total",toDouble(change + totalvalue));

				formSetValue("donateprev", change);

				formSetValue("donate",newvalue);

			}

		}

//		liveSetValue("subtotal",toDouble(change + subtotalvalue));

//		formSetValue("subtotal",toDouble(change + subtotalvalue));

		

	}



	function resetValues()

	{
		
		////alert("resetValues is called");

		////subtotalvalue = 0;

		////alert(subtotalvalue);

		/*document.form1.donate.value = 0;

		subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

		totalvalue = parseFloat(liveGetValue("total"),10);

		oldvalue = formGetValue("donateprev");

		newvalue = formGetValue("donate");

		var change = newvalue - oldvalue;

		////liveSetValue("total",toDouble(25));

	////check number of adults and reset to the correct registration fee

		////alert("passed the testings");

		document.form1.subtotal_h.value = liveSetValue("subtotal",toDouble(0 + 0));

		////reseting the package selections

		//alert("entering testings");

		document.form1.cat0people_h.value = liveSetValue("cat0people",(0));

		document.form1.cat0subprice_h.value = liveSetValue("cat0subprice",toDouble(0));

		document.form1.cat1people_h.value = liveSetValue("cat1people",(0));

		document.form1.cat1subprice_h.value = liveSetValue("cat1subprice",toDouble(0));

		document.form1.cat3people_h.value = liveSetValue("cat3people",(0));

		document.form1.cat3subprice_h.value = liveSetValue("cat3subprice", toDouble(0));

		document.form1.cat4people_h.value = liveSetValue("cat4people",(0));

		document.form1.cat4subprice_h.value = liveSetValue("cat4subprice", toDouble(0));

		document.form1.cat6people_h.value = liveSetValue("cat6people",(0));

		document.form1.cat6subprice_h.value = liveSetValue("cat6subprice", toDouble(0));

		document.form1.cat13people_h.value = liveSetValue("cat13people",(0));

		document.form1.cat13subprice_h.value = liveSetValue("cat13subprice",toDouble(0));

		document.form1.cat14people_h.value = liveSetValue("cat14people",(0));

		document.form1.cat14subprice_h.value = liveSetValue("cat14subprice",toDouble(0));
		
		liveSetValue("discount",toDouble(0));
		
		liveSetValue("cost",toDouble(0));

		liveSetValue("total",toDouble(0 + 0));

		formSetValue("donate",newvalue);
		
		formSetValue("donateprev",newvalue);
		
		//reseting childcare values
		formSetValue("child1_name_first",'');
		formSetValue("child2_name_first",'');
		formSetValue("child3_name_first",'');
		formSetValue("child4_name_first",'');

		//alert("end of function");

		/*if (document.form1.guest_name_first.value.length > 0)

		{

			//liveSetValue("subtotal",toDouble(0 + 0));

			liveSetValue("total",toDouble(0));

			liveSetValue("reg_fee",toDouble(0));

		}

		else if (document.form1.guest_name_first.value.length < 1)

		{

			//liveSetValue("subtotal",toDouble(0 + 0));

			liveSetValue("total",toDouble(0));

			liveSetValue("reg_fee",toDouble(0));

		}*/
		
	}



    // function to add the $25 fee for Jim Green's painting

	//it removes the fee when the checkbox is unselected

	function addPaint()

	{

		//before any change,get current values of subtotal and total from the form

		subtotalvalue = parseFloat(liveGetValue("subtotal"));

		totalvalue = parseFloat(liveGetValue("total"));

		

		if (document.form1.checkbox.checked == true)

		{

	       /*newSubtotal = (subtotalvalue + 25.00);

		   liveSetValue("total", toDouble(totalvalue + 25));

		   liveSetValue("subtotal",toDouble(newSubtotal));

		   formSetValue("checkbox",25);*/

		   newSubtotal = (subtotalvalue + 25.00);

		   liveSetValue("subtotal",toDouble(newSubtotal));

		   calcDiscount();

		   discountvalue = parseFloat(liveGetValue("discount"));

		   liveSetValue("total", toDouble(newSubtotal - discountvalue));		   

		   formSetValue("checkbox",25);		   

		}

		else if(document.form1.checkbox.checked == false)

		{

			if (subtotalvalue > 0)

			{

				newSubtotal = (subtotalvalue - 25.00);

				liveSetValue("subtotal",toDouble(newSubtotal));

				calcDiscount();

				discountvalue = parseFloat(liveGetValue("discount"));

				liveSetValue("total", toDouble(newSubtotal - discountvalue));				

				formSetValue("checkbox",0.00);

			}

		}

	}



//*************************************************************************************************************************

	// function to add the $200 fee for the Golf cart

	//it removes the fee when the checkbox is unselected

	function addGolf()

	{

		//before any change,get current values of subtotal and total from the form

		subtotalvalue = parseFloat(liveGetValue("subtotal"));

		totalvalue = parseFloat(liveGetValue("total"));

		if (document.form1.golf.checked == true)

		{

	       newSubtotal = (subtotalvalue + 200.00);

		   liveSetValue("total", toDouble(totalvalue + 200));

		   liveSetValue("subtotal",toDouble(newSubtotal));

		   formSetValue("golf",200);

		}

		else if(document.form1.golf.checked == false)

		{

			newSubtotal = (subtotalvalue - 200.00);

			liveSetValue("total", toDouble(totalvalue - 200));

			liveSetValue("subtotal",toDouble(newSubtotal));

			formSetValue("golf",0.00);

		}

	}//end of addGolf
	
	//function to add $150 for first child
	function addChildcare1()
	{
		
		//before any change,get current values of subtotal and total and childcare from the form		
		subtotalvalue = parseFloat(liveGetValue("subtotal"));
		totalvalue = parseFloat(liveGetValue("total"));
		childcare = parseFloat(liveGetValue("cost"));
		
						
		if(document.getElementById("child1_name_first").value.length == 1 )

		{
			newChildcaretotal = (childcare + 150.00);			
			
			newSubtotal = (subtotalvalue + 150.00);	
			
			liveSetValue("cost",toDouble(newChildcaretotal));	
			
			liveSetValue("total", toDouble(totalvalue + 150));

			liveSetValue("subtotal",toDouble(newSubtotal));		
		}		
				
	}//end of  addChildcare1 function

	
	//function to add $150 for second child
	function addChildcare2()
	{
		//before any change,get current values of subtotal and total and childcare from the form
		
		subtotalvalue = parseFloat(liveGetValue("subtotal"));
		totalvalue = parseFloat(liveGetValue("total"));
		childcare = parseFloat(liveGetValue("cost"));
		
				
		if(document.getElementById("child2_name_first").value.length == 1)
		{
			newChildcaretotal = (childcare + 150.00);			
			
			newSubtotal = (subtotalvalue + 150.00);			
					
			liveSetValue("cost",toDouble(newChildcaretotal));	
			
		   liveSetValue("total", toDouble(totalvalue + 150));

		   liveSetValue("subtotal",toDouble(newSubtotal));
		}
	}//end of addChildcare2
	
	//function to add $150 for third child
	function addChildcare3()
	{
		//before any change,get current values of subtotal and total and childcare from the form
		
		subtotalvalue = parseFloat(liveGetValue("subtotal"));
		totalvalue = parseFloat(liveGetValue("total"));
		childcare = parseFloat(liveGetValue("cost"));
		
		
		if(document.getElementById("child3_name_first").value.length == 1)

		{
			newChildcaretotal = (childcare + 150.00);
			
			newSubtotal = (subtotalvalue + 150.00);			
			
			liveSetValue("cost",toDouble(newChildcaretotal));

			liveSetValue("total", toDouble(totalvalue + 150));

			liveSetValue("subtotal",toDouble(newSubtotal));
		}
		
	}//end of  addChildcare3 function
	
	//function to add $150 for fourth child
	function addChildcare4()
	{
		//before any change,get current values of subtotal and total and childcare from the form
		
		subtotalvalue = parseFloat(liveGetValue("subtotal"));
		totalvalue = parseFloat(liveGetValue("total"));
		childcare = parseFloat(liveGetValue("cost"));
		 
		
		if(document.getElementById("child4_name_first").value.length == 1)

		{
			newChildcaretotal = (childcare + 150.00);
			
			newSubtotal = (subtotalvalue + 150.00);			
					
			liveSetValue("cost",toDouble(newChildcaretotal));
			
			liveSetValue("total", toDouble(totalvalue + 150));

			liveSetValue("subtotal",toDouble(newSubtotal));		
		}
		
	}//end of  addChildcare4 function
	
		

	function addHandler (catid)

	{

		subtotalvalue = parseFloat(liveGetValue("subtotal"),10);
				
		totalvalue = parseFloat(liveGetValue("total"),10);

		subpriceidtag = "cat" + catid + "subprice";

		priceidtag = "cat" + catid + "price";

		peopleidtag = "cat" + catid + "people";

		num_people = parseFloat(liveGetValue(peopleidtag),10);

		// code to handle $20 for first, $10 for each additional on category 8

		// code to handle $35 for first, $12 for each additional on category 9

		/*if (catid == 8 && num_people > 0)

		{

			num_price = parseFloat(10.00,10);

			newvalue = num_price * (num_people+2);

		}

		else if (catid == 9 && num_people > 0)

		{

			num_price = parseFloat(12.00,10);

			newvalue = num_price * (num_people+3) - 1;

		}

		else

		{*/

			num_price = parseFloat(liveGetValue(priceidtag),10);

			newvalue = num_price * (num_people+1);

		//}



		liveSetValue("total",toDouble(totalvalue+num_price));

		liveSetValue("subtotal",toDouble(subtotalvalue+num_price));

		liveSetValue(subpriceidtag,toDouble(newvalue));

		liveSetValue(peopleidtag,(num_people+1));

		calcDiscount();

	}



	function subtractHandler (catid)

	{

		subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

		totalvalue = parseFloat(liveGetValue("total"),10);

		subpriceidtag = "cat" + catid + "subprice";

		priceidtag = "cat" + catid + "price";

		peopleidtag = "cat" + catid + "people";

		num_people = parseFloat(liveGetValue(peopleidtag),10);

		if(num_people > 0)

		{

			// code to handle $20 for first, $10 for each additional on category 8

			// code to handle $35 for first, $12 for each additional on category 9

			if (catid == 8 && num_people > 1)

			{

				num_price = parseFloat(10.00,10);

				newvalue = num_price * (num_people);

			}

			else if (catid == 9 && num_people > 1)

			{

				num_price = parseFloat(12.00,10);

				newvalue = num_price * (num_people+1) - 1;

			}

			else

			{

				num_price = parseFloat(liveGetValue(priceidtag),10);

				newvalue = num_price * (num_people-1);

			}

			liveSetValue("total",toDouble(totalvalue-num_price));

			liveSetValue("subtotal",toDouble(subtotalvalue-num_price));

			liveSetValue(subpriceidtag,toDouble(newvalue));

			liveSetValue(peopleidtag,(num_people-1));

		}
		calcDiscount();
	}



	function houseOption(RmType, catid)

	{

		SingleRmUpcharge = 0;

		if (RmType == "single")
		{
			peopleidtag = "cat" + catid + "people";

			num_people = parseFloat(liveGetValue(peopleidtag),10);

			SingleRmUpcharge = num_people * 100;
			
			formSetValue("singleRoomUpCharge", SingleRmUpcharge);	
			
			subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

			liveSetValue("subtotal",toDouble(subtotalvalue + SingleRmUpcharge));

			totalvalue = parseFloat(liveGetValue("total"),10);

			liveSetValue("total",toDouble(totalvalue + SingleRmUpcharge));		
		}
		
		if (RmType == "double" || RmType == "triple" || RmType == "quad")
		{
			//alert (RmType);
			UpCharge = parseFloat(formGetValue("singleRoomUpCharge"),10);
			//alert (UpCharge);
			if (UpCharge > 0)
			{
				subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

				liveSetValue("subtotal",toDouble(subtotalvalue - UpCharge));
				
				totalvalue = parseFloat(liveGetValue("total"));				
				
				liveSetValue("total",toDouble(totalvalue - UpCharge));
				
				formSetValue("singleRoomUpCharge", 0);	
			}
		}		

	}

	

	function disable(elemId, catid)

	{

		if (elemId == 'single' && catid == 4)

		{	

			document.form1.housingOption[0].checked=false;

			document.form1.housingOption[0].disabled=true;			

		}

		else if (elemId == 'single' && catid == 3)

		{

			peopleidtag = "cat" + catid + "people";

			num_people = parseFloat(liveGetValue(peopleidtag),10);

			

			if (num_people > 1)

			{

				document.form1.housingOption[0].checked=false;

				document.form1.housingOption[0].disabled=true;
				
				UpCharge = parseFloat(formGetValue("singleRoomUpCharge"),10);
				
				subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

				liveSetValue("subtotal",toDouble(subtotalvalue - UpCharge));
				
				totalvalue = parseFloat(liveGetValue("total"));				
				
				liveSetValue("total",toDouble(totalvalue - UpCharge));

				formSetValue("singleRoomUpCharge", 0);

			}

			else if (num_people < 2)

			{

				document.form1.housingOption[0].checked=false;

				document.form1.housingOption[0].disabled=false;

			}	

		}

		else

		{

			document.form1.housingOption[0].disabled=false;

		}

	}

		

	function switchDiv(div_id)

	{

	  var style_sheet = getStyleObject(div_id);

	  if (style_sheet)

	  {

		hideAll();

		changeObjectVisibility(div_id, "visible");		

	  }

	  else 

	  {

		alert("sorry, this only works in browsers that do Dynamic HTML");

	  }

	}

	

	function getStyleObject(objectId) 

	{

	  // checkW3C DOM, then MSIE 4, then NN 4.

	  //

	  if(document.getElementById && document.getElementById(objectId)) {

		return document.getElementById(objectId).style;

	   }

	   else if (document.all && document.all(objectId)) {  

		return document.all(objectId).style;

	   } 

	   else if (document.layers && document.layers[objectId]) { 

		return document.layers[objectId];

	   } else {

		return false;

	   }

	}

	

	function changeObjectVisibility(objectId, newVisibility) 

	{

		// first get the object's stylesheet

		var styleObject = getStyleObject(objectId);

	

		// then if we find a stylesheet, set its visibility

		// as requested

		//

		if (styleObject) {

		styleObject.visibility = newVisibility;

		return true;

		} else {

		return false;

		}

	}

	

	function hideAll()

	{

	   changeObjectVisibility("fullPackage","hidden");

	   changeObjectVisibility("perDay","hidden");		   

	}



	function calcDiscount ()

	{

		//BeforeDiscountAmt = total - contribution

		subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

		discountvalue = parseFloat(liveGetValue("discount"),10);
		
		donationvalue = parseFloat(formGetValue("donate"));		

		//regfeevalue = parseFloat(liveGetValue("reg_fee"),10);

		totalvalue = parseFloat(liveGetValue("total"),10);

		if (document.form1.member_discount.selectedIndex == 1)	

		{	

			newsub = (subtotalvalue * 1 * .1);

			//newtotal = (subtotalvalue + (newsub) + regfeevalue);

            newtotal = (subtotalvalue + donationvalue - newsub);			

			liveSetValue("discount",toDouble(newsub));

			liveSetValue("total",toDouble(newtotal));

		}	

		else

		{

			//newtotal = (subtotalvalue + regfeevalue);

		    newtotal = (subtotalvalue  + donationvalue);

			liveSetValue("discount",toDouble(0));

			liveSetValue("total",toDouble(newtotal));

		}

	}





	/*function addRegFee()

	{

		if (document.form1.guest_name_first.value.length > 0)

		{

			subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

			newtotal = (subtotalvalue + 0);

			liveSetValue("total",toDouble(newtotal));

			liveSetValue("reg_fee",toDouble(0));

		}

		else if (document.form1.guest_name_first.value.length < 1)

			subtotalvalue = parseFloat(liveGetValue("subtotal"),10);

			newtotal = (subtotalvalue + 0);

			liveSetValue("total",toDouble(newtotal));

			liveSetValue("reg_fee",toDouble(0));

		}

	}*/



	function validateForm()

	{

		var strMessage = '';

		// first name

		if (document.form1.member_name_first.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your first name.\n";

		}

		// last name

		if (document.form1.member_name_last.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your last name.\n";

		}

		// address line 1

		if (document.form1.member_address_line1.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your street address.\n";

		}

		// city

		if (document.form1.member_city.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your city.\n";

		}

		// state

		if (document.form1.member_state.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your state / province.\n";

		}

		// zip

		if (document.form1.member_zip.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your zip / postal code.\n";

		}

		// country

		if (document.form1.member_country.selectedIndex.length == 0) 

		{

			strMessage = strMessage + "Please select your country.\n";

		}

		// phone

		if (document.form1.member_phone.value.length < 1) 

		{

			strMessage = strMessage + "Please enter your telephone number.\n";

		}

		// you may wish to add more checking, but this should do for now.

		document.form1.cat0desc_h.value = liveGetValue("cat0desc");

		document.form1.cat0price_h.value = liveGetValue("cat0price");

		document.form1.cat0people_h.value = liveGetValue("cat0people");

		document.form1.cat0subprice_h.value = liveGetValue("cat0subprice");

		document.form1.cat1desc_h.value = liveGetValue("cat1desc");

		document.form1.cat1price_h.value = liveGetValue("cat1price");

		document.form1.cat1people_h.value = liveGetValue("cat1people");

		document.form1.cat1subprice_h.value = liveGetValue("cat1subprice");

		document.form1.cat3desc_h.value = liveGetValue("cat3desc");

		document.form1.cat3price_h.value = liveGetValue("cat3price");

		document.form1.cat3people_h.value = liveGetValue("cat3people");

		document.form1.cat3subprice_h.value = liveGetValue("cat3subprice");

		document.form1.cat4desc_h.value = liveGetValue("cat4desc");

		document.form1.cat4price_h.value = liveGetValue("cat4price");

		document.form1.cat4people_h.value = liveGetValue("cat4people");

		document.form1.cat4subprice_h.value = liveGetValue("cat4subprice");

		document.form1.cat6desc_h.value = liveGetValue("cat6desc");

		document.form1.cat6price_h.value = liveGetValue("cat6price");

		document.form1.cat6people_h.value = liveGetValue("cat6people");

		document.form1.cat6subprice_h.value = liveGetValue("cat6subprice");

		document.form1.cat13desc_h.value = liveGetValue("cat13desc");

		document.form1.cat13price_h.value = liveGetValue("cat13price");

		document.form1.cat13people_h.value = liveGetValue("cat13people");

		document.form1.cat13subprice_h.value = liveGetValue("cat13subprice");

		document.form1.cat14desc_h.value = liveGetValue("cat14desc");

		document.form1.cat14price_h.value = liveGetValue("cat14price");

		document.form1.cat14people_h.value = liveGetValue("cat14people");

		document.form1.cat14subprice_h.value = liveGetValue("cat14subprice");		
		
		document.form1.subtotal_h.value = liveGetValue("subtotal");

		document.form1.discount_h.value = liveGetValue("discount");

		document.form1.total_h.value = liveGetValue("total");
		
		document.form1.cost_h.value = liveGetValue("cost");

		if (strMessage.length < 1)

		{

			return(true);

		}

		else

		{

			var strAddendum;

			strAddendum = "There were problems with your submission...\n";

			strAddendum = strAddendum + "correct the following and submit the form again:\n\n\n";

			strMessage = strAddendum + strMessage;

			alert(strMessage);

			return(false);

		}

	}



	function pick(obj,color) { obj.style.backgroundColor=color; return true; }

	function unpick(obj,color) { obj.style.backgroundColor=color; return true; }