var $il=function(id) {
	return document.getElementById(id);
}



var updatePrice=function() {

	what=arguments[0]
	var total=0;
	total+=computeSaturdayWorkingStudent();
	total+=computeSaturdayBanquet();
	total+=sponsorAStudent();
	total+=fridayLuncheon();
	//total+=fridayDinner();
	total+=act48();
	total+=HD3();
	total+=AD2();
	//total+=ad1price(what);
	total+=conventionFee();
	//total+=updateGuestFee();
	total+=computeGuestFee();
	$il('amount').value="$"+total+".00";
}

var computeSaturdayWorkingStudent=function() {
    var total=$il('Saturday_Night_Banquet2').value;  
    return total*20;
}
var computeSaturdayBanquet=function() {
    var total=$il('Saturday_Night_Banquet').value;
    return total*45;
}
var sponsorAStudent=function() {
    var total=$il('Sponsor_a_Student').value;
    return total*25;
}
var fridayLuncheon=function() {
    var total=$il('Friday_Luncheon').value;
    return total*20;
}
var fridayDinner=function() {
    var total=$il('Friday_Luncheon2').value;
    return total*40;
}

var HD3=function() {
    var checkBoxEl=$il('HD3');
    if(checkBoxEl.checked)
		return 40;
	else
		return 0;
}
var AD2=function() {
    var checkBoxEl=$il('AD2');
    if(checkBoxEl.checked)
		return 80;
	else
		return 0;
}

var act48=function() {
	var checkBoxEl=$il('ACT48');
	if(checkBoxEl.checked)
		return 10;
	else
		return 0;
}

var ad1price=function(what)
{
   var student=$il('AD1Student');
   var teacher=$il('AD1Teacher');
   var retVal=0;
   if(what=="teacher"&&teacher.checked)
   {
   	student.checked=false;
   	retVal=36   }
   if(what=="student"&&student.checked)
   {
   
   	teacher.checked=false;   	
   	retVal= 12;
   }
   else if(teacher.checked)
   {
   	retVal=36   }
   else if(student.checked)
   {
   	retVal= 12;
   }
   return retVal;
}

var conventionPrices=new Array();
conventionPrices[1]=120;
conventionPrices[2]=95;
conventionPrices[3]=60;
conventionPrices[4]=65;
conventionPrices[5]=50;
conventionPrices[6]=35;
conventionPrices[7]=20;
conventionPrices[8]=40;
conventionPrices[9]=160;
conventionPrices[10]=135;
conventionPrices[11]=100;
conventionPrices[12]=75;
conventionPrices[13]=60;
conventionPrices[14]=45;
var conventionFee=function() 
{
   var convention=$il('Registration');
   var ind=convention.options[convention.selectedIndex].value;
   if(conventionPrices[ind])
   		return conventionPrices[ind];
   else
   	return 0;
}

var updateGuestFee=function()
{
	var guests=$il('Guest');
	if(guests.value)
		return 30;
	else
		return 0;
}

var computeGuestFee=function() {
    var total=$il('NumberGuests').value;  
    return total*30;
}
   

