	// Dry Items
	//   [items var]   [rate]
	var weightDry1 = 7.80;
	var weightDry25 = 13.80;
	var weightDry610 = 16.95;

	// Fresh Items
	//   [items var]     [rate]
	var weightFresh1 = 14.50;
	var weightFresh23 = 16.65;
	var weightFresh45 = 19.40;
	var weightFresh67 = 24.50;
	var weightFresh89 = 29.65;
	var weightFresh10 = 33.75;
	var dshipping = 0;
	var fshipping = 0
	var totalsPrice = fs + ds;

	
function diff(value, floor, ceil){
	return value >= floor && value <= ceil;
}

function alive(item) {
	if((item != null) || (item != undefined) || (item != "")) return true;
}

function tver() {
	//for(n in itemReferenced) {
		//alert(itemReferenced); 
	//}

	//for(m in itemReferencef) {
		//alert(itemReferencef);
	//}
}

var ztotal =0;
var trnstr = /\d+.\d\d/;
var itemReferenced;
var itemReferencef;
var data = '';
var sdinfo1 = "";
var sdinfo2 = "";
var sdinfo3 = "";
var sdinfoi = "";
var fdinfo1 = "";
var fdinfo2 = "";
var fdinfo3 = "";
var fdinfo4 = "";
var fdinfo5 = "";
var fdinfo6 = "";
var fdinfoi = "";
var fio;
var sio;
var fs;
var ds;
var sdname1 = "";
var sdname2 = "";
var sdname3 = "";
var sdnamei = "";
var fdname1 = "";
var fdname2 = "";
var fdname3 = "";
var fdname4 = "";
var fdname5 = "";
var fdname6 = "";
var fdnamei = "";
var total = 0.00;
//var price = 0;
var bprice = 0;
var iNum = 0;
var iName = "";
var iId = "";
var iWeight = 0;
//bprice += price;

function checkout(){

var vfy = window.open("", "", "width=680,height=600,scrollbars=yes,resizable=yes, toolbar=yes");
	vfy.document.open();
	var vhead = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""+ 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\> <html xmlns=\"http://www.w3.org/1999/xhtml\"><head>"+
	"<link href=\"style/default.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />"+
	"</head>";
	var vstable = "<body><div align=\"center\"> <h3 align=\"center\"> Please ensure that you verify each item in the list <u>by clicking the <b><font color=\"#00FF00\">\"Add to Cart\"</font></b></u> button to the left of the item(s), otherwise your item(s) will not be added to the cart. </h3><table cellspacing=\"10\" style=\"border-style:dashed; color:#FFFFFF\" border=\"1\" width=\"85%\">";
	var vsc = "<tr><th>Verify Item</th><th>ItemNum</th><th>ItemName</th><th>Weight</th><th>Price (ea.)</th></tr><br>";
	var vmsc = "";
	var ItemNum = new Object();
	var ItemId = new Object();
	var ItemName = new Object();
	var Weight = new Object();
	var Price = new Object();
	var tItemNum = new Object();
	var tItemId = new Object();
	var tItemName = new Object();
	var tWeight = new Object();
	var tPrice = new Object();
	var idptrn = /ItemID\s*=\s*"([^"]*)"/
	//var numptrn = /ItemID ="\d+"/;
	var numptrn = /ItemID\s*=\s*"([^"]*)"/
	var nptrn = /Item\sName\s="([^"]+)"/;
	var wptrn = /Quantity="([^"]+)"/;
	var pptrn = /priced\sat\s"([^"]+)"/;
	//var pItem =  "<input name=\"business\" value=\"test@paypal.com\" type=\"hidden\" />"+"\n"+
       //              "<input name=\"cn\" value=\"Comments\" type=\"hidden\" />"+"\n"+
         //            "<input name=\"currency_code\" value=\"USD\" type=\"hidden\" />"+"\n"+
           //          "<input name=\"lc\" value=\"US\" type=\"hidden\" />"+"\n";


	if(alive(itemReferenced) != "") {
		var splitStringd = itemReferenced.split("\n");
		for(d in splitStringd) {
			if(splitStringd[d].match(/priced at "\d*.\d+"/g) == null) delete splitStringd[d];

			else {
				ItemNum[d] = numptrn.exec(splitStringd[d])[1];
		 		ItemId[d] = idptrn.exec(splitStringd[d])[1];
		 		ItemName[d] = nptrn.exec(splitStringd[d])[1];
		 		Weight[d] = wptrn.exec(splitStringd[d])[1];
		 		Price[d] = pptrn.exec(splitStringd[d])[1];
				/*var tstring1 = tItemNum[d];
				var tstring2 = tItemId[d];
				var tstring3 = tItemName[d];
				var tstring4 = tWeight[d];
				var tstring5 = tPrice[d];

				ItemNum[d] = tItemNum[d].split(',');
				ItemId[d] = tItemId[d].split(',');
				ItemName[d] = tItemName[d].split(',');
				Weight[d] = tWeight[d].split(',');
				Price[d] = tPrice[d].split(',');

				ItemNum[d] = tstring1.match(/ItemID\s*=\s*"([^"]*)"/);
				ItemId[d] = tstring2.match(/ItemID\s*=\s*"([^"]*)"/);
				ItemName[d] = tstring3.match(/Item\sName\s="([^"]+)"/);
				Weight[d] = tstring4.match(/Quantity="([^"]+)"/g);
				Price[d] = tstring5.match(/priced\sat\s"([^"]+)"/);*/

/*				var paypals = "<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\""+
		  		          "<input src=\"https://www.paypal.com/en_US/i/btn/x-click-but10.gif\" name=\"submit\" alt=\"Make payments with   PayPal - it's fast, free and secure!\" border=\"0\" type=\"image\" style=\"position:relative; display:inline-block;\"/>";
			        
				var paypale =
           			          "<input name=\"cn\" value=\"Comments\" type=\"hidden\" />"+"\n"+
               		                  "<input name=\"currency_code\" value=\"USD\" type=\"hidden\" />"+"\n"+
                	                  "<input name=\"lc\" value=\"US\" type=\"hidden\" />"+
					  				  "<input type=\"hidden\" name=\"shipping\" value=\""+ds+"\">"+
			                 		  "</form>";		
	
				var pItem = "<input name=\"add\" value=\""+d+"\" type=\"hidden\" />"+"\n"+
                   			"<input name=\"cmd\" value=\"_cart\" type=\"hidden\" />"+"\n"+
							"<input name=\"business\" value=\"sales@glondossausage.com\" type=\"hidden\" />"+
                    		"<input name=\"item_name\" value=\""+ItemName[d]+"\" type=\"hidden\" />"+"\n"+
                  		 	//"<input name=\"item_number\" value=\""+ItemId[d]+"\" type=\"hidden\" />"+"\n"+
							"<input type=\"hidden\" name=\"quantity\" value=\""+Weight[d]+"\">"+"\n"+
                   		 	"<input name=\"amount\" value=\""+Price[d]+"\" type=\"hidden\" />";  */
							
				var somethingElse = "";	    
				somethingElse += "<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">"+"\n"+
	       							 "<input src=\"https://www.paypal.com/en_US/i/btn/x-click-but10.gif\" name=\"submitd\" alt=\"Make payments with PayPal - it's fast, free and secure!\" border=\"0\" type=\"image\" />"+"\n"+
	        						"<input name=\"add\" value=\"1\" type=\"hidden\" />"+"\n"+
	     						  " <input name=\"cmd\" value=\"_cart\" type=\"hidden\" />"+"\n"+
	      						  "<input name=\"business\" value=\"sales@glondossausage.com\" type=\"hidden\" />"+"\n"+
	        						"<input name=\"item_name\" value=\""+ItemName[d]+"\" type=\"hidden\" />"+"\n"+
	     						   "<input name=\"item_number\" value=\""+ItemId[d]+"\" type=\"hidden\" />"+"\n"+
									"<input type=\"hidden\" name=\"quantity\" value=\""+Weight[d]+"\">"+"\n"+
									"<input name=\"amount\" value=\""+Price[d]+"\" type=\"hidden\" />"+
	      						  "<input name=\"cn\" value=\"Comments\" type=\"hidden\" />"+"\n"+
	   						     "<input name=\"currency_code\" value=\"USD\" type=\"hidden\" />"+"\n"+
	   						     "<input name=\"lc\" value=\"US\" type=\"hidden\" />"+"\n"+
									"<input type=\"hidden\" name=\"shipping\" value=\""+ds+"\">"+"\n"+

	   							 "</form>";

				vmsc += "<tr align=\"center\"><td>"+somethingElse+"</td><td>#"+ItemNum[d]+"</td><td>\"" +ItemName[d]+"\"</td><td>" +Weight[d]+"lb(s)</td><td>$" +Price[d]+ "</td></tr>";
				//alert(ds);
				ds = 0;
			}
			////alert(splitStringd[d]);
		}
	}

	if(alive(itemReferencef) != "") {
		var splitStringf = itemReferencef.split("\n");
		for(f in splitStringf) {
			if(splitStringf[f].match(/priced at "\d*.\d+"/g) < 1) delete splitStringf[f];
			else {
				ItemNum[f] = numptrn.exec(splitStringf[f])[1];
		 		ItemId[f] = idptrn.exec(splitStringf[f])[1];
		 		ItemName[f] = nptrn.exec(splitStringf[f])[1];
		 		Weight[f] = wptrn.exec(splitStringf[f])[1];
		 		Price[f] = pptrn.exec(splitStringf[f])[1];

				//ItemNum[f] = tItemNum[f].match(/ItemID\s*=\s*"([^"]*)"/);
				//ItemId[f] = tItemId[f].match(/ItemID\s*=\s*"([^"]*)"/);
				//ItemName[f] = tItemName[f].match(/Item\sName\s="([^"]+)"/);
				//Weight[f] = tWeight[f].match(/Quantity="([^"]+)"/g);
				//Price[f] = tPrice[f].match(/priced\sat\s"([^"]+)"/);

/*
				var paypals = "<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" name=\"paypalf\""+
		  		          "<input src=\"https://www.paypal.com/en_US/i/btn/x-click-but10.gif\" name=\"submitf\" alt=\"Make payments with   PayPal - it's fast, free and secure!\" border=\"0\" type=\"image\"/>";
			        
				var paypale = 
           			          "<input name=\"cn\" value=\"Comments\" type=\"hidden\" />"+"\n"+
               		                  "<input name=\"currency_code\" value=\"USD\" type=\"hidden\" />"+"\n"+
                	                  "<input name=\"lc\" value=\"US\" type=\"hidden\" />"+
					  "<input type=\"hidden\" name=\"shipping\" value=\""+fs+"\">"+
			                  "<input name=\"business\" value=\"sales@glondossausage.com\" type=\"hidden\" /></form>";	
 
				var pItem ="<input name=\"add\" value=\""+f+"\" type=\"hidden\" />"+"\n"+
                   			"<input name=\"cmd\" value=\"_cart\" type=\"hidden\" />"+"\n"+
                    		 	"<input name=\"item_name\" value=\""+ItemName[f]+"\" type=\"hidden\" />"+"\n"+
                  		 	//"<input name=\"item_number\" value=\""+ItemId[f]+"\" type=\"hidden\" />"+"\n"+
					"<input type=\"hidden\" name=\"quantity\" value=\""+Weight[f]+"\">"+"\n"+
                   		 	"<input name=\"amount\" value=\""+Price[f]+"\" type=\"hidden\" />";   */

				var somethingElse = "";	    
				somethingElse += "<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">"+"\n"+
	       							 "<input src=\"https://www.paypal.com/en_US/i/btn/x-click-but10.gif\" name=\"submitf\" alt=\"Make payments with PayPal - it's fast, free and secure!\" border=\"0\" type=\"image\" />"+"\n"+
	        						"<input name=\"add\" value=\"1\" type=\"hidden\" />"+"\n"+
	     						  " <input name=\"cmd\" value=\"_cart\" type=\"hidden\" />"+"\n"+
	      						  "<input name=\"business\" value=\"sales@glondossausage.com\" type=\"hidden\" />"+"\n"+
	        						"<input name=\"item_name\" value=\""+ItemName[f]+"\" type=\"hidden\" />"+"\n"+
	     						   "<input name=\"item_number\" value=\""+ItemId[f]+"\" type=\"hidden\" />"+"\n"+
									"<input type=\"hidden\" name=\"quantity\" value=\""+Weight[f]+"\">"+"\n"+
									"<input name=\"amount\" value=\""+Price[f]+"\" type=\"hidden\" />"+
	      						  "<input name=\"cn\" value=\"Comments\" type=\"hidden\" />"+"\n"+
	   						     "<input name=\"currency_code\" value=\"USD\" type=\"hidden\" />"+"\n"+
	   						     "<input name=\"lc\" value=\"US\" type=\"hidden\" />"+"\n"+
									"<input type=\"hidden\" name=\"shipping\" value=\""+fs+"\">"+"\n"+

	   							 "</form>";
								
				vmsc += "<tr align=\"center\"><td>"+somethingElse+"</td><td>#"+ItemNum[f]+"</td><td>\"" +ItemName[f]+"\"</td><td>" +Weight[f]+" lb(s)</td><td>$" +Price[f]+ "</td></tr>";
				//alert(fs);
				fs = 0;
				//paypals+pItem+paypale
			}
			////alert(splitStringf[f]);
		}
	}
	

	/*if(alive(fdinfo1) != "") {
		 ItemNum = fdinfo1.match(/ItemID ="\d+"/g);
		 ItemId = fdinfo1.match(/ItemID ="\d+"/g);
		 ItemName = fdinfo1.match(/Item Name ="([^"]+)"/g);
		 Weight = fdinfo1.match(/Quantity="\d+"/g);
		 Price = fdinfo1.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(fdinfo2) != "") {
		 ItemNum = fdinfo2.match(/ItemID ="\d+"/g);
		 ItemId = fdinfo2.match(/ItemID ="\d+"/g);
		 ItemName = fdinfo2.match(/Item Name="([^"]+)"/g);
		 Weight = fdinfo2.match(/Quantity="\d+"/g);
		 Price = fdinfo2.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(fdinfo3) != "") {
		 ItemNum = fdinfo3.match(/ItemID ="\d+"/g);
		 ItemId = fdinfo3.match(/ItemID ="\d+"/g);
		 ItemName = fdinfo3.match(/Item Name ="([^"]+)"/g);
		 Weight = fdinfo3.match(/Quantity="\d+"/g);
		 Price = fdinfo3.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(fdinfo4) != "") {
		 ItemNum = fdinfo4.match(/ItemID ="\d+"/g);
		 ItemId = fdinfo4.match(/ItemID ="\d+"/g);
		 ItemName = fdinfo4.match(/Item Name ="([^"]+)"/g);
		 Weight = fdinfo4.match(/Quantity="\d+"/g);
		 Price = fdinfo4.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(fdinfo5) != "") {
		 ItemNum = fdinfo5.match(/ItemID ="\d+"/g);
		 ItemId = fdinfo5.match(/ItemID ="\d+"/g);
		 ItemName = fdinfo5.match(/Item Name ="([^"]+)"/g);
		 Weight = fdinfo5.match(/Quantity="\d+"/g);
		 Price = fdinfo5.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(fdinfo6) != "") {
		 ItemNum = fdinfo6.match(/ItemID ="\d+"/g);
		 ItemId = fdinfo6.match(/ItemID ="\d+"/g);
		 ItemName = fdinfo6.match(/Item Name ="([^"]+)"/g);
		 Weight = fdinfo6.match(/Quantity="\d+"/g);
		 Price = fdinfo6.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(sdinfo1) != "") {
		 ItemNum = sdinfo1.match(/ItemID ="\d+"/g);
		 ItemId = sdinfo1.match(/ItemID ="\d+"/g);
		 ItemName = sdinfo1.match(/Item Name ="([^"]+)"/g);
		 Weight = sdinfo1.match(/Quantity="\d+"/g);
		 Price = sdinfo1.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(sdinfo2) != "") {
		 ItemNum = sdinfo2.match(/ItemID ="\d+"/g);
		 ItemId = sdinfo2.match(/ItemID ="\d+"/g);
		 ItemName = sdinfo2.match(/Item Name ="([^"]+)"/g);
		 Weight = sdinfo2.match(/Quantity="\d+"/g);
		 Price = sdinfo2.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	}
	if(alive(sdinfo3) != "") {
		 ItemNum = sdinfo3.match(/ItemID ="\d+"/g);
		 ItemId = sdinfo3.match(/ItemID ="\d+"/g);
		 ItemName = sdinfo3.match(/Item Name ="([^"]+)"/g);
		 Weight = sdinfo3.match(/Quantity="\d+"/g);
		 Price = sdinfo3.match(/priced at "\d*.\d+"/g);
		vmsc += "<tr><td>"+ItemNum+"</td><td>" +ItemId+"</td><td>" +ItemName+"</td><td>" +Weight+"</td><td>" +Price+ "</td></tr>";
	} */
	
	var vetable = "</table></div></body>";

	vfy.document.writeln(vhead+vstable+vsc+vmsc+vetable);
	vfy.document.close();
}


//var stotal = 0 + total;

function OrderForm(prefix, precision, firstChoice) {
	
	this.prefix = prefix ? prefix : '';
	
	// ****************************
	// Configure here
	// ****************************
	// names - Set these according to how the html ids are set
	this.FORM_NAME = this.prefix + 'frmOrder';
	this.BTN_TOTAL = this.prefix + 'btnTotal';
	this.TXT_OUT = this.prefix + 'txtTotal';
	
	// partial names - Set these according to how the html ids are set
	this.CHK = this.prefix + 'chk';
	this.SEL = this.prefix + 'sel';
	this.PRICE = this.prefix + 'txtPrice';
	
	// precision for the decimal places
	// If not set, then no decimal adjustment is made
	this.precision = precision ? precision : -1;
	
	// if the drop down has the first choice after index 1
	// this is used when checking or unchecking a checkbox
	this.firstChoice = firstChoice ? firstChoice : 1;
	// ****************************
	
	// form
	this.frm = document.getElementById(this.FORM_NAME);
	
	// checkboxes
	this.chkReg = new RegExp(this.CHK + '([0-9]+)');
	this.getCheck = function(chkId) {
		return document.getElementById(this.CHK + chkId);
	};
	
	// selects
	this.selReg = new RegExp(this.SEL + '([0-9]+)');
	this.getSelect = function(selId) {
		return document.getElementById(this.SEL + selId);
	};
	
	// price spans
	this.priceReg = new RegExp(this.PRICE + '([0-9]+)');
	
	// text output
	this.txtOut = document.getElementById(this.TXT_OUT);
	
	// button
	this.btnTotal = document.getElementById(this.BTN_TOTAL);
	
	// price array
	this.prices = new Array();
	
	
	var o = this;
	this.getCheckEvent = function() {
		return function() {
			o.checkRetotal(o, this);
			
		};
	};
	
	this.getSelectEvent = function() {
		return function() {
			o.totalCost(o);
		};
	};
	
	
	
	this.getBtnEvent = function() {
		return function() {
			o.totalCost(o);
		};
	};
	
	function checkshipping(){
		totalsPrice = fs + ds;
		fs = 0;
		ds = 0;
		return totalsPrice;
	}
	/*
	 * Calculate the cost
	 * 
	 * Required:
	 *  Span tags around the prices with IDs formatted
	 *  so each item's numbers correspond its select elements and input checkboxes.
	 */
	this.totalCost = function(orderObj) {
		var spanObj = orderObj.frm.getElementsByTagName('span');
		var shippingD = new Array();
		var shippingF = new Array();
		var fquant = 0;
		var dquant = 0;
		    fio = "";
		    sio = "";
		var total = 0.0;
		
		for (var i=0; i<spanObj.length; i++) {
			var regResult = orderObj.priceReg.exec(spanObj[i].id);
			if (regResult) {
				var itemNum = regResult[1];
				var chkObj = orderObj.getCheck(itemNum);
				var selObj = orderObj.getSelect(itemNum);
				var price = orderObj.prices[itemNum];
				bprice = price;
				iNum = itemNum;
				iName = chkObj.name;
				var fshipping = new Array();
				var dshipping = new Array();
				var quantity = 0;
				var vshipping = 0;
				fs = 0;
				ds = 0;
				if (selObj) {
					quantity = parseFloat(selObj.options[selObj.selectedIndex].text);
					// if((quantity < 2) && (quantity <= 1)) var shipping = 6.80;

/* Edit This */

				// Floor and Ceiling test D:  
					var iName = chkObj.name;
					var temp = chkObj.id;
					//var itemObj = temp.replace(/[^a-z]\s/i, temp);
					//var expr = new RegExp('([0-9]+)');
					var itemCase = temp.replace(/\D+/g, "");
					var itemObj = parseInt(itemCase);
					//var itemc = //total ammount of items
					////alert(typeof(itemObj)+" :: "+itemObj+" :: "+itemCase);
					
					// Dry Calc
					if (diff(itemObj, 7, 13)) {
						if (diff(quantity, 1, 1) == true) { 
           				 		//dshipping = dshipping + weightDry1; 
							dquant += quantity;
							sdinfo1 = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+ "\" Quantity=\"" +quantity+ "\" of a total \""+dquant+"\" priced at \""+price+"\"\n"; 
							sio +=  itemNum + "  :: "+sdinfo1;
							//alert("fresh Item.. item id = \""+itemObj+" & "+temp+" & " +dshipping+"\"\n"+sdinfo1); 
						}

						else if (diff(quantity, 2, 5) == true) { 
           				 		//dshipping = dshipping + weightDry25; 
							dquant += quantity;
							sdinfo2 = "ItemID =\"" +itemObj+  "\" Item Name =\"" +iName+ "\" Quantity=\"" +quantity+ "\" of a total \""+dquant+"\" priced at \""+price+"\"\n"; 
							sio += itemNum + "  :: "+ sdinfo2;
							//alert("fresh Item.. item id = \""+itemObj+" & "+temp+" & " +dshipping+"\"\n"+sdinfo2); 
						}

						else if (diff(quantity, 6, 10) == true) { 
           				 		//dshipping = dshipping + weightDry610; 
							dquant += quantity;
							sdinfo3 = "ItemID =\"" +itemObj+  "\" Item Name =\"" +iName+ "\" Quantity=\"" +quantity+ "\" of a total \""+dquant+"\" priced at \""+price+"\"\n"; 
							//alert("fresh Item.. item id = \""+itemObj+" & "+temp+" & " +dshipping+"\"\n"+sdinfo3+" Oh, and price=\""+bprice+"\""); 
							sio += itemNum + "  :: "+sdinfo3;
						}
						if(diff(quantity, 11, 130)){
							dquant += quantity;
							sdinfoi = "ItemID =\"" +itemObj+  "\" Item Name =\"" +iName+ "\" Quantity=\"" +quantity+ "\" of a total \""+dquant+"\" priced at \""+price+"\"\n"; 
							////alert("please call\n"+sdinfoi);}
							sio += itemNum + "  :: "+sdinfoi;
						}
				//		itemReferenced[i] = "ItemNum =\"" +itemNum+ "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+dquant+"\" priced at \""+price+"\"\n";			
					}
					
					// Fresh Calc
					if (diff(itemObj, 0, 6)) { 
						if (diff(quantity, 1, 1) == true) { 
           				 		//fshipping = fshipping + weightFresh1; 
							fquant += quantity;
							fdinfo1 = "ItemID =\"" +itemObj+ 
								  "\" Item Name =\"" +iName+  
							          "\" Quantity=\"" +quantity+ 
							          "\" of a total \""+fquant+
								  "\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfo1;
							//alert("Dry Item.. item id = \""+itemObj+" & "+temp+" & "+ fshipping+"\"\n"+fdinfo1); 
						}

						else if (diff(quantity, 2, 3) == true) { 
           				 		//fshipping = fshipping + weightFresh23; 
							fquant += quantity;
							fdinfo2 = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfo2;
							//alert("Dry Item.. item id = \""+itemObj+" & "+temp+" & "+ fshipping+"\"\n"+fdinfo2); 
						}

						else if (diff(quantity, 4, 5) == true) { 
           				 		//fshipping = fshipping + weightFresh45; 
							fquant += quantity;
							fdinfo3 = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfo3;
							//alert("Dry Item.. item id = \""+itemObj+" & "+temp+" & "+ fshipping+"\"\n"+fdinfo3); 
						}

						else if (diff(quantity, 6, 7) == true) { 
           				 		//fshipping = fshipping + weightFresh67; 
							fquant += quantity;
							fdinfo4 = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfo4;
							//alert("Dry Item.. item id = \""+itemObj+" & "+temp+" & "+ fshipping+"\"\n"+fdinfo4); 
						} 

						else if (diff(quantity, 8, 9) == true) { 
           				 		//fshipping = fshipping + weightFresh89; 
							fquant += quantity;
							fdinfo5 = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfo5;
							//alert("Dry Item.. item id = \""+itemObj+" & "+temp+" & "+ fshipping+"\"\n"+fdinfo5); 
						}

						else if (diff(quantity, 10, 10) == true) { 
           				 		//fshipping = fshipping + weightFresh10; 
							fquant += quantity;
							fdinfo6 = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfo6;
							//alert("Dry Item.. item id = \""+itemObj+" & "+temp+" & "+ fshipping+"\"\n"+fdinfo6); 
						}
						if(diff(quantity, 11, 130)){
							fquant += quantity;
							fdinfoi = "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n"; 
							fio += itemNum + "  :: "+fdinfoi;
							////alert("please call\n"+fdinfoi); }
						}
						//itemReferencef[i] = "ItemNum =\"" +itemNum+ "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" //Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n";
					//sio += sdinfo1+sdinfo2+sdinfo3+sdinfoi;
					//fio += fdinfo1+fdinfo2+fdinfo3+fdinfo4+fdinfo5+fdinfo6+fdinfoi;
					} 
					//else //alert(itemObj);

					quantity = isNaN(quantity) ? 0 : quantity;
					if (chkObj) chkObj.checked = quantity;
				} else if (chkObj) {
					quantity = chkObj.checked ? 1 : 0;
				}
				
				if(diff(dquant, 1, 1)){
				ds += weightDry1; }
				////alert(ds+" :: "+dquant);}
				else if(diff(dquant, 2, 5)){
				ds += weightDry25; }
				////alert(ds+" :: "+dquant);}
				else if(diff(dquant, 6, 10)){
				ds += weightDry610; }
				////alert(ds+" :: "+dquant);}



				if(diff(fquant, 1, 1)){
				fs += weightFresh1; }
				////alert(fs+" :: "+fquant);}
				else if(diff(fquant, 2, 3)){
				fs += weightFresh23; }
				////alert(fs+" :: "+fquant);}
				else if(diff(fquant, 4, 5)){
				fs += weightFresh45; }
				////alert(fs+" :: "+fquant);}
				else if(diff(fquant, 6, 7)){
				fs += weightFresh67; }
				////alert(fs+" :: "+fquant);}
				else if(diff(fquant, 8, 9)){
				fs += weightFresh89; }
				////alert(fs+" :: "+fquant);}
				else if(diff(fquant, 10, 10)){
				fs += weightFresh10; }
				////alert(fs+" :: "+fquant);}

				else if((diff(fquant, 11, 130)) || (diff(dquant, 11, 130))) {
				alert("Please contact us for a special order\n"+
					      "216 East 1st Street\n"+
						  "Cle Elum, WA 98922\n"+
						    "(509) 674-5755");
				//document.open;
				//document.write(fio);
				//document.write(sio);
				//document.close; }
				}
				total += quantity * price; 
				//total = trnstr.exec(total);

			} //total += quantity * price;
		} 
		//alert(ds+"<ds::fs>"+fs);
		
		//total = trnstr.exec(total);
		total += ds + fs;
		total = trnstr.exec(total);
		
		if (this.precision == -1) {
			orderObj.txtOut.value = total
		} else {
			orderObj.txtOut.value = total.toFixed(this.precision);
		}
	itemReferenced = sio;
	itemReferencef = fio;
	//alert("$"+total);
	//itemReferencef += "ItemNum =\"" +itemNum+ "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+fquant+"\" priced at \""+price+"\"\n";
	//itemReferenced += "ItemNum =\"" +itemNum+ "ItemID =\"" +itemObj+ "\" Item Name =\"" +iName+  "\" Quantity=\"" +quantity+ "\" of a total \""+dquant+"\" priced at \""+price+"\"\n";
	//alert(fquant+ " <f::d> "+dquant);
	};

	/*
	 * Handle clicks on the checkboxes
	 *
	 * Required:
	 *  The corresponding select elements and input checkboxes need to be numbered the same
	 *
	 */
	this.checkRetotal = function(orderObj, obj) {
		var regResult = orderObj.chkReg.exec(obj.id);
		if (regResult) {
			////alert("id=\""+obj.id+"\"");
			var optObj = orderObj.getSelect(regResult[1]);
			if (optObj) {
				if (obj.checked) {
					optObj.selectedIndex = orderObj.firstChoice;
				} else {
					optObj.selectedIndex = 0;
				}
			}
			orderObj.totalCost(orderObj);
		}
		return obj;
	};


	function ids(orderObj, obj) {
		var zing = orderObj.chkReg.exec(obj.id);
		if (regResult) {
			////alert("id=\""+obj.id+"\"");
			var optObj = orderObj.getSelect(zing[1]);
			////alert("test .... :: "+optObj+ " :: "+obj);
		}

		return  zing && obj && optObj;
	}	

	this.gc = function() {
		return function() {
			o.ids(o, this);
			return obj.id;
			
		};
	};
	/*
	 * Set up events
	 */
	this.setEvents = function(orderObj) {
		var spanObj = orderObj.frm.getElementsByTagName('span');
		for (var i=0; i<spanObj.length; i++) {
			var regResult = orderObj.priceReg.exec(spanObj[i].id);
			if (regResult) {
				var itemNum = regResult[1];
				var chkObj = orderObj.getCheck(itemNum);
				var selObj = orderObj.getSelect(itemNum);
				if (chkObj) {
					chkObj.onclick = orderObj.getCheckEvent();
				}
				if (selObj) {
					selObj.onchange = orderObj.getSelectEvent();
				}
				if (orderObj.btnTotal) {

					orderObj.btnTotal.onclick = orderObj.getBtnEvent();
				}
			}
		}
	};
	this.setEvents(this);

	/*
	 *
	 * Grab the prices from the html
	 * Required:
	 *  Prices should be wrapped in span tags, numbers only.
	 */
	this.grabPrices = function(orderObj) {
		var spanObj = orderObj.frm.getElementsByTagName('span');
		for (var i=0; i<spanObj.length; i++) {
			if (orderObj.priceReg.test(spanObj[i].id)) {
				var regResult = orderObj.priceReg.exec(spanObj[i].id);
				if (regResult) {
					orderObj.prices[regResult[1]] = parseFloat(spanObj[i].innerHTML);
					//if(regResult.indexOf(".") == -1) regResult += ".00";
					//else regResult += ".00";
					
					regResult = trnstr.exec(regResult);

				}
			}
		}
	};
	this.grabPrices(this);
	
}


