var ext = "";
var isoky = false;
var clkps=1;


function caltotal() {
var subtot=parent.document.getElementById('txtsubtot').value;
var shiprate=parent.document.getElementById('txtship').value;
var pstrate=parent.document.getElementById('pstrt').value;
var gstrate=parent.document.getElementById('gstrt').value;
if (subtot <0) {
parent.document.getElementById('txtsubtot').value='0.00';
var subtot=parent.document.getElementById('txtsubtot').value;
}
var subtot2='';
if ((Math.floor(100*(subtot-Math.floor(subtot)))) == 0) subtot2='.00'; 

uprc_id = parent.document.getElementById('subtotal');
uprc_child = uprc_id.firstChild;
    if (uprc_child)
      uprc_id.removeChild(uprc_child);
uprc_value = parent.document.createTextNode('$'+subtot+subtot2);
uprc_id.appendChild(uprc_value);
uprc_id = parent.document.getElementById('shiprate');
uprc_child = uprc_id.firstChild;
    if (uprc_child)
      uprc_id.removeChild(uprc_child);
uprc_value = parent.document.createTextNode('$'+parent.document.getElementById('txtship').value);
uprc_id.appendChild(uprc_value);
uprc_id = parent.document.getElementById('shiprate');
uprc_child = uprc_id.firstChild;
    if (uprc_child)
      uprc_id.removeChild(uprc_child);
uprc_value = parent.document.createTextNode('$'+parent.document.getElementById('txtship').value);
uprc_id.appendChild(uprc_value);
result=+Math.floor(subtot)+".";
var subcents=100*(subtot-Math.floor(subtot))+0.5;
result += Math.floor(subcents/10);
runtot=result;
result=+Math.floor(shiprate)+".";
var shipcents=100*(shiprate-Math.floor(shiprate))+0.5;
result += Math.floor(shipcents/10);
runtot= (Math.floor(subtot)+(Math.floor(subcents)/100))+ 
(Math.floor(shiprate)+(Math.floor(shipcents)/100));
cents=100*(runtot-Math.floor(runtot))+0.5;
parent.document.getElementById('rtot').value=runtot;
result = Math.floor(runtot);
result += Math.floor(cents/10);
var pst= parent.document.getElementById('rtot').value*parent.document.getElementById('pstrt').value;
parent.document.getElementById('psttot').value= parent.document.getElementById('rtot').value*parent.document.getElementById('pstrt').value;
var pst2='';
if ((Math.floor(100*(pst-Math.floor(pst)))) == 0) {
pst2='.00'; 
var pstshow='$'+ (Math.floor(pst))+''+pst2;
}
else { pst2='.'+(Math.round(100*(pst-Math.floor(pst))));
pst=Math.floor(pst);
var pstshow='$'+ (Math.floor(pst))+'.'+(Math.floor(100*(pst2-Math.floor(pst2))));
}
uprc_id = parent.document.getElementById('sppst');
uprc_child = uprc_id.firstChild;
    if (uprc_child)
      uprc_id.removeChild(uprc_child);
uprc_value = parent.document.createTextNode(pstshow);
uprc_id.appendChild(uprc_value);
var gst= parent.document.getElementById('rtot').value*parent.document.getElementById('gstrt').value;
parent.document.getElementById('gsttot').value= parent.document.getElementById('rtot').value*parent.document.getElementById('gstrt').value;
var gst2='';
if ((Math.floor(100*(gst-Math.floor(gst)))) == 0)
gst2='.00'; 
else gst2='.'+(Math.round(100*(gst-Math.floor(gst))));
gst=Math.floor(gst);
var gstshow='$'+ (Math.floor(gst))+'.'+(Math.floor(100*(gst2-Math.floor(gst2))));
uprc_id = parent.document.getElementById('gst');
uprc_child = uprc_id.firstChild;
    if (uprc_child)
      uprc_id.removeChild(uprc_child);
uprc_value = parent.document.createTextNode(gstshow);
uprc_id.appendChild(uprc_value);
var rtot=parent.document.getElementById('rtot').value;
var fulltot= (Math.floor(rtot)+Math.floor(pst)+Math.floor(gst))+((Math.floor(Math.floor(100*(rtot-Math.floor(rtot))))+(Math.floor(100*(gst-Math.floor(gst))))+(Math.floor(100*(pst-Math.floor(pst)))))/100);
var fulltot2 ='';
if ((Math.floor(100*(fulltot-Math.floor(fulltot)))) == 0)
fulltot2='.00'; 
else fulltot2='.'+(Math.round(100*(fulltot-Math.floor(fulltot))));
fulltot=Math.floor(fulltot);
var fulltotshow= '$'+fulltot+fulltot2;
uprc_id = parent.document.getElementById('total');
uprc_child = uprc_id.firstChild;
    if (uprc_child)
      uprc_id.removeChild(uprc_child);
uprc_value = parent.document.createTextNode(fulltotshow);
uprc_id.appendChild(uprc_value);
parent.document.getElementById('txttotpurch').value=fulltotshow;
}

function valcal (obj) {
if (parent.document.getElementById('couponen').value == 'false') { 
var username=Get_Cookie('superior-login');
parent.document.getElementById('dscheck').src="checkcoupon.cgi?cp="+obj+"&user="+username;
Set_Cookie( 'superior-cp', obj, 'superior', '/', '', '' );
}
}

