// JavaScript Document

function hlPriceRow(e)
{
	e.style.textDecoration='underline';
}
function dlPriceRow(e)
{
	e.style.textDecoration='none';
}

	
var currentlySelectedProductID = 205;

	
	var totalProductIDs = new Array("205", "206", "207");
	function changeProductLinkHighlight(productId){
		for(var i=0; i<totalProductIDs.length; i++){
	
			if(productId != totalProductIDs[i]){
//				document.getElementById("productLink_top_" + totalProductIDs[i]).className  = "headerRowLink2";
				for(var x=0; x<totalProductIDs.length; x++){
					document.getElementById("productLink_"+totalProductIDs[x]+"_bottom_" + totalProductIDs[i]).className  = "headerRowLink";
	
				}
			}
			else{
//				document.getElementById("productLink_top_" + totalProductIDs[i]).className  = "headerRowLinkSelected2";
				for(var x=0; x<totalProductIDs.length; x++){

					document.getElementById("productLink_"+totalProductIDs[x]+"_bottom_" + totalProductIDs[i]).className  = "headerRowLinkSelected";
				}
			}
		}
	}
	
	
								

	function SwitchProduct(productIDtoShow){

		changeProductLinkHighlight(productIDtoShow);
		document.getElementById('productDetails_' + currentlySelectedProductID).style.display="none";
		document.getElementById('productDetails_' + productIDtoShow).style.display="block";
				currentlySelectedProductID = productIDtoShow;
	
		
		var productSize = "error";
		if(productIDtoShow == 205)
			productSize = "3 x 1.6";
		else if(productIDtoShow == 206)
			productSize = "4 x 2.5";
		else if(productIDtoShow == 207)
			productSize = "6 x 2.5";
			
			
		pricing_Banners3x1_6();
		pricing_Banners4x2_5();
		pricing_Banners6x2_5();

	}
	
	
	function getBannerPriceChart(productId){
		var productObj = productLoaderObj.getProductObj(productId);
		var priceChartHTML = "<table cellpadding='1' cellspacing='0' width='100%' align='center' class='pricing_table'>";
		priceChartHTML += "<tr><td class='priceChartColumnTitles'>Quantity</td><td class='priceChartColumnTitles'>No Grommets</td><td class='priceChartColumnTitles'>Grommets</td></tr>";
		var quantitiesArr = productObj.getQuantityChoicesArr();
		for(var i=0; i<quantitiesArr.length; i++){
			priceChartHTML += "<tr onMouseOver='hlPriceRow(this);' onMouseOut='dlPriceRow(this);'>";
			priceChartHTML += "<td width='30%' class='priceChartTable'>" + addCommas(quantitiesArr[i]) + "</td>";
			var selOptionsObj = productObj.getSelectedOptionsObj();
	
			// Set Options/Quantity in Common for this Row in the Table.
			selOptionsObj.setQuantity(quantitiesArr[i]);
			// Option/Choice
			selOptionsObj.setOptionChoice("Grommets", "No");
			priceChartHTML += "<td width='35%' class='priceChartTable'>$" + addCommas(productObj.getSubtotalOverride(selOptionsObj)) + "</td>";
			// Option/Choice
			selOptionsObj.setOptionChoice("Grommets", "Yes");
			priceChartHTML += "<td width='35%' class='priceChartTable'>$" + addCommas(productObj.getSubtotalOverride(selOptionsObj)) + "</td>";
			priceChartHTML += "</tr>";
		}
		priceChartHTML += "</table>";
		priceChartHTML += "<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='right' class='priceChartBottomBorder'></td></tr></table>";
		return priceChartHTML;
	}
	
	function productLoaderErrorEvent(statusCode, statusDesc){
		alert("An Error Occured downloading Product Details. Some of the Pricing on this page may not be accurate.\n\nError Code: " + statusCode + "\nError Description: " + statusDesc);
	}
	var productLoaderObj = new ProductLoader();
	productLoaderObj.attatchProductLoadingErrorEvent(productLoaderErrorEvent, this);
	

$j(document).ready(function() {
		productLoaderObj.attachProductLoadedEvent(205, pricing_Banners3x1_6);
		productLoaderObj.attachProductLoadedEvent(206, pricing_Banners4x2_5);
		productLoaderObj.attachProductLoadedEvent(207, pricing_Banners6x2_5);

});

			
					function pricing_Banners3x1_6(){
					priceChartHTML = getBannerPriceChart(205);
					document.getElementById('pricingChart_205').innerHTML = priceChartHTML;
					
					}

					function pricing_Banners4x2_5(){
					priceChartHTML = getBannerPriceChart(206);
					document.getElementById("pricingChart_206").innerHTML = priceChartHTML;
					}
	
				function pricing_Banners6x2_5(){
				priceChartHTML = getBannerPriceChart(207);
				document.getElementById('pricingChart_207').innerHTML = priceChartHTML;
								}
	
