// <script type="text/javascript">  

function Dollar (val) {  // force to valid dollar amount
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  // for old Netscape browsers
  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1, tst) { // process radio and checkbox
var i,amt,des,obj,pos,val;
  amt = obj1.baseamt.value*1.0;    // base amount
  des = obj1.basedes.value;        // base description
  for (i=0; i<obj1.length; i++) {  // run entire form
    obj = obj1.elements[i];        // a form element
    if (obj.type == "checkbox" ||  // checkboxes
        obj.type == "radio") {     //  and radios
      if (obj.checked) {           // did user check it?
        val = obj.value;           // the value of the selection
        pos  = val.indexOf ("@");  // price set?
        if (pos > 0) amt = val.substring (pos + 1)*1.0;
        pos  = val.indexOf ("+");  // price increment?
        if (pos > 0) amt = amt + val.substring (pos + 1)*1.0;
        pos  = val.indexOf ("%");  // percent change?
        if (pos > 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
        if (des.length == 0) des = val;
        else des = des + ", " + val;  // accumulate value
      }
    }
  }
  obj1.item_name.value = des;
  obj1.amount.value = Dollar (amt);
  if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

// </script>


