var productImages = []; // Preloaded image. ID = 880 productImages[880] = new Image(); productImages[880].src="/image/product/medium/vita_black.jpg"; productImages[880].alt = ""; // Preloaded image. ID = 406 productImages[406] = new Image(); productImages[406].src="/image/product/medium/vita_white.jpg"; productImages[406].alt = ""; // Preloaded image. ID = 407 productImages[407] = new Image(); productImages[407].src="/image/product/medium/vita_orange.jpg"; productImages[407].alt = ""; // Preloaded image. ID = 408 productImages[408] = new Image(); productImages[408].src="/image/product/medium/vita_green_sm.jpg"; productImages[408].alt = ""; // Preloaded image. ID = 437 productImages[437] = new Image(); productImages[437].src="/image/product/medium/vita_red.jpg"; productImages[437].alt = ""; // Preloaded image. ID = 1100 productImages[1100] = new Image(); productImages[1100].src="/image/product/medium/vita_dark_blue.jpg"; productImages[1100].alt = ""; // Preloaded image. ID = 1101 productImages[1101] = new Image(); productImages[1101].src="/image/product/medium/vita_-_anthracite__chocolate.jpg"; productImages[1101].alt = ""; var productData = []; productData[2372] = [{1: 1}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":880} ]; productData[2373] = [{1: 4}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":406} ]; productData[2374] = [{1: 7}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":407} ]; productData[2375] = [{1: 10}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":437} ]; productData[2376] = [{1: 15}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":1101} ]; productData[2377] = [{1: 29}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":1101} ]; productData[2378] = [{1: 204}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":408} ]; productData[2868] = [{1: 314}, {"price":77.00, "exception":'FALSE', "isSpecial":'FALSE', "specialPrice":77.00, "stock":0, "imageId":1100} ]; 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; }