 //Set up an associative array
 //The keys represent the size of the cake
 //The values represent the cost of the cake i.e A 10" cake cost's $35
 var cake_prices = new Array();
 cake_prices["Student"]=0;
 cake_prices["Unpaid Practitioner"]=0;
 cake_prices["Friend"]=0;
 cake_prices["Paid Practictioner"]=0;
 cake_prices["Lifetime"]=0;
 cake_prices["NOT a member"]=0;
 cake_prices["JOINING as Student"]=25;
 cake_prices["JOINING as Unpaid Practitioner"]=35;
 cake_prices["JOINING as Friend"]=65;
 cake_prices["JOINING as Paid Practitioner"]=85;
 cake_prices["JOINING as Lifetime"]=1500;
 

 //Set up an associative array
 //The keys represent the size of the cake
 //The values represent the cost of the cake i.e A 10" cake cost's $35
 var reg_prices = new Array();
 reg_prices["2 Day Paid Prac"]=235;
 reg_prices["1 Day Paid Prac"]=158;
 reg_prices["2 Day Unpaid Prac/Student"]=133;
 reg_prices["1 Day Unpaid Prac/Student"]=87;
 reg_prices["2 Day Nonmember"]=295;
 reg_prices["1 Day Nonmember"]=195;
 reg_prices["2 Day Volunteer"]=95;
 reg_prices["1 Day Volunteer"]=50;
 reg_prices["2 Day Presenter (Paid Prac)"]=212;
 reg_prices["1 Day Presenter (Paid Prac)"]=126;
 reg_prices["2 day Presenter (Unpaid Prac)"]=120;
 reg_prices["1 day Presenter (Unpaid Prac)"]=70;
 reg_prices["2 day Presenter (non-member)"]=266;
 reg_prices["1 day Presenter (non-member)"]=156;
 reg_prices["2 Day Group Disc (Paid Prac)"]=212;
 reg_prices["1 Day Group Disc (Paid Prac)"]=142;
 reg_prices["2 Day Group Disc (Unpaid/Student)"]=120;
 reg_prices["1 Day Group Disc (Unpaid/Student)"]=78;
 reg_prices["2 Day Group Disc (Nonmember)"]=266;
 reg_prices["1 Day Group Disc (Nonmember)"]=176;
 


	 
	 
// getCakeSizePrice() finds the price based on the size of the cake.
// Here, we need to take user's the selection from radio button selection
function getRegPrice()
{  
    var regPrice=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the cake the user Chooses name=selectedCake":
    var selectedReg = theForm.elements["feebase"];
    //Here since there are 4 radio buttons selectedCake.length = 4
    //We loop through each radio buttons
    for(var i = 0; i < selectedReg.length; i++)
    {
        //if the radio button is checked
        if(selectedReg[i].checked)
        {
            //we set cakeSizePrice to the value of the selected radio button
            //i.e. if the user choose the 8" cake we set it to 25
            //by using the cake_prices array
            //We get the selected Items value
            //For example cake_prices["Round8".value]"
            regPrice = reg_prices[selectedReg[i].value];
            //If we get a match then we break out of this loop
            //No reason to continue if we get a match
            break;
        }
    }
    //We return the cakeSizePrice
    return regPrice;
}

 
	 
	 
// getCakeSizePrice() finds the price based on the size of the cake.
// Here, we need to take user's the selection from radio button selection
function getCakeSizePrice()
{  
    var cakeSizePrice=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the cake the user Chooses name=selectedCake":
    var selectedCake = theForm.elements["omamembership"];
    //Here since there are 4 radio buttons selectedCake.length = 4
    //We loop through each radio buttons
    for(var i = 0; i < selectedCake.length; i++)
    {
        //if the radio button is checked
        if(selectedCake[i].checked)
        {
            //we set cakeSizePrice to the value of the selected radio button
            //i.e. if the user choose the 8" cake we set it to 25
            //by using the cake_prices array
            //We get the selected Items value
            //For example cake_prices["Round8".value]"
            cakeSizePrice = cake_prices[selectedCake[i].value];
            //If we get a match then we break out of this loop
            //No reason to continue if we get a match
            break;
        }
    }
    //We return the cakeSizePrice
    return cakeSizePrice;
}


        
function calculateTotal()
{
    //Here we get the total price by calling our function
    //Each function returns a number so by calling them we add the values they return together
    var cakePrice = getCakeSizePrice() + getRegPrice()
	document.cakeform.paymentamount.value = cakePrice;
    
    //display the result
    var divobj = document.getElementById('totalPrice');
    //divobj.style.display='block';
    //divobj.innerHTML = "Total Cost of Registration $"+cakePrice;

	



}

//function hideTotal()
//{
//    var divobj = document.getElementById('totalPrice');
//    divobj.style.display='none';
//}
