<!-- Script hiding comment
// has input been entered by user?
var acnt = 0;
function notempty(inputStr) {
    if (inputStr == "" || inputStr == null) {
 return false
    }
    return true
}

// has input been entered by user?
function empty(inputStr) {
    if (inputStr == "" || inputStr == null) {
 return true
    }
    return false
}
//***************** Add Button Script*****************************
// Add quantity, description, and price to the order form, convert
// numeric string values to numbers
function AddOrderEntry (AddedEntry){
 var gotAddition = AddedEntry.name;
 switch (gotAddition)
 {
  case "AddTPD_090A":
  {
   OrderForm.PN[acnt].value = "G90";
   OrderForm.TITLE[acnt].value = "Domestic External Oven";
   OrderForm.QTY[acnt].value = selectform.TPD_090A.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPD_090B":
  {
   OrderForm.PN[acnt].value = "G90-BBQ";
   OrderForm.TITLE[acnt].value = "Domestic External Oven with BBQ";
   OrderForm.QTY[acnt].value = selectform.TPD_090B.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPD_090C":
  {
   OrderForm.PN[acnt].value = "G90-INTE";
   OrderForm.TITLE[acnt].value = "Domestic Internal Oven";
   OrderForm.QTY[acnt].value = selectform.TPD_090C.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPD_085":
  {
   OrderForm.PN[acnt].value = "GP85";
   OrderForm.TITLE[acnt].value = "Domestic Indirect-fired Wood Oven";
   OrderForm.QTY[acnt].value = selectform.TPD_085.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPC_1140":
  {
   OrderForm.PN[acnt].value = "Model-1100";
   OrderForm.TITLE[acnt].value = "Commercial Oven - Model-1100";
   OrderForm.QTY[acnt].value = selectform.TPC_1140.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPC_1300":
  {
   OrderForm.PN[acnt].value = "Model-1300";
   OrderForm.TITLE[acnt].value = "Commercial Oven - Model-1300";
   OrderForm.QTY[acnt].value = selectform.TPC_1300.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPC_1500":
  {
   OrderForm.PN[acnt].value = "Model-1540";
   OrderForm.TITLE[acnt].value = "Commercial Oven - Model-1540";
   OrderForm.QTY[acnt].value = selectform.TPC_1500.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddTPC_1800":
  {
   OrderForm.PN[acnt].value = "Model-1800";
   OrderForm.TITLE[acnt].value = "Commercial Oven - Model-1800";
   OrderForm.QTY[acnt].value = selectform.TPC_1800.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddGasBurner":
  {
   OrderForm.PN[acnt].value = "Gas Burner";
   OrderForm.TITLE[acnt].value = "Gas Burner";
   OrderForm.QTY[acnt].value = selectform.GasBurner.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddCommercialStand":
  {
   OrderForm.PN[acnt].value = "CS";
   OrderForm.TITLE[acnt].value = "Stand for Commercial Oven";
   OrderForm.QTY[acnt].value = selectform.CommercialStand.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddDomesticStand":
  {
   OrderForm.PN[acnt].value = "DS";
   OrderForm.TITLE[acnt].value = "Stand for Domestic Oven";
   OrderForm.QTY[acnt].value = selectform.DomesticStand.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddGranite":
  {
   OrderForm.PN[acnt].value = "Granite";
   OrderForm.TITLE[acnt].value = "Granite 110 x 35cm";
   OrderForm.QTY[acnt].value = selectform.Granite.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddDownDraft":
  {
   OrderForm.PN[acnt].value = "DD";
   OrderForm.TITLE[acnt].value = "Down Draft";
   OrderForm.QTY[acnt].value = selectform.DownDraft.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddPaddle_35":
  {
   OrderForm.PN[acnt].value = "PP-35";
   OrderForm.TITLE[acnt].value = "Pizza Paddle 35cm";
   OrderForm.QTY[acnt].value = selectform.Paddle_35.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddPaddle_180C":
  {
   OrderForm.PN[acnt].value = "PP-180C";
   OrderForm.TITLE[acnt].value = "Pizza Paddle 180 Cooking";
   OrderForm.QTY[acnt].value = selectform.Paddle_180C.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddPaddle_180B":
  {
   OrderForm.PN[acnt].value = "PP-180B";
   OrderForm.TITLE[acnt].value = "Pizza Paddle 180 Baking";
   OrderForm.QTY[acnt].value = selectform.Paddle_180B.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddBrush":
  {
   OrderForm.PN[acnt].value = "LB";
   OrderForm.TITLE[acnt].value = "Lilly Brush";
   OrderForm.QTY[acnt].value = selectform.Brush.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;
  case "AddKnife":
  {
   OrderForm.PN[acnt].value = "LPK";
   OrderForm.TITLE[acnt].value = "Lilly Pizza Knife";
   OrderForm.QTY[acnt].value = selectform.Knife.value;
   OrderForm.PRICE[acnt].value = "0";
  }break;


  default:
   alert("Switch Statement Broken or Invalid Selection - Error 002");
 } //End Switch (gotAddition)
 if(++acnt == 17)
    acnt = 0;
}//End AddOrderEntry()

/*********************************  End Add Item Module *********************************/
 
 
// Round a floating point number to the correct value, and convert
// it to a string
function PrintNumber(InNum){
        var dollars = Math.round(InNum * 100);
        var pennies = (dollars % 10);
        dollars = Math.round((dollars - pennies)/10);
        var dimes = dollars % 10;
        dollars = Math.round((dollars - dimes)/10);
        return(dollars + "." + dimes + pennies);
}

//Get a subtotal for an item. Input consists of two strings containing 
//price and quantity. The function returns the sum of the two.
function subtotal(quantity,price){
    if (notempty(quantity) && notempty(price)) {
        var subtotal = parseFloat(quantity) * parseFloat(price);
    } 
    else {
        var subtotal = 0;
   }
   return subtotal;
}
/************************* Modified to include 17 table entries **************************************/
//Calculates the total cost of the order, and writes it out to the appropriate
//place in the form.
function totalorder(){
   var lpcnt = 0;
   var tmpbuffGtot = 0;
   var totalbuff = 0;
   with (document.OrderForm){
   for(lpcnt = 0;lpcnt < 10;lpcnt++){
     totalbuff = subtotal(QTY[lpcnt].value,PRICE[lpcnt].value);
     GRANDTOT.value = GRANDTOT.value + totalbuff;
       if(totalbuff != "0"){
         TOTAL[lpcnt].value = PrintNumber(totalbuff);
       }
       else{
         TOTAL[lpcnt].value = "";
       }
     tmpbuffGtot = tmpbuffGtot + totalbuff;
     
   }//end For
     GRANDTOT.value = PrintNumber(tmpbuffGtot);
  }// end With 
}//end Function

/******************************************************************************************************/
//Used when the form is submitted to see whether the e-mail and phone number
//fields have information. If they don't, it prints out a warning and does not
//submit the form.
function requireinput(CheckForm){
    if (empty(CheckForm.email.value) || empty(CheckForm.phonenum.value)) {
        var alertmsg = "You must include an e-mail address and phone number.\nPlease make sure that you have provided this information before\nsubmitting your order.";
        alert(alertmsg);
    }
    else {
        CheckForm.submit()
    }
}
// Close out the script -->