var productImages = []; // Preloaded image. ID = 260 productImages[260] = new Image(); productImages[260].src="/image/product/medium/vintage-maple.jpg"; productImages[260].alt = ""; // Preloaded image. ID = 540 productImages[540] = new Image(); productImages[540].src="/image/product/medium/stain_colour_panel-3.jpg"; productImages[540].alt = ""; // Preloaded image. ID = 544 productImages[544] = new Image(); productImages[544].src="/image/product/medium/fabric_colours3-1.jpg"; productImages[544].alt = ""; var productData = []; productData[2547] = [{1: 142, 3: 144, 2: 253}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2548] = [{1: 142, 3: 145, 2: 253}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2549] = [{1: 142, 3: 144, 2: 257}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2550] = [{1: 142, 3: 145, 2: 257}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2551] = [{1: 142, 3: 144, 2: 258}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2552] = [{1: 142, 3: 145, 2: 258}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2553] = [{1: 142, 3: 144, 2: 259}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2554] = [{1: 142, 3: 145, 2: 259}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2555] = [{1: 142, 3: 144, 2: 260}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2556] = [{1: 142, 3: 145, 2: 260}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2557] = [{1: 142, 3: 144, 2: 261}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2558] = [{1: 142, 3: 145, 2: 261}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2559] = [{1: 143, 3: 144, 2: 253}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2560] = [{1: 143, 3: 145, 2: 253}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2561] = [{1: 143, 3: 144, 2: 257}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2562] = [{1: 143, 3: 145, 2: 257}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2563] = [{1: 143, 3: 144, 2: 258}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2564] = [{1: 143, 3: 145, 2: 258}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2565] = [{1: 143, 3: 144, 2: 259}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2566] = [{1: 143, 3: 145, 2: 259}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2567] = [{1: 143, 3: 144, 2: 260}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2568] = [{1: 143, 3: 145, 2: 260}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2569] = [{1: 143, 3: 144, 2: 261}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; productData[2570] = [{1: 143, 3: 145, 2: 261}, {"price":97.50, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":97.50, "stock":0, "imageId":0} ]; var attribSets = [1, 3, 2]; // 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; }