// Print Calculator for CML site
// Last update 24 Mar 2006

document.write('<h4>Calculate Your Print Cost</h4>');
document.write('<table width=275 border=0><form name=calc>');
document.write('<tr><td><b>Size/Dimensions</b></td><td><b>Paper Type</b></td></tr>');
document.write('<tr><td><input name=sizew type=text size=5> x <input name=sizeh type=text size=5></td>');
document.write('<td><select name=paper><option value=heavy>Heavy</option><option value=satin>Satin</option>');
document.write('<option value=glossy>Glossy</option></select></td></tr>');
document.write('<tr><td height=40><input type=button value=\'Calculate Total\' onClick=doCalc()></td><td>&nbsp;</td></tr>');
document.write('<tr><td height=40><b>Your Total:</b></td>');
document.write('<td><font size=+2><div id=p_total>$0.00</div></font></td></tr>');
document.write('</form></table>');


function doCalc(){
 obj1 = document.calc;

 if(obj1.paper.value == 'satin'){  pp = 5.0; }
  else if(obj1.paper.value == 'heavy')  { pp = 3.0; }
   else if(obj1.paper.value == 'glossy') { pp = 5.0; }

   subtotal = ((((obj1.sizew.value)*(obj1.sizeh.value)) / 144) * pp);

   if(subtotal < 1){

     subtotal = Math.ceil(subtotal);

   } else {

     subtotal = Math.floor(subtotal);
   }

   subtotal = subtotal.toFixed(2);

  if (document.getElementById){
   
    var sp = document.getElementById("p_total");

  } else if (document.all) {

    var style2 = document.all["p_total"];

  } else if (document.layers){

    var style2 = document.layers["p_total"];
  }

   sp.innerHTML = "$"+subtotal;

}


