var productImages = []; // Preloaded image. ID = 89 productImages[89] = new Image(); productImages[89].src="/image/product/medium/jaga_ottoman_black.jpg"; productImages[89].alt = ""; // Preloaded image. ID = 91 productImages[91] = new Image(); productImages[91].src="/image/product/medium/jaga_ottoman_red.jpg"; productImages[91].alt = ""; // Preloaded image. ID = 92 productImages[92] = new Image(); productImages[92].src="/image/product/medium/jaga_ottoman_white.jpg"; productImages[92].alt = ""; // Preloaded image. ID = 635 productImages[635] = new Image(); productImages[635].src="/image/product/medium/black_mantis-6.jpg"; productImages[635].alt = ""; // Preloaded image. ID = 636 productImages[636] = new Image(); productImages[636].src="/image/product/medium/chilli_red-6.jpg"; productImages[636].alt = ""; // Preloaded image. ID = 637 productImages[637] = new Image(); productImages[637].src="/image/product/medium/citrus_orange-6.jpg"; productImages[637].alt = ""; // Preloaded image. ID = 638 productImages[638] = new Image(); productImages[638].src="/image/product/medium/helm_brown-6.jpg"; productImages[638].alt = ""; // Preloaded image. ID = 639 productImages[639] = new Image(); productImages[639].src="/image/product/medium/sky_blue-6.jpg"; productImages[639].alt = ""; // Preloaded image. ID = 640 productImages[640] = new Image(); productImages[640].src="/image/product/medium/white_frost-6.jpg"; productImages[640].alt = ""; var productData = []; productData[2649] = [{1: 275}, {"price":198.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":198.00, "stock":0, "imageId":638} ]; productData[2650] = [{1: 276}, {"price":198.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":198.00, "stock":0, "imageId":636} ]; productData[2651] = [{1: 277}, {"price":198.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":198.00, "stock":0, "imageId":89} ]; productData[2652] = [{1: 278}, {"price":198.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":198.00, "stock":0, "imageId":92} ]; productData[2653] = [{1: 279}, {"price":198.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":198.00, "stock":0, "imageId":639} ]; productData[2654] = [{1: 280}, {"price":198.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":198.00, "stock":0, "imageId":637} ]; 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; }