var subproducts = new Array(); var selectboxes = new Array(); var NS4DOM = document.layers ? true:false; var IEDOM = document.all ? true:false; var W3CDOM = document.getElementById ? true: false; function getObjectSubProducts(id) { var ref; if (NS4DOM) ref = "document." + id; if (IEDOM) ref = id; if (W3CDOM) ref = "document.getElementById('" + id + "')"; var object = eval(ref); return object; } function ShowProductStatus() { var selected = ""; var option1, option2; var formItem, object; // Read the Select Boxes for (option1 in selectboxes) { formItem = getObjectSubProducts("dropdownitem" + selectboxes[option1]); selected += formItem.options[formItem.selectedIndex].text + ", "; } // Fix Safari Handle of Drop Down Options if (selected.substring(0, 1) == " ") selected = selected.substring(1, selected.length); // Cut off the last ', ' selected = selected.substring(0, selected.length - 2); // Cycle through the subproducts and see if there is a match for (option2 in subproducts) // The Item was found if (subproducts[option2][0] == selected) { // Check the Stock for this Item if (subproducts[option2][2] != "0") { object = getObjectSubProducts("divSubProductInStock"); object.style.display="block"; object = getObjectSubProducts("divSubProductOutOfStock"); object.style.display="none"; object = getObjectSubProducts("inpAddToCart"); object.style.visibility="visible"; object = getObjectSubProducts("selQuantity"); object.style.visibility="visible"; var listObj = object; // Remove the Current Options while (listObj.options.length) // Make sure FireFox Operates Properly if (document.all) listObj.options.remove(0); else listObj.remove(0); // Create the Stock Choices var newObj; for (var i = 1; i <= 10 && (i <= parseInt(subproducts[option2][2]) || subproducts[option2][2] == "-1"); i++) { newObj = document.createElement("OPTION"); newObj.text = i; newObj.value = i; // Make sure FireFox Operates Properly if (document.all) listObj.add(newObj); else listObj.add(newObj, null); } // Select the first option listObj.options[0].selected = true; } else { object = getObjectSubProducts("divSubProductInStock"); object.style.display="none"; object = getObjectSubProducts("divSubProductOutOfStock"); object.style.display="block"; object = getObjectSubProducts("inpAddToCart"); object.style.visibility="hidden"; object = getObjectSubProducts("selQuantity"); object.style.visibility="hidden"; } // Check the Price for this Item object = getObjectSubProducts("divSubProductPrice"); if (subproducts[option2][3] == "1") // Item is on Sale object.innerHTML = "" + subproducts[option2][1] + " " + "" + subproducts[option2][4] + "
" + "" + "Limit: " + subproducts[option2][5] + ""; else // Item is not on Sale object.innerHTML="" + subproducts[option2][1] + ""; } }