function Total() {
				
        var q, i, ordertotal, gst, total, productprice;
	ordertotal = 0;
        nitems = 63;
                
        
        for (i=1; i<=nitems; i++) {
                eval("document.orderform.Item" + i + "Total.value = '';");
                eval("q = document.orderform.Item" + i + "Quantity.value;");
                if (q) {
                        productprice = GetProductPrice(i);
                        
                        //eval("total=document.orderform.Item" + i + "Price.value * document.orderform.Item" + i + "Quantity.value;");
                        eval("total= productprice * document.orderform.Item" + i + "Quantity.value;");
                        eval("document.orderform.Item" + i + "Total.value=Currency(total)");
                        eval("ordertotal = ordertotal + total;");
                }
        }
        document.orderform.total.value = Currency(ordertotal);
}

function GetProductPrice(fieldname)
	{
					
	var prices = [	// SOFT BAITS
				4.50,	// Fire Tiger Soft Bait MD 73
				4.50,	// Nuclear Chicken Soft Bait MD 74
														
					// SWIVELS
				3.50,	// Swivel and Snap MD 80
				1.50,	// Brass Barrel Swivel MD 83
				
					// HOOKS
				3.00,	// 5/0 O'Shaunessy long Shank Hooks 25 pack
				5.00,	// 7/0 O'Shaunessy long Shank Hooks 25 pack
				3.00,	// 4/0 Sport Circle Hook 25 Pack MD 98
				3.50,	// 5/0 Sport Circle Hook 25 Pack MD 97
				5.00,	// 7/0 Sport Circle Hook 25 Pack MD 99
				3.00,	// 4/0 Wide Gape Hook 25 Pack MD 95
				4.00,	// 6/0 Wide Gape Hook 25 Pack MD 96
				3.00,	// 4/0 Octopus beak hooks 25 pack
				3.00,	// 5/0 Octopus beak hooks 25 pack
				4.00,	// 6/0 Octopus beak hooks 25 pack
				5.00,	// 7/0 Octopus beak hooks 25 pack
				5.50,	// 8/0 Octopus beak hooks 25 pack
				4.00,	// 6/0 Kahles Black Wide Gape Hooks 25 pack
				4.00,	// 6/0 Kahles Red Wide Gape Hooks 25 pack
				6.00,   // 14/0 Tuna Circle Hooks 10 pack MD 65
				
					// LURES
				2.50,	// Toby Trout Lure MD 1
				2.50,	// Toby Trout Lure MD 2
				5.00,	// Bibbed Sinking Lure (Rapala Type) MD 3
				5.00,	// Salmon Lure MD 4
				4.00,	// Kahawhai Lure MD 66
				2.50,	// Bibbed Sinking Lure MD 8
				5.00,	// Bibbed Sinking Lure MD 9
				5.00,	// Kahawai Tuna Lure MD 12
				4.00,	// Salmon Lure MD 69
				6.00,	// Cicada Lure MD 20
				12.00,	// Blue/ Silver Kingfish Lure MD 21
				12.00,	// Green / White with Red Stripe Kingfish lure, with Treble Hooks MD 23
				4.00,	// Kawahai / Salmon Lure MD 33
				4.00,	// Salmon / Kawahai Lure MD 35
				4.00,	// Salmon / Kawahai Lure MD 36
				2.00,	// Zeddy Lure MD 58
				4.00,	// Kahawhai Lure MD 68
				4.00,	// Salmon Lure MD 67
				
					// JIGS
				2.50,	// 60 gm Jig Red/Silver MD 25
				3.00,	// 100 gm Jig Red /Silver MD 26
				2.50,	// 60 gm Jig Blue/Silver MD 27
				2.50,	// Gold / Silver 60gm Jig MD 39
				2.50,	// Orange/Yellow 60gm Jig MD 41
				2.50,	// Pink / Silver 60gm Jig MD 45
				8.00,	// Pink long Jig 250g MD 70
				8.00,	// Blue / Silver long Jig 300g MD 71
				8.00,	// Blue / Gold long Jig 250g MD 72
								
					// FLASHERS
				3.00,	// White Squid Flasher Rig MD 37				
				3.00,	// 6/0 Snapper Rig MD 46
				3.00,	// 3/0 Tarakihi Rig MD 47
				3.00,	// Snapper / Cod Rig MD 48
				3.00,	// Pink Squid Flasher Rig MD 53
				8.00,	// Pink Hapuka / Groper 2 Hook Rig MD 59
				8.00,	// Green Hapuka / Groper 2 Hook Rig MD 60
				3.00,	// 7/0 Red Snapper Rig MD 102
				3.00,	// 4/0 Yellow Terakihi Flasher Rig MD 103
							
					// OTHER
				5.00,	// Luminous Tube 1.8mm Pink MD 61
				5.00,	// Luminous Tube 1.8mm Green MD 62
				5.00,	// Luminous Tube 2.5mm Pink MD 63
				5.00,	// Luminous Tube 2.5mm Green MD 64
								
					// LINES
				6.50,	// Copolymer line 20lb 500 meter spool MD56
				6.50,	// Copolymer line 30lb 500 meter spool MD57
				25.00,	// Weight Forward 7 Weight Floating Flyline
				25.00,	// Weight Forward 8 Weight Floating Flyline
					];
	
	return prices[fieldname - 1];
	}


function Currency(anynum) {
        //returns number as string in $xxx,xxx.xx format.
        anynum = "" + eval(anynum)  //evaluate (in case an expression sent)
        intnum = parseInt(anynum)  //isolate integer portion
        intnum = Math.abs(intnum)
        intstr = ""+intnum
        //add comma in thousands place.
        if (intnum >= 1000) {
                intlen = intstr.length
                temp1=parseInt(""+(intnum/1000))
                temp2=intstr.substring(intlen-3,intlen)
                intstr = temp1+","+temp2

        }
        if (intnum >= 1000000) {
                intlen = intstr.length
                temp1=parseInt(""+(intnum/1000000))
                temp2=intstr.substring(intlen-7,intlen)
                intstr = temp1+","+temp2

        }

        decnum = Math.abs(parseFloat(anynum)-parseInt(anynum)) //isolate decimal portion
        decnum = decnum * 100 // multiply decimal portion by 100.
        decstr = "" + Math.abs(Math.round(decnum))
        if (decstr.length>2) {decstr=decstr.substring(0,2)}
        while (decstr.length < 2) {decstr="0"+decstr}
        retval = intstr + "." + decstr 
        if (anynum < 0) {
                retval="("+retval+")"
        }
        return "$"+retval
}