Trying to apply a discount to the calculate function. I can't seem to get the function to work when adding the function I have started to make with a if else layout comparing the form fields with an if statement giving the discount value. Any help would be great.

Code:
/*
This source is shared under the terms of LGPL 3
www.gnu.org/licenses/lgpl.html

You are free to use the code in Commercial or non-commercial projects
*/
 var papersize_prices = new Array();
 papersize_prices["6.25x9"]=.25;
 papersize_prices["6.25x11"]=.33;
 papersize_prices["4x12"]=.25;
 papersize_prices["8.5x7"]=.50;
 papersize_prices["8.5x11"]=.50;
 papersize_prices["12x15"]=1;
 


 //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["100"]=100;
 cake_prices["250"]=250;
 cake_prices["500"]=500;
 cake_prices["1000"]=1000;
 cake_prices["2000"]=2000;
 cake_prices["5000"]=5000;
 cake_prices["7000"]=7000;
 cake_prices["10000"]=10000;
 cake_prices["15000"]=15000;
 cake_prices["20000"]=20000;
 cake_prices["30000"]=30000;
 cake_prices["50000"]=50000;
  
 
 //Set up an associative array 
 //The keys represent the filling type
 //The value represents the cost of the filling i.e. Lemon filling is $5,Dobash filling is $9
 //We use this this array when the user selects a filling from the form
 var filling_prices= new Array();
 filling_prices["None"]=0;
 filling_prices["80lb_Cover"]=1;
 filling_prices["100lb_Cover"]=2;
 filling_prices["120lb_Cover"]=3;
 filling_prices["80lb_Gloss/Matted"]=4;
 filling_prices["100lb_Gloss/Matted"]=5;
 filling_prices["120lb_Gloss/Matted"]=6;
 
 var mail_prices= new Array();
 mail_prices["None"]=0;
 mail_prices["EDDMREADY"]=10;
 
 
 

function getCakeSizePrice()
{
    var cakeSizePrice=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the select id="qty"
     var selectedCake = theForm.elements["selectedcake"];
     
    //set cakeFilling Price equal to value user chose
    //For example filling_prices["Lemon".value] would be equal to 5
	cakeSizePrice = cake_prices[selectedCake.value];
    //finally we return cakeFillingPrice
    return cakeSizePrice;
}

function getPaperSizePrice()
{
    var paperSizePrice=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the select id="qty"
     var selectedPaper = theForm.elements["PaperSize"];
     
    //set cakeFilling Price equal to value user chose
    //For example filling_prices["Lemon".value] would be equal to 5
	paperSizePrice = papersize_prices[selectedPaper.value];
    //finally we return cakeFillingPrice
    return paperSizePrice;
}

function getdiscount()
{
 var discount = 0;
 var selectedPaperSize = theForm.elements["PaperSize"];
 paperSizePrice = papersize_prices[selectedPaperSize.value];
 var selectedCake = theForm.elements["selectedcake"];
 cakeSizePrice = cake_prices[selectedCake.value];
 var selectedFilling = theForm.elements["filling"];
 cakeFillingPrice = filling_prices[selectedFilling.value];
 
 if (paperSizePrice ="500")
 {
	 if (cakeSizePrice="6.25x9")
	 {
		 if (cakeFillingPrice="80lb_Cover")
		 discount =".20";
	 }
 return discount;
 }
}
//This function finds the filling price based on the 
//drop down selection
function getFillingPrice()
{
    var cakeFillingPrice=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the select id="filling"
     var selectedFilling = theForm.elements["filling"];
     
    //set cakeFilling Price equal to value user chose

    cakeFillingPrice = filling_prices[selectedFilling.value];

    //finally we return cakeFillingPrice
    return cakeFillingPrice;
}

function getoption1price()
{
    var option1price=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the select id="option1"
     var option1price = theForm.elements["mail"];
     
    //set cakeFilling Price equal to value user chose
    //For example filling_prices["Lemon".value] would be equal to 5
	option1price = mail_prices[option1price.value];
    //finally we return cakeFillingPrice
    return option1price;
}

//candlesPrice() finds the candles price based on a check box selection
function candlesPrice()
{
    var candlePrice=0;
    //Get a reference to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the checkbox id="includecandles"
    var includeCandles = theForm.elements["includecandles"];

    //If they checked the box set candlePrice to 5
    if(includeCandles.checked==true)
    {
        candlePrice=5;
    }
    //finally we return the candlePrice
    return candlePrice;
}

function insciptionPrice()
{
    //This local variable will be used to decide whether or not to charge for the inscription
    //If the user checked the box this value will be 20
    //otherwise it will remain at 0
    var inscriptionPrice=0;
    //Get a refernce to the form id="cakeform"
    var theForm = document.forms["cakeform"];
    //Get a reference to the checkbox id="includeinscription"
    var includeInscription = theForm.elements["includeinscription"];
    //If they checked the box set inscriptionPrice to 20
    if(includeInscription.checked==true){
        inscriptionPrice=20;
    }
 
    return inscriptionPrice;
}
        
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 = getPaperSizePrice() * getCakeSizePrice() * getFillingPrice() + candlesPrice() + insciptionPrice() + getoption1price();

    
    //display the result
    var divobj = document.getElementById('totalPrice');
    divobj.style.display='block';
    divobj.innerHTML = "Total Price For the Order $"+cakePrice;

}

function hideTotal()
{
    var divobj = document.getElementById('totalPrice');
    divobj.style.display='none';
}

Form page