// JavaScript Document

	var currentSelectRow = null;

// Load Event ***********************

	addLoadEvent(pageInit);
	
	if (IE)
	{
		addMouseMoveEvent(checkSelectedContainerMouseOut);
	}
	
// Intialization **********************

	function pageInit()
	{
		// Product Selection *************
		setProductSelectRowActions();
		
		// Check for Cart Info ****************
		checkForCartInfo();
		
	}

/*  Set Product Select Row Actions * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/

	function setProductSelectRowActions()
	{
		var productSelectRowElements = getTagGroup("div", "productSelectRow");
		
		var iterateAction = function(productSelectRow, ctr)
		{
			productSelectRow.onmouseover = function()
			{
				if (currentSelectRow != null)
				{
					currentSelectRow.className = "configureProductContainer";
				}
				
				currentSelectRow = this;
				this.className = "productSelectRowMouseOver";
			}
			
			productSelectRow.onmouseout = function()
			{
				if (!IE)
				{
					this.className = "configureProductContainer";
				}
			}
			
			productSelectRow.onclick = function()
			{
				var productNo = this.id.replace("productSelectRow", "");
				selectProduct(productNo);
			}
		}
		
		iterateElementList(productSelectRowElements, iterateAction);
		
	}

/* Check Selected Container Mouse Out * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function checkSelectedContainerMouseOut()
	{
		var selectProductsElement = getElement("selectProductsLightboxes");
		
		if (!containsMousePoint(selectProductsElement) & (currentSelectRow != null))
		{
			currentSelectRow.className = "configureProductContainer";	
		}
		
		//getElement("updateData").innerHTML += "<div style=\"color: white;\">Element: " + getElementX(selectProductsElement) + ", " + getElementY(selectProductsElement) + "\nMouse: " + mousePositionX + ", " + mousePositionY + "\n" + containsMousePoint(selectProductsElement) + "</div>";
	}

/*  Select Product * *******************************************************
 *
 *	TAKES:		Product Id
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function selectProduct(productId)
	{
		if (productId != "")
		{
			// Hide the "No Products Selected", Show Table *********************
			hideElement("noProductsPane");
			showElement("productsTableContainer");
			
			hideElement("noProductsConfigPane");
			showElement("configureProductsContainer");
			
			hideElement("errorPaneSelectedProducts");
			
			
			// Add a new Column to Product Table *********************************
			var selectedProductsElement = getElement("PaneSelectedProducts");
			
			// Number of Selected Products ************************************
			var numSelectedProducts = getTagGroup("div", "selectedProduct.");
			numSelectedProducts = numSelectedProducts.length;
			
			// Add to the Row ******************
			var productsTableRowCol = document.createElement("td");
			productsTableRowCol.appendChild(getProductContainer(productId, numSelectedProducts));
			
			getElement("productsTable").rows[0].appendChild(productsTableRowCol);
			
		}
	}

/*  Get Product Container * *******************************************************
 *
 *	TAKES:		Product Id, Selected No.
 * 	RETURNS:	Product Container
 *
 *************************************************************************/
 
	function getProductContainer(productId, selectedNo)
	{
		if (productId != "")
		{
			var productImageElement 	= getElement("productImage" + productId);
			var productNameElement 		= getElement("productName" + productId);
			
			var productContainer 	= document.createElement("div");
			
			productContainer.id = "selectedProduct." + selectedNo + "." + productId;
			productContainer.className = "selectedProductContainer";
			
			var containerTable 		= document.createElement("table");
			var tableBody	 		= document.createElement("tbody");
			
			// Row 1 ********************************
			
				var tableRow1	 		= document.createElement("tr");
				var tableColLeft	 	= document.createElement("td");
				var tableColRight	 	= document.createElement("td");
			
				tableColLeft.style.width = "75px";
				tableColLeft.align = "right";
				
					var thumbnailImage = document.createElement("img");
					thumbnailImage.src = productImageElement.src;
					thumbnailImage.height = 50;
					thumbnailImage.width = 50;
					
				tableColLeft.appendChild(thumbnailImage);
				
				tableColRight.innerHTML = "<img src=\"/images/closeBtnRed.png\" onmouseover=\"this.style.cursor='pointer';\" onclick=\"removeProduct('" + productId + "', '" + selectedNo + "');\">";
				tableColRight.vAlign = "top";
				
				tableRow1.appendChild(tableColLeft);
				tableRow1.appendChild(tableColRight);
			
			// Row 2 *********************************
			
				var tableRow2	 		= document.createElement("tr");
				var tableCol		 	= document.createElement("td");
				
				tableCol.colSpan = 2;
				
					var thumbnailNameContainer = document.createElement("div");
					thumbnailNameContainer.className = "selectedProductThumbnailName";
					thumbnailNameContainer.innerHTML =productNameElement.innerHTML;
				
				tableCol.appendChild(thumbnailNameContainer);
				tableRow2.appendChild(tableCol);
				
			tableBody.appendChild(tableRow1);
			tableBody.appendChild(tableRow2);
			containerTable.appendChild(tableBody);
			productContainer.appendChild(containerTable);
		}
		
		return productContainer
	}

/*  Remove Product * *******************************************************
 *
 *	TAKES:		Product Id, Selected No.
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function removeProduct(productId, selectedNo)
	{
		// Select Products ***************************
		
		var productContainerElement = getElement("selectedProduct." + selectedNo + "." + productId);
		var productTableElement = getElement("productsTable");
		
		if (productContainerElement)
		{
			var removeColumn = productContainerElement.parentNode;
			var tableRow = productTableElement.rows[0]; // Only one row
			
			tableRow.removeChild(removeColumn);
		}
		
		// Config Products ***************************
		
		var productConfigContainerElement = getElement("productConfigContainer." + selectedNo + "." + productId);
		
		if (productConfigContainerElement)
		{
			productConfigContainerElement.parentNode.removeChild(productConfigContainerElement);
		}
		
		if (productsTableIsEmpty())
		{
			// Show the "No Products Selected", Show Table *********************
			hideElement("productsTableContainer");
			showElement("noProductsPane");
			
			hideElement("configureProductsContainer");
			showElement("noProductsConfigPane");
			
		}
		
		// Form Data Element **********************
		var formDataElement = getElement("productInfo." + selectedNo + "." + productId);
		
		if (formDataElement)
		{
			formDataElement.parentNode.removeChild(formDataElement);	
		}
		
	}
	
/*  Products Table Is Empty  * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	True if the products table is empty otherwise False.
 *
 *************************************************************************/
 
	function productsTableIsEmpty()
	{
		var productTableElement = getElement("productsTable");
		var tableRow = productTableElement.rows[0]; // Only one row
		var isEmpty = false;
		
		if (tableRow.cells.length == 0)
		{
			isEmpty = true;
		}
		
		return isEmpty;
	}

/*  Disable All Clickable Tabs * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function disableAllClickableTabs()
	{
		var tabElements = getElementsByComponent("pageTab")	
		
		var iterateAction = function(tabElement, ctr)
		{
			setComponentAttributeValue(tabElement, "clickable", false);
		}
		
		iterateElementList(tabElements, iterateAction);
	}
	
/*  Save Selected Products Tab  * *******************************************************
 *
 *	TAKES:		Action Source
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function saveSelectedProductsTab(actionSource)
	{
		var formDataElements = getElement("formDataElements");
		var selectedProductElements = getTagGroup("div", "selectedProduct");
		
		if (selectedProductElements.length > 0)
		{
			// Remove old product data **************************
			
				var oldProductElements = getTagGroup("input", "productInfo");
				
				var iterateAction = function(oldProductElement, ctr)
				{
					formDataElements.removeChild(oldProductElement);
				}
				
				iterateElementList(oldProductElements, iterateAction);
			
			
			// Add new product data *************************************
			
				iterateAction = function(selectedProductElement, ctr)
				{
					var productArray = selectedProductElement.id.split("."); 
					var selectedNo = productArray[1]; 
					var productId = productArray[2];
					
					addFormDataElement("productInfo" + selectedNo, productId + ", , 1");
				}
				
				iterateElementList(selectedProductElements, iterateAction);
				
				if (actionSource == "button")
				{
					setNextPageTab();
				}
				
				setProductConfigurationList();
				
				// Enable Page Tab Click *********************
				setComponentAttributeValue(activePageTab, "clickable", "true");
		}
		else
		{
			showElement("errorPaneSelectedProducts");
			
			if (actionSource == "tab")
			{
				cancelTabActivation = true;	
			}
		}
	}
	
/*  Save Configure Products Tab  * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function saveConfigureProductsTab(actionSource)
	{
		var formDataElements = getElement("formDataElements");
		
		var hiddenValue = "";
		var valueArray = "";
		var errorsExist = false;
		
		// Update product data *************************************
		
			var sizeElements = getTagGroup("select", "configProductSize");
			var qtyElements = getTagGroup("input", "configProductQty");
			
			// Size ***************************************
			iterateAction = function(sizeElement, ctr)
			{
				var productArray = sizeElement.id.split(".");
				var selectedNo = productArray[1]; 
				var productId = productArray[2];
				
				var hiddenElement = getElement("productInfo" + selectedNo);
				
				if (hiddenElement)
				{
					hiddenValue = hiddenElement.value;
					valueArray = hiddenValue.split(", ");
					hiddenElement.value = valueArray[0] + ", " + sizeElement.options[sizeElement.selectedIndex].value + ", " + valueArray[2];
				}
				
			}
			
			iterateElementList(sizeElements, iterateAction);
			
			// Qty ***************************************
			iterateAction = function(qtyElement, ctr)
			{
				var errorCheck = dataIsValid(qtyElement.value, "integer");
				
				var productArray = qtyElement.id.split(".");
				var selectedNo = productArray[1]; 
				var productId = productArray[2];
					
				if (errorCheck == true)
				{
					hideElement("configProductQtyError." + selectedNo + "." + productId);
					qtyElement.className = "editTextbox";
				
					var hiddenElement = getElement("productInfo" + selectedNo);
					
					if (hiddenElement)
					{
						hiddenValue = hiddenElement.value;
						valueArray = hiddenValue.split(", ");
						hiddenElement.value = valueArray[0] + ", " + valueArray[1] + ", " + qtyElement.value;
					}
				}
				else
				{
					// Throw Error ******************
					errorsExist = true;
					showElement("configProductQtyError." + selectedNo + "." + productId);
					qtyElement.className = "editTextboxError";
				}
			}
			
			iterateElementList(qtyElements, iterateAction);
			
			if (!errorsExist)
			{
				if (actionSource == "button")
				{
					setNextPageTab();
				}
				
				// Enable Page Tab Click *********************
				setComponentAttributeValue(activePageTab, "clickable", "true");
			}
			else
			{
				if (actionSource == "tab")
				{
					cancelTabActivation = true;	
				}
			}
	
	}

/*  Save Ship To Address Tab  * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function saveShipToAddressTab(actionSource)
	{
		var formDataElements = getElement("formDataElements");
		var allComponents = new Array();
		
		// Coutnry Type *******************************
		if (getElement("countryUs").checked)
		{
			var editTextComponents = getElementsByComponent("editText");
			var dropdownListComponents = getElementsByComponent("dropdownList");
		
			allComponents = editTextComponents.concat(dropdownListComponents);
		}
		else
		{
			allComponents = allComponents.concat(getElement("shipToInternational"));
		}
		
		// Loop ***************************************
		var errorsExist =  false;
		
		iterateAction = function(editTextComponent, ctr)
		{
			var componentDataType 	= getComponentAttributeValue(editTextComponent, "dataType");
			var componentValue 		= getComponentValue(editTextComponent.id);
			
			// Break *********************
			componentValue = componentValue.replace(/\n/g, "@BREAK@");
			
			if (componentValue == "- Select -")
			{
				componentValue = "";
			}
			
			// Error Check ******************************
			var errorCheck 			= dataIsValid(componentValue, componentDataType);
			
			if ((errorCheck == true) & (componentValue != ""))
			{
				clearComponentError(editTextComponent);
									
				var existingElement = getElement(editTextComponent.id + "Value");
				
				if (existingElement)
				{
					existingElement.value = componentValue;
				}	
				else
				{
					addFormDataElement(editTextComponent.id + "Value", componentValue);
				}
			}
			else
			{
				errorsExist = true;
				
				if (componentValue == "")
				{
					errorCheck = "Please fill out this required field.";	
				}
				
				throwComponentError(editTextComponent, errorCheck);
			}
		}
		
		iterateElementList(allComponents, iterateAction);
		
		if (!errorsExist)
		{
			if (actionSource == "button")
			{
				setNextPageTab();
			}
			
			// Enable Page Tab Click *********************
			setComponentAttributeValue(activePageTab, "clickable", "true");
		}
		else
		{
			if (actionSource == "tab")
			{
				cancelTabActivation = true;	
			}
		}
		
	}

/*  Save Shipping Option Tab  * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function saveShippingOptionsTab()
	{
		var formDataElements = getElement("formDataElements");
		
		// Values ***************************
		var specialInstr 			= getComponentValue("shipOptionsSpecialInstr");
		specialInstr				= specialInstr.replace(/\n/g, "@BREAK@");
		
		var shipMethodValue 		= getCheckedValues("shipOptionsMethod");
		var shipAddressTypeValue 	= getRadioValue("shipOptionsAddressType");
		
		var receivingDockValue 		= "";
		var forkLiftValue 			= "";
		var insideDeliveryValue 	= "";
		var twoCapableValue		 	= "";
		
		if (isVisible("commercialShippingOptions"))
		{
			receivingDockValue = getRadioValue("shipOptionsReceivingDock");
			
			if (isVisible("receivingDockOptions"))
			{
				forkLiftValue  		= getRadioValue("shipOptionsForkLift");
				insideDeliveryValue = getRadioValue("shipOptionsInsideDelivery");
				twoCapableValue 	= getRadioValue("shipOptions2Capable");
			}
		}
		
		addFormDataElement("shipMethod", shipMethodValue);
		addFormDataElement("shipAddressType", shipAddressTypeValue);
		
			addFormDataElement("receivingDockValue", receivingDockValue);
			
				addFormDataElement("forkLiftValue", forkLiftValue);
				addFormDataElement("insideDeliveryValue", insideDeliveryValue);
				addFormDataElement("twoCapableValue", twoCapableValue);
				
		
		if (dataIsValid(specialInstr, "text") == true)
		{
			addFormDataElement("specialInstr", specialInstr);
		}
		
		//checkAllTabValues();
		setNextPageTab();
		
		// Enable Page Tab Click *********************
		setComponentAttributeValue(activePageTab, "clickable", "true");
	}


/*  Add Form Data Element * *******************************************************
 *
 *	TAKES:		Data Id, Data Value
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function addFormDataElement(dataId, dataValue)
	{
		var formDataElements = getElement("formDataElements");
		
		var existingElement = getElement(dataId);
		
		if (existingElement)
		{
			existingElement.parentNode.removeChild(existingElement);
		}
	
		var hiddenElement = document.createElement("input");
		hiddenElement.setAttribute("type", "hidden");
		hiddenElement.setAttribute("id", dataId);
		hiddenElement.setAttribute("value", dataValue);
		
		formDataElements.appendChild(hiddenElement);
	}
	
/*  Set Products Configuration List  * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *	NOTES:		Builds the list from the Form Data Elements
 *
 *************************************************************************/
 
	function setProductConfigurationList()
	{
		var selectedProductElements = getTagGroup("div", "selectedProduct");
		var configureProductsContainer = getElement("configureProductsContainer");
		
		// Clear out the list ******************************
		configureProductsContainer.innerHTML = "";
		
		iterateAction = function(selectedProductElement, ctr)
		{
			var productArray = selectedProductElement.id.split("."); 
			var selectedNo = productArray[1] 
			var productId = productArray[2];
					
			var productImageElement 	= getElement("productImage" + productId);
			var productNameElement 		= getElement("productName" + productId);
			
			var productContainer 		= document.createElement("div");
			productContainer.id			= "productConfigContainer." + selectedNo + "." + productId;
			productContainer.className 	= "configureProductContainer";
			
			var productTable 	= document.createElement("table");
			var tableBody 		= document.createElement("tbody");
			var tableRow 		= document.createElement("tr");
			var col1	 		= document.createElement("td");
			var col2	 		= document.createElement("td");
			var col3	 		= document.createElement("td");
			
			productTable.cellPadding = "5";
			productTable.width = "100%";
			
			tableRow.vAlign = "top";
			
			// Column 1 *******************
				
				col1.width = "50"
				col1.innerHTML = "<img src=\"" + productImageElement.src + "\" height=\"50\">";
				
			//Colummn 2 ************************
			
				var productNameContainer = document.createElement("div");
				productNameContainer.className = "shipQuoteProductTitle";
				productNameContainer.innerHTML =  productNameElement.innerHTML
				
				var productConfigTableContainer = document.createElement("div");
				var productConfigTable 			= document.createElement("table");
				var configTableBody 			= document.createElement("tbody");
				
				productConfigTable.cellPadding = "5";
				
				// Row 1 ************************
				
					var configTableRow			= document.createElement("tr");
					var configRowCol1	 		= document.createElement("td");
					var configRowCol2	 		= document.createElement("td");	
					
					configRowCol1.innerHTML = "Size:";
					configRowCol2.innerHTML = "<select id=\"configProductSize." + selectedNo + "." + productId + "\"></select>";
					
					configTableRow.appendChild(configRowCol1);
					configTableRow.appendChild(configRowCol2);
					
					var configRowCol3	 		= document.createElement("td");
					var configRowCol4	 		= document.createElement("td");
					
					configRowCol3.innerHTML = "Qty:";
					configRowCol4.innerHTML = "<input type=\"text\" size=\"1\" id=\"configProductQty." + selectedNo + "." + productId + "\" value=\"1\" style=\"text-align: center;\">";
					
					configTableRow.appendChild(configRowCol3);
					configTableRow.appendChild(configRowCol4);
					
				configTableBody.appendChild(configTableRow);
				
				productConfigTable.appendChild(configTableBody);
				productConfigTableContainer.appendChild(productConfigTable);
				
				col2.appendChild(productNameContainer);
				col2.appendChild(productConfigTableContainer);
			
			// Column 3 *******************************
			col3.vAlign = "middle";
			col3.innerHTML = "&nbsp;&nbsp;<span id=\"configProductQtyError." + selectedNo + "." + productId + "\" style=\"color: red; display: none;\">Please enter a whole number! (ex: 1, 2, 3)</span>";
				
			tableRow.valign = "top";
			tableRow.appendChild(col1);
			tableRow.appendChild(col2);
			tableRow.appendChild(col3);
			
			tableBody.appendChild(tableRow);
			productTable.appendChild(tableBody);
			productContainer.appendChild(productTable);
			
			configureProductsContainer.appendChild(productContainer);
			
			// Size Info **********************
			
			if (Left(productId, 2) == "51")
			{
				getProductConfigSizes(productId, selectedNo);
			}
		}
		
		iterateElementList(selectedProductElements, iterateAction);
	}
	
/*  Get Product Config Sizes  * *******************************************************
 *
 *	TAKES:		Product Id, Selected Product No.
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function getProductConfigSizes(productId, selectedNo)
	{
		if (productId != "")
		{
			setAjaxUrl("updateData", "ajaxShipQuoteRequest.asp?action=getLightboxSizes&modelNo=" + productId, false, "setProductConfigSizes('" + productId + "', '" + selectedNo + "');");
		}
	}
	
/*  Get Product Config Sizes  * *******************************************************
 *
 *	TAKES:		Product Id, Selected Product No.
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function setProductConfigSizes(productId, selectedNo)
	{
		var sizeElements 	= getTagGroup("input", "sizeValue");
		var selectElement 	= getElement("configProductSize." + selectedNo + "." + productId);
		
		var iterateAction = function(sizeElement, ctr)
		{
			var optionElement = document.createElement("option");
			optionElement.value = sizeElement.value;
			optionElement.text = sizeElement.value;
			
			try
			{
				selectElement.add(optionElement, null); // standards compliant
			}
			catch(ex)
			{
				selectElement.add(optionElement); // IE only
			}
		}
		
		iterateElementList(sizeElements, iterateAction);
		
		//resultElements.innerHTML = "";
	}

/*  Enable Commercial Shipping Options * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
 
	function enableCommercialShippingOptions()
	{
		showElement("commercialShippingOptions");
	}
	
/*  Disable Commercial Shipping Options * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
 
	function disableCommercialShippingOptions()
	{
		hideElement("commercialShippingOptions");
	}
	
/*  Enable Receiving Dock Options * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
 
	function enableReceivingDockOptions()
	{
		showElement("receivingDockOptions");
	}
	
/*  Disable Commercial Shipping Options * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
 
	function disableReceivingDockOptions()
	{
		hideElement("receivingDockOptions");
	}

/*  Enable US Address* *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function enableUsAddress()
	{
		hideElement("internationalAddress");
		showElement("usAddress");
		
		var internationalElement = getElement("shipToInternationalValue");
		
		if (internationalElement)
		{
			internationalElement.value = "";	
		}
		
	}
	
/*  Enable International Address* *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function enableInternationalAddress()
	{
		hideElement("usAddress");
		showElement("internationalAddress");
	}

/*  Toggle Login Panel * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function toggleLoginPanel()
	{
		if (isVisible("loginText"))
		{
			hideElement("loginText");
			hideElement("createLoginBtn");
			
			showElement("createAccountPane");
			showElement("loginBtn");
		}
		else
		{
			hideElement("createAccountPane");
			hideElement("loginBtn");
			
			showElement("loginText");
			showElement("createLoginBtn");
			
		}
	}


/*  On Login Success * *******************************************************
 *
 *	TAKES:		Client Id Value
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function onLoginSuccess(clientIdValue)
	{
		submitShippingQuoteRequest(clientIdValue);
	}
	
/*  On Login Success * *******************************************************
 *
 *	TAKES:		Client Id Value
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function submitShippingQuoteRequest(clientIdValue)
	{
		// Product Info *****************
		var productInfoElements = getTagGroup("input", "productInfo");
		
		// Ship To Address **************
		var shipToInternational 	= getValue("shipToInternationalValue");
		var shipToAddress1Value 	= getValue("shipToAddress1Value");
		var shipToCityValue 		= getValue("shipToCityValue");
		var shipToZipValue	 		= getValue("shipToZipValue");
		var shipToStateValue 		= getValue("shipToStateValue");
		
		// Shipping Options **************
		var specialInstr 			= getValue("specialInstr");
		var shipMethodValue 		= getValue("shipMethod");
		var shipAddressTypeValue 	= getValue("shipAddressType");
		
			var receivingDock 			= getValue("receivingDockValue");
				
				var forkLift 			= getValue("forkLiftValue");
				var insideDelivery 		= getValue("insideDeliveryValue");
				var twoCapable 			= getValue("twoCapableValue");
		
		// Encode the BREAK tags **************
		
		if (shipToInternational != null) { shipToInternational = shipToInternational.replace(/@BREAK@/g, "<br>"); }
		if (specialInstr != null) { specialInstr = specialInstr.replace(/@BREAK@/g, "<br>"); }
		
		var queryString = "&address1=" + encodeQueryString(shipToAddress1Value);
		queryString += "&city=" + encodeQueryString(shipToCityValue);
		queryString += "&state=" + encodeQueryString(shipToStateValue);
		queryString += "&zip=" + encodeQueryString(shipToZipValue);
		queryString += "&specialInstr=" + encodeQueryString(specialInstr);
		queryString += "&shipMethod=" + encodeQueryString(shipMethodValue);
		queryString += "&addressType=" + encodeQueryString(shipAddressTypeValue);
		queryString += "&receivingDock=" + encodeQueryString(receivingDock);
		queryString += "&insideDelivery=" + encodeQueryString(insideDelivery);
		queryString += "&forkLift=" + encodeQueryString(forkLift);
		queryString += "&twoCapable=" + encodeQueryString(twoCapable);
		queryString += "&clientId=" + encodeQueryString(clientIdValue);
		queryString += "&numProducts=" + productInfoElements.length;
		queryString += "&internationalAddress=" + encodeQueryString(shipToInternational);
		
		var iterateAction = function(productInfoElement, ctr)
		{
			queryString += "&productInfo" + ctr + "=" + encodeQueryString(productInfoElement.value);
		}
		
		iterateElementList(productInfoElements, iterateAction);
		
		setAjaxUrl("updateData", "ajaxShipQuoteRequest.asp?action=submit" + queryString, "loadingBarPopup('Submiting Your Request');", "getSubmitResult();");
	}

/*  Get Submit Result * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function getSubmitResult()
	{
		var result = getElement("updateData").innerHTML;
		getElement("updateData").innerHTML = "";
		
		if ((result != "") & (result.indexOf("ERROR") == -1))
		{
			location.href = "/hardware/backlit/ship_quote_complete.asp?success=yes&quoteNum=" + result;
		}
		else //Error
		{
			result = result.replace("ERROR: ");
			var alertMessage = "There was a problem submiting your ship quote request:<br><br><span style=\"color: red\">" + result + "</span><br><br>If you continue to experience problems, please contact our sales department at 800-706-4276 for assistance.";
			alertShadedPopup("<b>ERROR: Submiting Your Ship Quote Request</b>", alertMessage);
		}
		
	}

	
	
	
	
	
	
	

			


















