// JavaScript Document
function displayComboOrder () {
	document.getElementById("order_container").style.width = '348px'; //174 original width x2
	document.getElementById("order_container").style.height = '400px';
	document.getElementById("order_background_catchall").style.width = '348px'; //the catch all is for mouse over with drop downs so we don't have the order bar accidentally close
	document.getElementById("order_background_catchall").style.height = '400px';
	document.getElementById("prices_table").style.position = 'absolute';
	document.getElementById("prices_table").style.right = '0px';
	document.getElementById("prices_table").style.bottom = '0px';
	document.getElementById("product-order").style.position = 'absolute';
	document.getElementById("product-order").style.left = '0px';
	document.getElementById("product-order").style.bottom = '0px';
		

}
function hideComboOrder () {
	document.getElementById("order_container").style.width = '174px';
	document.getElementById("order_container").style.height = '';
	document.getElementById("order_background_catchall").style.width = '';
	document.getElementById("order_background_catchall").style.height = '';
	document.getElementById("prices_table").style.position = 'relative';
	document.getElementById("prices_table").style.right = '';
	document.getElementById("prices_table").style.bottom = '';
	document.getElementById("product-order").style.position = 'relative';
	document.getElementById("product-order").style.left = '';
	document.getElementById("product-order").style.bottom = '';
}
var combo_dd_open = '';
function showDropDown_Combo (which) {

/*	for (var i = 1; i <= numberOfComboDropDowns; i++) {*/
	for (var i = 1; i <= 10; i++) {
		if (i == which) {
			if (document.getElementById("combodropdown"+i)) {
					if (combo_dd_open == which) {
						// the drop down is already open so close it
						combo_dd_open = ''; //nothing is open
						document.getElementById("combodropdown"+i).style.display = 'none';
					} else {
						//open the combo drop down
						combo_dd_open = i;
						document.getElementById("combodropdown"+i).style.display = 'block';
						document.getElementById("combodropdown"+i).style.zIndex = '+100000';
					}
			}
		} else {
			//close all other combo drop downs
			// ToDo: Fix it, i don't know why is missing the element
			// commented by Franco
/*			document.getElementById("combodropdown"+i).style.display = 'none';*/
		}
	}
}
var comboSelectedDrop =new Array();
comboSelectedDrop[0]=false;
comboSelectedDrop[1]=false;
comboSelectedDrop[2]=false;
comboSelectedDrop[3]=false;
comboSelectedDrop[4]=false;
function comboSelect (value, number) {
	document.getElementById("pthecolor"+number).innerHTML = '&nbsp;'+value;
	document.getElementById("combocolor"+number).value = value;
	comboSelectedDrop[(number-1)] = true;
	var allCombosSelected = true;
	
/*	for (var i = 1; i <= numberOfComboDropDowns; i++) {*/
	for (var i = 1; i <= 10; i++) {
		if (document.getElementById("combodropdown"+i)){
			if ( !comboSelectedDrop[(i-1)] ) {
				allCombosSelected = false;
				break;
			}	
		}
	}

	if (allCombosSelected) {
		//all drop downs have been selected so activate the 'add to cart' button
		document.getElementById("orderbutton_overlay").style.visibility = 'hidden';
	}
	showDropDown_Combo(number); //close the drop down
}
/* --------------------------------------- end of combo product functions ----------------------------- */

var dropdown_qty = 0;
function showProdDrowDownQty () {
	if (document.getElementById("prod_color_dropdown")) {
		document.getElementById("prod_color_dropdown").style.display = 'none';
	}
	if (document.getElementById("prod_size_dropdown")) {
		document.getElementById("prod_size_dropdown").style.display = 'none';
	}
	if (dropdown_qty == 0) {
		dropdown_qty = 1;
		//show
		document.getElementById("prod_quantity_dropdown").style.display = 'block';
	} else {
		dropdown_qty = 0;
		//hide
		document.getElementById("prod_quantity_dropdown").style.display = 'none';
	}
}
var dropdown_color = 0;
function showProdDrowDownColor () {
	if (document.getElementById("prod_quantity_dropdown")) {
		document.getElementById("prod_quantity_dropdown").style.display = 'none';
	}
	if (document.getElementById("prod_size_dropdown")) {
		document.getElementById("prod_size_dropdown").style.display = 'none';
	}
	if (dropdown_color == 0) {
		dropdown_color = 1;
		//show
		document.getElementById("prod_color_dropdown").style.display = 'block';
	} else {
		dropdown_color = 0;
		//hide
		document.getElementById("prod_color_dropdown").style.display = 'none';
	}	
}
var dropdown_size = 0;
function showProdDrowDownSize () {
	if (document.getElementById("prod_quantity_dropdown")) {
		document.getElementById("prod_quantity_dropdown").style.display = 'none';
	}
	if (document.getElementById("prod_color_dropdown")) {
		document.getElementById("prod_color_dropdown").style.display = 'none';
	}
	if (dropdown_size == 0) {
		dropdown_size = 1;
		//show
		document.getElementById("prod_size_dropdown").style.display = 'block';
	} else {
		dropdown_size = 0;
		//hide
		document.getElementById("prod_size_dropdown").style.display = 'none';
	}	
}
function prodSelectedQuantity (value) {
	document.getElementById("pthequantity").innerHTML = '&nbsp;'+value;
	document.getElementById("product_quantity").value = value;
	checkShowOfAddtoCart();
	showProdDrowDownQty();
}

function prodSelectedColor (value) {
	document.getElementById("pthecolor").innerHTML = '&nbsp;'+value;
	document.getElementById("product_color").value = value;
	checkShowOfAddtoCart ();
	showProdDrowDownColor();
}

function prodSelectedSize (value) {
	document.getElementById("pthesize").innerHTML = '&nbsp;'+value;
	document.getElementById("product_size").value = value;
	checkShowOfAddtoCart ();
	showProdDrowDownSize();
}

function checkShowOfAddtoCart () {
	if (document.getElementById("prod_color_dropdown")== null && document.getElementById("prod_size_dropdown")== null) {
		if (document.getElementById("product_quantity").value != "") {
			//ok the quantity has been selected enable the 'add to cart' button
			document.getElementById("orderbutton_overlay").style.visibility = 'hidden';
		}
	} else if (document.getElementById("prod_color_dropdown")!= null && document.getElementById("prod_size_dropdown")== null) {
		if (document.getElementById("product_quantity").value != "" && document.getElementById("product_color").value != "") {
			//ok the quantity and color have been selected enable the 'add to cart' button
			document.getElementById("orderbutton_overlay").style.visibility = 'hidden';
		}
	} else if (document.getElementById("prod_color_dropdown")== null && document.getElementById("prod_size_dropdown")!= null) {
		if (document.getElementById("product_quantity").value != "" && document.getElementById("product_size").value != "") {
			//ok the quantity and color have been selected enable the 'add to cart' button
			document.getElementById("orderbutton_overlay").style.visibility = 'hidden';
		}
	} else if (document.getElementById("prod_color_dropdown")!= null && document.getElementById("prod_size_dropdown")!= null) {
		if (document.getElementById("product_quantity").value != "" && document.getElementById("product_color").value != "" && document.getElementById("product_size").value != "") {
			//ok the quantity and color have been selected enable the 'add to cart' button
			document.getElementById("orderbutton_overlay").style.visibility = 'hidden';
		}
	
	}
}
function resetOrderHere() {
	document.getElementById("orderbutton_overlay").style.visibility = "visible";
	document.getElementById("pthequantity").innerHTML = '&nbsp;Make Selection';
	if (document.getElementById("pthecolor") != null) {
	document.getElementById("pthecolor").innerHTML = '&nbsp;Make Selection';
	}
	document.getElementById("product_quantity").value = '';
	document.getElementById("product_color").value = '';
}
function row_highlight (whichrow) {
	/* when mouse over product order bar drop down menus highlight */
	document.getElementById('d'+whichrow).style.backgroundColor = '#666666';
	document.getElementById('p'+whichrow).style.color = '#FFFFFF';
}
function row_unhighlight (whichrow) {
	/* when mouse out of product order bar drop down menus return highlight to normal */
	document.getElementById('d'+whichrow).style.backgroundColor = '#FFFFFF';
	document.getElementById('p'+whichrow).style.color = '#000000';
}


custom_showhide_check = 0;
function showHideCustomForm (whichscreen) {
	
	if (whichscreen == 'custom') {
		if (custom_showhide_check == 0) {
			custom_showhide_check = 1;
			document.getElementById("customform_main").style.visibility = 'visible';
			document.getElementById("order-here").innerHTML = '<p><BR/>Click Here to Close Quote</p>';
		} else {
			custom_showhide_check = 0;
			document.getElementById("customform_main").style.visibility = 'hidden';
			document.getElementById("order-here").innerHTML = '<p>Order by phone or click here for a quote form</p>';
		}
		document.getElementById('customform_main').style.position = 'absolute';
		document.getElementById('customform_main').style.bottom = '48px';
		document.getElementById('customform_main').style.left = '0px';
		
	} else {
		if (custom_showhide_check == 0) {
			custom_showhide_check = 1;
			document.getElementById("customform_main").style.visibility = 'visible';
			document.getElementById("button-customize").innerHTML = 'Click Here to Close Quote';
		} else {
			custom_showhide_check = 0;
			document.getElementById("customform_main").style.visibility = 'hidden';
			document.getElementById("button-customize").innerHTML = 'Custom Info. and Quote Request';
		}
		document.getElementById('customform_main').style.position = 'absolute';
		document.getElementById('customform_main').style.top = '-204px';
		document.getElementById('customform_main').style.right = '0px';

	}
}
function customButtonRollOver () {
	document.getElementById("button-customize").style.border = 'solid 2px #FFFFFF';
}
function customButtonRollOut () {
	if (custom_showhide_check == 1) {
		document.getElementById("button-customize").style.border = 'solid 2px #FFFFFF';
	} else {
		document.getElementById("button-customize").style.border = 'solid 2px #293B57';
	}
}

function highlight_nextprev (whichbut, whichicon, onoff) {
	if (onoff == 'off') {
		document.getElementById(whichbut).className='prevnext_buttons_imgregular';
		document.getElementById(whichicon).className='prevnext_buttons_imgregular';
	} else {
		document.getElementById(whichbut).className='prevnext_buttons_imghover';
		document.getElementById(whichicon).className='prevnext_buttons_imghover';
	}
}
function highlight_back_catalog (onoff) {
	if (onoff == 'off') {
		document.getElementById('back_to_cat_but').className='prevnext_backcatalog';
	} else {
		document.getElementById('back_to_cat_but').className='prevnext_backcatalog_hover';
	}
}

function showTechSpecs() {
	document.getElementById('subcontent').style.display = 'block';
}
function hideTechSpecs() {
	document.getElementById('subcontent').style.display = 'none';
}

