// kw50product.js
function Update1(f)
{
   var price;
   var amount = 0.0;
   var totamount = 0.0;
   var nytax = 0.0;
   var qty;
   var shipp = 0.0;

   qty = parseInt(f.qty.value);
   if (isNaN(qty) || qty < 1 || qty > 9)
   {
       alert("The quantity field must be populated with a value of 1-9.");
       f.qty.focus();
       return false;
   }

   if (qty == 1)
       price = 29.95;
   else if (qty == 2)
       price = 24.95;
   else
       price = 19.95;
       
   amount = qty * price;
   
   if (f.shipp.checked == true && qty == 1)
       shipp = 8.95;
   else
       shipp = 0;
       
   if (f.nytax.checked == true)
       nytax = (amount + shipp) * 0.08625;
       
   totamount = amount + nytax + shipp; 
   
   var amount1 =    amount.toFixed(2);
   var shipp1 =     shipp.toFixed(2);
   var nytax1 =     nytax.toFixed(2);
   var totamount1 = totamount.toFixed(2);
   
   document.getElementById('price').innerHTML = '$ '+ price;
   document.getElementById('shipp1').innerHTML = '$ '+ shipp1;
   document.getElementById('shipp2').innerHTML = '$ '+ shipp1;
   document.getElementById('amount').innerHTML = '$ '+ amount1;
   document.getElementById('nytaxamt1').innerHTML = '$ '+ nytax1;
   document.getElementById('nytaxamt2').innerHTML = '$ '+ nytax1;
   document.getElementById('totamount').innerHTML = '$ '+ totamount1;

   return true;
}

function OpenVolume(htm)
{
   popupWin = window.open(htm,'','width=450,height=300');
}

function UpdatePrice(f)
{
   var cdprice = 8.95;
   var price = 0;
   var amount = 0;
   var totamount = 0;
   var cdamount = 0;
   var qty;

   qty = parseInt(f.qty.value);
   if (isNaN(qty) || qty < 1)
   {
       alert("The quantity field must be populated with a value of 1-9.");
       f.qty.focus();
       return false;
   }

   if (qty > 9 )
   {
       alert("Please contact KidsWatch Sales at (516) 746-4888 for all orders of ten or more.");
       f.qty.focus();
       return false;
   }
   
   if (qty == 1) {
     if (f.ver.value == 'w')
         price = 45.95;
     else
         price = 29.95;
   } else if (qty == 2) {
     if (f.ver.value == 'w')
         price = 39.95;
    else
         price = 25.50;
   } else if (qty < 5){
     if (f.ver.value == 'w')
         price = 34.95;
     else
         price = 22.50;
   } else {
     if (f.ver.value == 'w')
         price = 29.95;
     else
         price = 19.50;
   }
   
   f.price.value = price;
   amount = price * f.qty.value;
   cdamount = cdprice * f.cdqty.value;
   totamount = amount + cdamount;
   
   var price1 =    price.toFixed(2);
   var amount1 =    amount.toFixed(2);
   var totamount1 =    totamount.toFixed(2);

   document.getElementById('price').innerHTML = '$ '+ price1;
   document.getElementById('amount').innerHTML = '$ '+ amount1;
   document.getElementById('totamount').innerHTML = '$ '+ totamount1;

   return true;
}

function UpdateCD(f, m)
{
   var cdprice = 8.95;
   var cdamount = 0;
   var totamount = 0;
   var amount = 0;
   var qty;
   
   qty = parseInt(f.cdqty.value);
   if (isNaN(qty) || qty > 9 || qty < 0)
   {
       alert("The quantity field must be populated with a value of 0-9.");
       f.cdqty.focus();
       return false;
   }

//   if (qty > 0 && m == 0) 
//   {
//	alert("All CD-ROM's are currently on back order and will be shipped in aproximately 4-6 weeks.");
//   }

   cdamount = cdprice * qty;
   amount = parseFloat((document.getElementById('amount').innerHTML).substring(1));
   totamount = amount + cdamount;

   var amount1 =    amount.toFixed(2);
   var cdamount1 =    cdamount.toFixed(2);
   var totamount1 =    totamount.toFixed(2);

   document.getElementById('amount').innerHTML = '$ '+ amount1;
   document.getElementById('cdamount').innerHTML = '$ '+ cdamount1;
   document.getElementById('totamount').innerHTML = '$ '+ totamount1;

   return true;
}

