function addItem(itemId,price)
	{
	var itemQty = itemId + '_qty';
	document.getElementById(itemQty).innerHTML = parseFloat(document.getElementById(itemQty).innerHTML) + 1;
	document.getElementById(itemId).innerHTML = '$' + formatNumber(parseFloat(document.getElementById(itemQty).innerHTML) * price,2)
	}

 function subItem(itemId,price)
	{
	var itemQty = itemId + '_qty';
	if (document.getElementById(itemQty).innerHTML > 0)
	 {
	 document.getElementById(itemQty).innerHTML = parseFloat(document.getElementById(itemQty).innerHTML) - 1;
	 document.getElementById(itemId).innerHTML = '$' + formatNumber(parseFloat(document.getElementById(itemQty).innerHTML) * price,2)
	 }
	}

 function paypalPayNow()
	{
	itemId=new Array('mem_reg_fee','non-mem_reg_fee','raptors','compete','bradfield','ute_mtn','lake','bird_manage','bluff','wild_horse','mesa_verde','bike_bird','bluebird','denny_lake','yellow_jacket','mcelmo','wildflower','raft_trip','swifts');
	itemDescription=new Array('2009 Birding Festival Registration (Member)','2009 Birding Festival Registration (Non-member)','Raptors Tour - Thursday','Competitive Birding Event - Thursday','Bradfield Bridge Tour - Friday','Ute Mountain Tribal Park Tour - Friday','Lake Tour - Friday','Bird Management Tour - Friday','Bluff Overnight Tour - Friday','Wild Horses of Disappointment Valley - Saturday','Mesa Verde National Park - Saturday','Bike and Bird Lower Dolores - Saturday','Bluebird walk - Saturday','Denny Lake for Kids - Saturday','Yellow Jacket/Lucys Warbler - Sunday','McElmo Canyon and Winetasting - Sunday','Wildflower Walk at Sand Canyon - Sunday','Half-day Raft Trip on the Dolores River - Sunday','Swifts and Swallows - Sunday');
	itemPrice=new Array(40.5,45,25,15,35,65,25,35,90,35,50,25,15,5,35,35,25,45,25);
	ppList='';
	numberItems=1;
	n=0;
	while(n<19)
	 {
	 if(document.getElementById(itemId[n] + '_qty').innerHTML > 0)
		{
		ppList=ppList + '&item_name_' + numberItems + '=' + itemDescription[n] + '&amount_' + numberItems + '=' + itemPrice[n] + '&quantity_' + numberItems + '=' + document.getElementById(itemId[n] + '_qty').innerHTML + '&shipping_' + numberItems + '=0.00' + '&handling_' + numberItems + '=0.00';
		numberItems++;
		}
	 n++;
	 }
	if (window.ppWin && !window.ppWin.closed)
	 {
	 ppWin.location='https://www.paypal.com/cgi-bin/webscr?upload=1&cmd=_cart&business=info%40cortezculturalcenter.org&' + ppList + '&no_shipping=1&no_note=1&currency_code=USD&lc=US&bn=PP-ShopCartBF';
	 ppWin.focus();
	 return false;
	 }
	else
	 {
	 ppWin = window.open('https://www.paypal.com/cgi-bin/webscr?upload=1&cmd=_cart&business=info%40cortezculturalcenter.org&' + ppList + '&no_shipping=1&no_note=1&currency_code=USD&lc=US&bn=PP-ShopCartBF','ppWin','width=900,height=500,scrollbars,resizable,dependent');
	 return false;
	 }
	}

 function formatNumber(expr, decimals)
	{
	var str = "" + Math.round( eval(expr) * Math.pow(10,decimals))
	while (str.length <= decimals) { str = "0" + str }
	var decpoint = str.length - decimals;
	var result = str.substring(0,decpoint);
	if (decimals) result += "." + str.substring(decpoint,str.length);
	return result;
	}

 function computeTotal()
	{
	itemId=new Array('mem_reg_fee','non-mem_reg_fee','raptors','compete','bradfield','ute_mtn','lake','bird_manage','bluff','wild_horse','mesa_verde','bike_bird','bluebird','denny_lake','yellow_jacket','mcelmo','wildflower','raft_trip','swifts');
	itemPrice=new Array(40.5,45,25,15,35,65,25,35,90,35,50,25,15,5,35,35,25,45,25);
 tempValue=0;
	n=0;
	while(n<19)
	 {
	 tempValue += (parseFloat(document.getElementById(itemId[n] + '_qty').innerHTML) * itemPrice[n]);
	 n++;
  }
	document.getElementById('total').innerHTML='$' + formatNumber(tempValue,2);
 document.getElementById('reg_fee_qty').innerHTML=parseFloat(document.getElementById('mem_reg_fee_qty').innerHTML) + parseFloat(document.getElementById('non-mem_reg_fee_qty').innerHTML);
 document.getElementById('dinner_qty').innerHTML=parseFloat(document.getElementById('mem_reg_fee_qty').innerHTML) + parseFloat(document.getElementById('non-mem_reg_fee_qty').innerHTML);
	}

 function checkParent(thePage)
	{
	if (self == top)
	 {
	 self.location = "index.cgi?main=" + thePage;
	 }
	else
	 {
	 boxnoteSwap('PROGRAMS &rsaquo;&rsaquo; ANNUAL EVENTS &rsaquo;&rsaquo; BIRDING FESTIVAL');
	 boxnoteBookmark(thePage);
	 parent.document.title = document.title;
	 parent.frames['menu'].expandOnly('menu2','button2');
	 parent.frames['menu'].expandOnly('menu2_1','button2_1');
	 computeTotal();
	 }
	}