﻿function FormatNumber(expr, decplaces) {
var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));
while (str.length <= decplaces) {
str = "0" + str;
}
var decpoint = str.length - decplaces;
return str.substring(0,decpoint) + "." + str.substring(decpoint, str.length);
}
if (document.getElementById) { isID = 1; isDHTML = 1; }
else {
   if (document.all) {isAll = 1; isDHTML = 1; } 
   else {
      browserVersion = parseInt(navigator.appVersion);
   if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1; }
} }
function SumUp()
{
	var total = 0;
	for (var i = 0; i < nItems; i++)
	{
	    if (document.forms['multiorderform']['vwquantity'+i])
	    {
		    var qty = parseInt(document.forms['multiorderform']['vwquantity' + i].value);
		    if (! isNaN(qty))
		    {
			    total += qty * price[i];
			    var subtotal = document.getElementById('subtotal' + i);
			    if (subtotal)
			    {
			        subtotal.innerHTML = "$" + FormatNumber(qty * price[i],2);
			    }
		    }
		    else
		    {
			    var subtotal = document.getElementById('subtotal' + i);
			    if (subtotal)
			    {
			        subtotal.innerHTML = "&nbsp;";
			    }
		    }
        }
	}
	var totalBox = document.getElementById('total');
	if (totalBox)
	{
		totalBox.innerHTML = "$" + FormatNumber(total,2);
	}
}