/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 Friday, 15 June 2007 2:01:56 p.m.
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */

var ijewellery_types = new Array();

 function calc_ijewellery(idx) {
   if (idx == undefined) {
   } else {
     p = document.getElementById('product_price' + idx);
     if (p) {
       pv = p.innerHTML;  //check to make sure a product has a price
       if (pv != '') {
         wght = document.getElementById('product_weight' + idx).innerHTML;  //the weight in grammes
         qty = document.getElementById('qty' + idx).value;
         if (qty == '') qty = 0;

         //add to the price
         prcvalue = parseFloat(pv);
         prcvalue = prcvalue * qty;

         prc = document.getElementById('price' + idx);
         prc.value = prcvalue.toFixed(2);

         wghtunit = document.getElementById('weight_unit' + idx).innerHTML;
         if (wghtunit == 'EA') {   //the weight is weight times the quantity
           document.getElementById('display_weight' + idx).value = qty * wght;
         };
       };
     };
   };
 }
