  function calcTotal() {
  var subTotal = 0.00;
  var itemCount = 0;
  var icnt = "";
  var desc ="Mealformation - ";
  var fval;
  var dscVal = 0.00;
  var calcDsc = 0.00;



        //Check for discount code
        //if (document.pickproduct.dscCode.value == "NEWDISCHTG" )
          // dscVal = 0.25;

        // check for numeric values
        for (x=0; x<2; x++) {
                if (document.pickproduct.elements[x].checked) {
                        fVal = parseFloat(document.pickproduct.elements[(x)+1].value);
                        if (isNaN(fVal)) {
                                alert("You can only use numbers in the quantity fields. Please review your quantities.");
                                return;
                        }
                }
        }
        //Recipe Manager
        if (document.pickproduct.mfrecm.value > 0) {
           document.pickproduct.mfrecm.value = Math.ceil(document.pickproduct.mfrecm.value);
           subTotal += 1900 * document.pickproduct.mfrecm.value;
           itemCount += parseInt(document.pickproduct.mfrecm.value);
           icnt = document.pickproduct.mfrecm.value + "";
           desc += "RecMgr(" + icnt + ") ";
           }

        //Mealformation Basic
        if (document.pickproduct.mfbwin.value > 0) {
          document.pickproduct.elements[1].value = Math.ceil(document.pickproduct.elements[1].value);
          subTotal += 3900 * document.pickproduct.elements[1].value;
          itemCount += parseInt(document.pickproduct.elements[1].value);
          icnt = document.pickproduct.elements[1].value + "";
          desc += "WinBs(" + icnt + ") ";
          if (dscVal > 0.00)
            calcDsc += 3900 * document.pickproduct.mfbwin.value * dscVal;
          }



        subTotal = subTotal + "";
        if (subTotal > 100) {
                subTotal = subTotal.substring(0, subTotal.length - 2) + "." + subTotal.substring(subTotal.length - 2, subTotal.length);
        }
        else subTotal = 0;

        calcDsc = calcDsc + "";   //convert from number to string
        if (calcDsc > 100){
              calcDsc = calcDsc.substring(0, calcDsc.length - 2) + "."  + calcDsc.substring(calcDsc.length - 2, calcDsc.length);
        }
        else calcDsc = 0;
        document.pickproduct.mfsubtot.value = subTotal;
        document.pickproduct.mfsubtot2.value = subTotal;
        document.pickproduct.itemCnt.value =itemCount;
        if (itemCount <1) desc = "";
        document.pickproduct.invDesc.value =desc;
      // document.pickproduct.dscTotal.value = calcDsc;
        calcOther();
    }



function calcOther() {
var shipLoc ="";
var tRate = 0.00;
var sRate =0.00;
var stax =0.00;
var ship =0.00;

var icnt = parseInt(document.pickproduct.itemCnt.value);
var subtot = parseFloat(document.pickproduct.mfsubtot.value);

  if (icnt > 0){
     shipLoc = (document.pickproduct.shipLocation.options[document.pickproduct.shipLocation.selectedIndex].value);
     if (shipLoc == "Illinois"){
       tRate = 8.75;
       sRate = 000;
      }
     else if (shipLoc == "Outside of Illinois"){
       tRate = 0;
       sRate = 000;
      }
      else {
       tRate = 0;
       sRate = 000;
      }

    // ship = Math.ceil(icnt  * sRate);
     ship = Math.ceil(1 * sRate);
     ship = ship + "";
        if (ship > 100) {
                ship = ship.substring(0, ship.length - 2) + "." + ship.substring(ship.length - 2, ship.length);
        }
    // document.pickproduct.shipTotal.value = ship;

     stax = Math.ceil(subtot  * tRate);
     stax = stax + "";
     if (stax > 100) {
                stax = stax.substring(0, stax.length - 2) + "." + stax.substring(stax.length - 2, stax.length);
       }
     document.pickproduct.taxTotal.value = stax;



  }
  else {
    //document.pickproduct.shipTotal.value = 0.00;
    document.pickproduct.taxTotal.value = 0.00;
    //document.pickproduct.dscTotal.value = 0.00;
   }
  calcInvTotal();

}


function calcInvTotal(){
var taxTot = 0.00;
var shipTot = 0.00;
var itot =0.00;
var dscTot = 0.00;

 if (document.pickproduct.mfsubtot.value > 0){
   //if (document.pickproduct.shipTotal.value > 0)
     // shipTot = parseFloat(document.pickproduct.shipTotal.value);
   if (document.pickproduct.taxTotal.value > 0)
      taxTot = parseFloat(document.pickproduct.taxTotal.value);
   //if (document.pickproduct.dscTotal.value > 0)
     // dscTot = parseFloat(document.pickproduct.dscTotal.value);



   itot = parseFloat(document.pickproduct.mfsubtot.value);
   //itot = Math.ceil((itot + shipTot + taxTot - dscTot) * 100);
   itot = Math.ceil((itot +  taxTot) * 100);

   itot = itot + "";
        if (itot > 100) {
                itot = itot.substring(0, itot.length - 2) + "." + itot.substring(itot.length - 2, itot.length);
        }
  document.pickproduct.invTotal.value = itot;
 }
 else
   document.pickproduct.invTotal.value = 0.00;

 document.pickproduct.AMOUNT.value = document.pickproduct.invTotal.value;
 document.pickproduct.DESCRIPTION.value = document.pickproduct.invDesc.value;
// document.pickproduct.SHIPAMOUNT.value = document.pickproduct.shipTotal.value;
 document.pickproduct.TAX.value = document.pickproduct.taxTotal.value;
}



function verifyForm() {
   var retVal = true;
   var invTotal = document.pickproduct.invTotal.value;

   if (document.pickproduct.mfsubtot.value <= 0)
     {
      alert("You must select products, before placing your order");
      return false;
     }
   if (document.pickproduct.invTotal.value <= 0)
     {
      alert("You must select products, before placing your order");
      return false;
     }
   if ((document.pickproduct.shipLocation.options[document.pickproduct.shipLocation.selectedIndex].value) == "Select Shipping Location")
     {
      alert("You must select a Location, before processing your order");
      return false;
     }
  str = "Your total purchase is $"+invTotal+".\n\nwould you like to process the order?\n";
  if (confirm(str))
     retVal = true;
   else retVal = false;
  return retVal;
}

//the getDiscCode function is not called on the regular buymf page
function getDiscCode() {
  document.pickproduct.dscCode.value = "JAN25HTG";
   if (document.pickproduct.mfsubtot.value > 0)
      {  calcTotal(); }
}