// JavaScript Document

	var currentDuplexType = "Single Sided";

	function changeDuplexView(duplexView){

		currentDuplexType = duplexView;

		if(currentDuplexType == "Single Sided"){
			document.getElementById('simplexLink').className  = "headerRowLinkSelected";
			document.getElementById('duplexLink').className  = "headerRowLink";
			document.getElementById('pricingChart_header').innerHTML = "(Single Sided)";
		}
		else if(currentDuplexType == "Double Sided"){
			document.getElementById('simplexLink').className  = "headerRowLink";
			document.getElementById('duplexLink').className  = "headerRowLinkSelected";
			document.getElementById('pricingChart_header').innerHTML = "(Double Sided)";
		}
		else{
			alert("Illegal Duplex View");
		}

		buildPricingMatrix();
	}

	function getLetterheadPriceChart(productID){

		var productObj = productLoaderObj.getProductObj(productID);

		var priceChartHTML = "<table cellpadding='1' cellspacing='0' width='100%'>";

		priceChartHTML += "<tr><td class='priceChartColumnTitles'>Quantity</td><td class='priceChartColumnTitles'>Price</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();


			selOptionsObj.setOptionChoice("Style", currentDuplexType);

			// Set Options/Quantity in Common for this Row in the Table.
			selOptionsObj.setQuantity(quantitiesArr[i]);

			// Option/Choice
			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);



	function load_Letterhead_PricingDelayed(){
		productLoaderObj.attachProductLoadedEvent(197, buildPricingMatrix);
	}



	function buildPricingMatrix(){
		var priceChartHTML = getLetterheadPriceChart(197);
		document.getElementById('pricingChart').innerHTML = priceChartHTML;
	}
						
								
								
	$j(document).ready(function() {
		setTimeout("load_Letterhead_PricingDelayed()", 2500);
	});