var productImages = []; // Preloaded image. ID = 702 productImages[702] = new Image(); productImages[702].src="/image/product/medium/bench_-_black.jpg"; productImages[702].alt = ""; // Preloaded image. ID = 696 productImages[696] = new Image(); productImages[696].src="/image/product/medium/27_med_20091008210453_img.jpg"; productImages[696].alt = ""; // Preloaded image. ID = 695 productImages[695] = new Image(); productImages[695].src="/image/product/medium/26_lrg_20091008164032_img.jpg"; productImages[695].alt = ""; // Preloaded image. ID = 703 productImages[703] = new Image(); productImages[703].src="/image/product/medium/bench_-_brown.jpg"; productImages[703].alt = ""; // Preloaded image. ID = 729 productImages[729] = new Image(); productImages[729].src="/image/product/medium/26_lrg_20090709183834_img.jpg"; productImages[729].alt = ""; // Preloaded image. ID = 730 productImages[730] = new Image(); productImages[730].src="/image/product/medium/26_lrg_20090709183849_img.jpg"; productImages[730].alt = ""; // Preloaded image. ID = 792 productImages[792] = new Image(); productImages[792].src="/image/product/medium/23_lrg_20090709183637_img-1.jpg"; productImages[792].alt = ""; // Preloaded image. ID = 793 productImages[793] = new Image(); productImages[793].src="/image/product/medium/28_lrg_20090709184124_img.jpg"; productImages[793].alt = ""; // Preloaded image. ID = 825 productImages[825] = new Image(); productImages[825].src="/image/product/medium/white_klip.jpg"; productImages[825].alt = ""; var productData = []; productData[2694] = [{1: 1}, {"price":210.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":210.00, "stock":0, "imageId":695} ]; productData[2695] = [{1: 6}, {"price":210.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":210.00, "stock":0, "imageId":696} ]; productData[2732] = [{1: 10}, {"price":210.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":210.00, "stock":0, "imageId":793} ]; productData[2733] = [{1: 4}, {"price":210.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":210.00, "stock":0, "imageId":825} ]; var attribSets = [1]; // Find the variant selected. function findVariant() { found = false; // Found flag. variantIndex = 0; // The index of the found variant element. // This just scans for a match and if found it sets the flags and breaks. // If one mismatch is detected it just breaks the loop. for (variant in productData) // Loop through the variant array, called 'productData'. { for (set in attribSets) // Now loop through the sets. { // Get a refference to a attribute set select box. attrib = document.getElementById("attributes"+attribSets[set]); // Check to see if the value of that attribute select box is in the productData attribute array. if (productData[variant][0][attribSets[set]]==attrib.value) { found = true; } else { found = false; break; } } if (found==true) { variantIndex = variant; break; } } if (variantIndex!=0) { var data = productData[variantIndex][1]; data["var_id"] = variantIndex; return data; } else { return false; } } // This enables and disables the submit button. function submitButtonEnable(enabled) { if(enabled==false) { document.getElementById("submitButton").style.display="none"; // document.getElementById("submitButton").disabled = true; } else { document.getElementById("submitButton").style.display="block"; // document.getElementById("submitButton").disabled = false; } } function specialRowEnabled(enable) { var browserName=navigator.appName; if (enable==false) { document.getElementById("specialRow").style.display="none"; } else { // Use block for IE because table-row doesn't work if (browserName=="Microsoft Internet Explorer") { document.getElementById("specialRow").style.display="block"; } else { document.getElementById("specialRow").style.display="table-row"; } } } // This is the function that gets called when the user changes the selection. function changeVariant() { // Get the selected variant. variant = findVariant(); // Sort out the stock //displayStock(); // Check if it is an exception. if (variant["exception"]=="FALSE") { // See if it is on special. if (variant["isSpecial"]=="TRUE") { // Display the special price with the old price with strike through font. document.getElementById("price").innerHTML = "AU$" + variant["price"].toFixed(2) + ""; document.getElementById("specialPrice").innerHTML = "AU$" + variant["specialPrice"].toFixed(2); specialRowEnabled(true); } // Just show the normal price. else { if(variant["price"] == 0) { document.getElementById("price").innerHTML = "POA"; specialRowEnabled(false); } else { document.getElementById("price").innerHTML = "AU$" + variant["price"].toFixed(2); specialRowEnabled(false); } } if (variant["imageId"]!=0) { swapImage(variant["imageId"]); } submitButtonEnable(true); // Enable the submit button. } else { // Variant must be an exception so display some text and disable the submit button. document.getElementById("price").innerHTML = "Product combination is not available"; submitButtonEnable(false); specialRowEnabled(false); } } function swapImage(image) { document.prodImageMain.src = productImages[image].src; }