function genProductHtmlGrid(item){
	var displayDiv = new String(item);
	var dataDiv = displayDiv.replace(/Display/g, 'Data');
	var childElem = document.getElementById(dataDiv).childNodes; 
	
	//*** DEFINE ITEM DATA ***
	var itemData = new Object();
	
	for(var i=0;i<childElem.length;i++){
		itemData[childElem[i].id] = String(childElem[i].title);
	}
	//*** PRICE DISPLAY LOGIC ***
	var priceReg = itemData["priceReg"] - 0;
	var priceSale = itemData["priceSale"] - 0;
	if(!priceSale) priceSale = priceReg;
	var priceDisplay = '';
	var onSale = true;
	if(priceReg > priceSale){
		priceDisplay = '<div class="pagedPriceDiv"><div class="pagedPrice">' + pd_regPriceText + '<strike>' + ' ' + formatCurrency(priceReg, true) + '</strike></div><div class="pagedPriceSale">' + pd_salePriceText + ' ' + formatCurrency(itemData["price"]-0, true) + '</div></div>';
		onSale = true;
	}else if(priceReg > 0){
		priceDisplay = '<div class="pagedPriceDiv"><div class="pagedPriceSale">' + formatCurrency(itemData["price"]-0, true) + '</div></div>';
		onSale = false;
	}

	if(pdQuickShopEnabled){
		//*****************************************
		//*** QUICK SHOP ENABLED FOR THIS ITEM? ***
		//*****************************************
		var pdQuickShopItemEnabled = false;
		if((!isBlank(itemData["priceReg"]) || !isBlank(itemData["priceSale"])) && itemData["orderable"] == "T" && itemData["hasOptions"] != "T") pdQuickShopItemEnabled = true;
	}
	var html = '';

	var linkHtml = '<a href="' + itemData["itemId"] + '.html" class="pagedLink">';
	
	if(pdQuickShopEnabled){
		//*****************************************
		//**** CHANGE LINK HTML FOR QUICK SHOP ****
		//*****************************************
		if(pdQuickShopItemEnabled == true){
			linkHtml = '<a href="' + itemData["itemId"] + '.html" class="pagedLink" onmouseover="pdShowQuickShopButton(\'' +  itemData["itemId"] + '\')" onmouseout="pdHideQuickShopButton(\'' +  itemData["itemId"] + '\')">';
		}
				
	}	
	
	//****************************
	//**** PRODUCT IMAGE LINK ****
	//****************************
	html += '<div class="pagingItemImg">' + linkHtml + '<img src="' + itemData["image"] + '" border="0"></a></div>';

	if(pdQuickShopEnabled){
		//********************
		//**** QUICK SHOP ****
		//********************
		if(pdQuickShopItemEnabled == true){
			html += '<div style="position:relative">';
			html += '<div id="pdQuickShopButton-' + itemData["itemId"] + '" class="pdHideQuickShopButton">';
			html += '<a href="#" onclick="pdQuickShopClick(\'' + itemData["itemId"] + '\');return false;" onmouseover="pdShowQuickShopButton(\'' +  itemData["itemId"] + '\')"><img src="http://site.albeebaby.com/pd_quickShop/skin/pdQuickShop.gif"></a>';
			html += '</div>';
			html += '</div>';
		}
	}
	
	html += linkHtml + itemData["name"] + '</a>';

	//********************************************************
	//*** DISPLAY ABSTRACT CONTENT ***************************
	//********************************************************
	if(!isBlank(itemData["abstract"]) && pd_showAbstractText == true){
		html += '<div class="pdPagingAbstract">';
		html += itemData["abstract"];
		html += '</div>';
	}
	
	html += priceDisplay;
	
	//*****************************************
	//**** IN STOCK / OUT OF STOCK DISPLAY ****
	//*****************************************
	$tempInStock = false;
	if(itemData["inStock"] == "T") {
		html += '<div style="color:#7FAE2E;size:14px;font-weight:700">In Stock</div>';
		tempInStock = true;
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] != "T") {
		html += '<div style="color:#7FAE2E;size:14px;font-weight:700">Available</div>';
		tempInStock = true;
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] == "T") {
		html += '<div style="color:#FF0000;size:14px;font-weight:700">Out of Stock</div>';
		tempInStock = false;
	}
	
	//********************************************************
	//*** RETRIEVE DISCOUNT AND CALCULATE DISCOUNTED PRICE ***
	//********************************************************
	var discountPercentage = 0;
	var discountOption = "";
	if(pd_myAccountPricingEnabled && (pd_myAccountPricingNoDiscountForSaleItems == false || (pd_myAccountPricingNoDiscountForSaleItems == true && onSale == false))) {	//*** RESTRICT DISCOUNT TO ONSALE ITEMS
		try {
			discountPercentage = getDiscountPercentage(itemData["itemId"]);
		} catch(e) {
			//*** IGNORE IF NOT AVAILABLE 
		}
	}
	if(discountPercentage > 0) {
		var discountedPrice = priceSale - (priceSale * (discountPercentage/100));		
		html += '<div class="pagingMyAccountPrice">';
		html += "Rewards Price: " + formatCurrency(discountedPrice, true);
		html += "<div>";
		
		var discountAmount = Math.round((priceSale - discountedPrice) * 100)/100;
		discountOption = '<input type="hidden" name="Discount" value="(- $' + formatCurrency(discountAmount) + ')">';		
	}

	//****************************************************************************************//
	//**** DISPLAY ADD TO CART BUTTON IF ITEM IS ORDERABLE/ DOES NOT HAVE OPTIONS ************//
	//****************************************************************************************//
	html += '<div style="margin-top:6px;">';
	// tooke out && itemData["hasOptions"] != "T" from the following If Statement
	

	if((!isBlank(itemData["priceReg"]) || !isBlank(itemData["priceSale"])) && itemData["orderable"] == "T" && tempInStock == true){
		html += '<form method="POST" style="display:inline;" action="http://order.store.yahoo.net/cgi-bin/wg-order?' + pd_yahooStoreId + '+' + itemData["itemId"] + '"';
		html += '>';
		html += '<input name="vwitem" type="hidden" value="' + itemData["itemId"] + '">';
		html += '<input name="vwcatalog" type="hidden" value="' + pd_yahooStoreId + '">';
		html += '<input type="image" src="' + pd_imageUrl + 'pagingaddtocart.gif" border="0">';
		html += '</form>';
	}

	//*****************************************
	//**** IN STOCK / OUT OF STOCK DISPLAY ****
	//*****************************************
	if(itemData["inStock"] == "T") {
		html += '<div style="text-align:center">Usually Ships Same Day<br><a href="javascript:questionPopUp(\'http://www.pureformulas.com/in-stock-popup.html\')">Details</a></div>';
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] != "T") {
		html += '<div style="text-align:center">Ships Within 3 Business Days<br><a href="javascript:questionPopUp(\'http://www.pureformulas.com/item-available-popup.html\')">Details</a></div>';
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] == "T") {
		html += '<div style="text-align:center">Updated Daily</div>';
	}
	
	html += '</div>';

	return html;
}

function questionPopUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=600,left=312,top=184');");
}

function genProductHtmlList(item){
	var displayDiv = new String(item);
	var dataDiv = displayDiv.replace(/Display/g, 'Data');
	var childElem = document.getElementById(dataDiv).childNodes; 

	//*** DEFINE ITEM DATA ***
	var itemData = new Object();
	for(var i=0;i<childElem.length;i++){
		itemData[childElem[i].id] = String(childElem[i].title);
	}
	//*** PRICE DISPLAY LOGIC ***
	var priceReg = itemData["priceReg"] - 0;
	var priceSale = itemData["priceSale"] - 0;
	if(!priceSale) priceSale = priceReg;	
	var priceDisplay = '';
	var onSale = true;
	if(priceReg > priceSale){
		onSale = true;
	} else if(priceReg > 0){
		onSale = false;
	}
	
	
	
	
	html = "";
		
	html += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"875\">";
	html += "<tr>";
	html += "<td width=\"10\"><img src=\"http://ep.yimg.com/ca/Img/trans_1x1.gif\" height=\"1\" width=\"10\" border=\"0\" /></td>";
	html += "<td>";
	html += "<div class=\"pagingItemImg\">";
	html += "<a href=\"" + String(itemData["itemId"]).toLowerCase() + ".html\">";
	html += "<img src=\"" + itemData["image"] + "\" width=\"119\" height=\"120\" border=\"0\" hspace=\"0\" vspace=\"0\" ";
	html += "alt=\"" + itemData["name"] + "\" /></a>";
	html += "</div>";
	html += "</td>";
	html += "<td width=\"99%\"><a href=\"" + String(itemData["itemId"]).toLowerCase() + ".html\" class=\"pagedLink\">" + itemData["name"] + "</a></td>";
	html += "<td width=\"10\"><img src=\"http://ep.yimg.com/ca/Img/trans_1x1.gif\" height=\"1\" width=\"10\" border=\"0\" /></td>";
	html += "<td align=\"right\">";
	html += "<div class=\"pdPagingOrderZone\">";
	html += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	html += "<tr>";
	
	if(onSale == true) {
		html += "<td align=\"right\"><span class=\"pagedPrice\">Regular Price: <strike>" + formatCurrency(priceReg, true) + "</strike></span>";
		html += "<br>";
		html += "<span class=\"pagedPriceSale\">Our Price: " + formatCurrency(priceSale, true) + "</span></td>";
	} else {
		html += "<td align=\"right\"><span class=\"pagedPriceSale\">" + formatCurrency(priceSale, true) + "</span></td>";
	}
	
	html += "</tr>";
	html += "<tr><td><img src=\"http://ep.yimg.com/ca/Img/trans_1x1.gif\" height=\"5\" width=\"1\" border=\"0\" /></td></tr>";
	html += "<tr><td align=\"right\">";
	
	//*****************************************
	//**** IN STOCK / OUT OF STOCK DISPLAY ****
	//*****************************************
	$tempInStock = false;
	if(itemData["inStock"] == "T") {
		html += '<div style="color:#7FAE2E;size:14px;font-weight:700">In Stock</div>';
		tempInStock = true;
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] != "T") {
		html += '<div style="color:#7FAE2E;size:14px;font-weight:700">Available</div>';
		tempInStock = true;
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] == "T") {
		html += '<div style="color:#FF0000;size:14px;font-weight:700">Out of Stock</div>';
		tempInStock = false;
	}
	
	//****************************************************************************************//
	//**** DISPLAY ADD TO CART BUTTON IF ITEM IS ORDERABLE/ DOES NOT HAVE OPTIONS ************//
	//****************************************************************************************//
	html += '<div style="margin-top:6px;">';
	// took out && itemData["hasOptions"] != "T" from the following If Statement
	

	if((!isBlank(itemData["priceReg"]) || !isBlank(itemData["priceSale"])) && itemData["orderable"] == "T" && tempInStock == true){
		html += '<form method="POST" style="display:inline;" action="http://order.store.yahoo.net/cgi-bin/wg-order?' + pd_yahooStoreId + '+' + itemData["itemId"] + '"';
		html += '>';
		html += '<input name="vwitem" type="hidden" value="' + itemData["itemId"] + '">';
		html += '<input name="vwcatalog" type="hidden" value="' + pd_yahooStoreId + '">';
		html += '<input type="image" src="' + pd_imageUrl + 'pagingaddtocart.gif" border="0">';
		html += '</form>';
	}

	//*****************************************
	//**** IN STOCK / OUT OF STOCK DISPLAY ****
	//*****************************************
	if(itemData["inStock"] == "T") {
		html += '<div style="text-align:right">Usually Ships Same Day - <a href="javascript:questionPopUp(\'http://www.pureformulas.com/in-stock-popup.html\')">Details</a></div>';
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] != "T") {
		html += '<div style="text-align:right">Ships Within 3 Business Days - <a href="javascript:questionPopUp(\'http://www.pureformulas.com/item-available-popup.html\')">Details</a></div>';
	} else if(itemData["inStock"] != "T" && itemData["slowVendor"] == "T") {
		html += '<div style="text-align:right">Updated Daily</div>';
	}
	
	
	html += "</div></td></tr>";
	html += "</table>";
	html += "</div>";
	html += "</td>";
	html += "<td width=\"10\"><img src=\"http://ep.yimg.com/ca/Img/trans_1x1.gif\" height=\"1\" width=\"10\" border=\"0\" /></td>";
	html += "</tr>";
	html += "</table>";
	
	
	//**************
	//*** RETURN ***
	//**************	
	return html;
}
