function test ()
{
}
function dm(amount)
{
string = "" + amount;
dec = string.length - string.indexOf('.');
if (string.indexOf('.') == -1)
return string + '.00';
if (dec ==1)
return string +'00';
if (dec == 2)
return string + '0';
if (dec > 3)
return string.substring(0,string.length-dec+3);
return string;
}

function calculate()
{
PicQty = 0; DDQty = 0;  CusQty = 0; VidQty = 0;  CredQty = 0;  ScreQty = 0; DvdQty = 0; DolDis = 0; PerDis = 0; 

PackTot = 0; DDTot = 0;  CusTot = 0; VidTot = 0; CredTot = 0; ScreTot = 0; DvdTot = 0; PreTot = 0; PhoTot = 0; RusTot = 0; ShiTot = 0; DolTot = 0; PerTot = 0;

CusPrc = 10.00; VidPrc = 15.00; CredPrc = 5.00; ScrePrc = 75.00; DvdPrc = 15.00;


if (document.ofrm.pictureqty.value > "")
{PicQty = document.ofrm.pictureqty.value};
document.ofrm.pictureqty.value = eval(PicQty);

if (document.ofrm.packageqty.value > "")
{PkgQty = document.ofrm.packageqty.value};

if (document.ofrm.DDiscountQty.value > "")
{DDQty = document.ofrm.DDiscountQty.value};

if (document.ofrm.customqty.value > "")
{CusQty = document.ofrm.customqty.value};
document.ofrm.customqty.value = eval(CusQty);

if (document.ofrm.videoqty.value > "")
{VidQty = document.ofrm.videoqty.value};
document.ofrm.videoqty.value = eval(VidQty);

if (document.ofrm.CreditsQty.value > "")
{CredQty = document.ofrm.CreditsQty.value};
document.ofrm.CreditsQty.value = eval(CredQty);

if (document.ofrm.ScreenQty.value > "")
{ScreQty = document.ofrm.ScreenQty.value};
document.ofrm.ScreenQty.value = eval(ScreQty);

if (document.ofrm.dvdqty.value > "")
{DvdQty = document.ofrm.dvdqty.value};
document.ofrm.dvdqty.value = eval(DvdQty);

if (document.ofrm.RushQty.value > "")
{RusQty = document.ofrm.RushQty.value};

if (document.ofrm.DollarDiscount.value > "")
{DolDis = document.ofrm.DollarDiscount.value};
document.ofrm.DollarDiscount.value = eval(DolDis);

if (document.ofrm.PercentageDiscount.value > "")
{PerDis = document.ofrm.PercentageDiscount.value};
document.ofrm.PercentageDiscount.value = eval(PerDis);

PackTot = PicQty * PkgQty;
document.ofrm.packagetotal.value = dm(eval(PackTot));

DDTot = (DDQty * PackTot) * -0.15;
document.ofrm.DDiscountTotal.value = dm(eval(DDTot));

CusTot = CusQty * CusPrc;
document.ofrm.customtotal.value = dm(eval(CusTot));

VidTot = VidQty *VidPrc;
document.ofrm.videototal.value = dm(eval(VidTot));

CredTot = CredQty *CredPrc;
document.ofrm.CreditsTotal.value = dm(eval(CredTot));

ScreTot = ScreQty *ScrePrc;
document.ofrm.ScreenTotal.value = dm(eval(ScreTot));

DvdTot = DvdQty * DvdPrc;
document.ofrm.dvdtotal.value = dm(eval(DvdTot));

PreTot = document.ofrm.preview.value;
document.ofrm.previewtotal.value = dm(eval(PreTot));

PhoTot = document.ofrm.photocd.value;
document.ofrm.photocdtotal.value = dm(eval(PhoTot));

Subamt =
  eval(PackTot) +
  eval(DDTot) +
  eval(CusTot) +
  eval(VidTot) +
  eval(CredTot) +
  eval(ScreTot) +
  eval(DvdTot) +
  eval(PreTot) +
  eval(PhoTot) ;
  
  document.ofrm.subtotal.value = dm(eval(Subamt));
  
RusTot = (RusQty * Subamt) * 0.20;
document.ofrm.RushTotal.value = dm(eval(RusTot));

DolTot = DolDis * -1
document.ofrm.DollarTotal.value = dm(eval(DolTot));

PerTot = (PerDis * -0.01) * Subamt;
document.ofrm.PercentageTotal.value = dm(eval(PerTot));

ShiTot = document.ofrm.shipping.value;
document.ofrm.shippingtotal.value = dm(eval(ShiTot));
  
Totamt =
	eval(Subamt) +
	eval(RusTot) +
	eval(DolTot) +
	eval(PerTot) +
	eval(ShiTot) ;
	
	document.ofrm.ordertotal.value = dm(eval(Totamt));
  
}  