	function resizebody() {
		// FIX FOR IE RESIZE ISSUE - BODY NEEDS TO HAVE "STATIC" POSITION FOR THE ZOOM FUNCTION TO WORK
		// BUT THAT THEN CAUSES IMAGES TO JUMP AROUND WHEN THE PAGE IS RESIZED IN IE - Nick
		document.body.style.position = "relative";
		document.body.style.position = "static";
	}

	/* ==========================================================================
	Function Name: product()
	Description:   Create a product using the constructor function
	Coded By:      Matt Hall
	Date:          2001-09-03
	========================================================================== */
	function product (
		                id,
		                size,
		                colour,
		                availability,
		                backOrder,
		                price,
		                salePrice,
		                promoPrice,
		                altPrice,
		                altSalePrice,
		                altPromoPrice,
		                stocklevel,
		                stocklevelconstrained,
		                expectedstock,
		                priceDisplayFlag,
		                labelColour,
		                productTitle,
		                productMiniImage,
		                productColourID,
		                productCode
	                )
	{
		// Initialise the properties for the object
		this.id                    = id;
		this.size                  = size;
		this.colour                = colour;
		this.availability          = availability;
		this.backOrder             = backOrder;
		this.price                 = price;
		this.salePrice             = salePrice;
		this.altPrice              = altPrice;
		this.altSalePrice          = altSalePrice;
		this.stocklevel            = stocklevel;
		this.stocklevelconstrained = stocklevelconstrained;
		this.expectedstock         = expectedstock;

		// Additional properties to make promo prices work
		this.promoPrice            = promoPrice;
		this.altPromoPrice         = altPromoPrice;
		this.priceDisplayFlag      = priceDisplayFlag;
		
		// for colour products section
		this.labelColour		   = labelColour;
		this.productTitle          = productTitle;
		this.productMiniImage      = productMiniImage;
		this.productColourID       = productColourID;
		this.productCode           = productCode
	}

	/* ==========================================================================
	Function Name: getObj()
	Description:   Cross browser DOM referencing.
	Coded By:      Richard Weeks
	Date:          2006-05-01
	========================================================================== */
	function getObj(sName) {
		if (document.getElementById) {
			this.obj   = document.getElementById(sName);
			this.style = document.getElementById(sName).style;
		} else if (document.all) {
			this.obj   = document.all[sName];
			this.style = document.all[sName].style;
		} else if (document.layers) {
			this.obj   = document.layers[sName];
			this.style = document.layers[sName];
		}
	}

	/* ==========================================================================
	Function Name: changeStyleById()
	Description:   Change DOM property cross browser.
				Retires previous 'zpu...' functions.
	Coded By:      Richard Weeks
	Date:          2006-05-09
	========================================================================== */
	function changeStyleById(sID, sColour) {
		var nodeObj = new getObj(sID)
		nodeObj.style.color = sColour;
	}

	/* FUNCTION ===================================================================
	Name:        getVariantNo()
	Description: Function to return the index of the variant that matches the size
				and colour passed in.
	Coded By:    Matt Hall
	Date:        2001-12-13
	============================================================================ */
	function getVariantNo(iPV, Size, Colour) {
		var j       = new Number();
		var strtemp = new String();

		for (j = 0; j < productVariants[iPV].length; j++) {
			if (Size == productVariants[iPV][j].size && Colour == productVariants[iPV][j].colour) {
				return j;
			}
		}
		return -1;
	}

    //##DEBUG## - TODO 1. Fix below.
	function getColourVariantNo(iPV, Size, Colour) {
		var j       = new Number();
		var i       = new Number();
		var strtemp = new String();

		for(i = 0; i < colourVariants.length; i++) {
				for (j = 0; j < colourVariants[i].length; j++) {
					if ((Size == colourVariants[i][j].size) && (Colour == colourVariants[i][j].colour)) {
						j=colourVariants[i][j].id;
						return j;
					}
				}
		}
		return -1;
	}

	/* FUNCTION ==================================================================
	Name:        getFirstVarianNoForColour()
	Description: CR #6162 - Function to return the index of the variant that
				matches the colour passed in.
	Date:        2004-05-25
	=========================================================================== */
	function getFirstVariantNoForColour(Colour) {
		var j;
		for(j = 0; j < CONST_VARIANTS; j++) {
			if(Colour == productVariants[j].colour) {
				return j;
			}
		}
		return -1;
	}

	// == Build Suggest Panel ==
	function buildSuggestPanel() {
		buildColours();
		buildSizes();
		buildQuantities();
	}

	function buildColours() {
		// Function that builds the list of colours available for suggested products
		var oColours;
		var iColour;
		var bFound = false;

		for (v=1; v<=CONST_SUGGESTIONS; v++) {
			oColours = eval('document.getElementById("selColour' + v + '")');
			iColour = 0;
			
			if (oColours != null) {
				emptyOptions(oColours);
				
				//check each SKU
				for (i=0; i<productVariants[v].length; i++) {
					//check for duplicates in new list
					bFound = false;
					for (j=0; j < oColours.length; j++) {
						if (oColours[j].text == productVariants[v][i].colour) {
							bFound = true;
							
							;
						}
					}
					if (!bFound) {	
						insertOption(oColours, productVariants[v][i].colour, iColour);
						iColour++;
					}
				}
			}
		}
	}
	
	function buildSizes() {
		// Function that builds the list of sizes available
		
		for (var v=0; v<=CONST_SUGGESTIONS; v++) {
			buildSizesByProduct(v);
		}
	}

	function buildSizesByProduct(iPV) {
		var sColour;
		var bInList = false;
		var iSize = 0;

		sColour = eval('getSelectText("selColour' + iPV + '")');
		
		var oSize = eval('document.getElementById("selSize' + iPV + '")');
		iSize = 0;

		if (oSize != null) {
			emptyOptions(oSize);

			insertOption(oSize, 'Select size', 'Select size'); //##DEBUG##
			
			for (var i=0; i<productVariants[iPV].length; i++) {
				//check for duplicates
				bInList = false;
				for (var j=0; j < oSize.length; j++) {
					if (oSize[j].text==productVariants[iPV][i].size) {
						bInList = true;
						break;
					}
				}
				if (!bInList && productVariants[iPV][i].colour == sColour) {
					insertOption(oSize, productVariants[iPV][i].size, iSize);
					iSize++;
				}
			}
		}
		
		if (CONST_SIZE != '') {
			
			for(var i=0;i<=oSize.length-1;i=i+1) {
				var txtText=oSize.options[i].text

				if(CONST_SIZE.toUpperCase()==txtText.toUpperCase()) {
					oSize.selectedIndex=i;
					break;
				}
			}
		}
	}

	function buildQuantities() {
		// Function that builds the list of quantities
		var sSize    = new String();
		var sColour  = new String();

		for (var v=1; v<=CONST_SUGGESTIONS; v++) {
			// Get the selected size & colour
			var oSize = eval('document.getElementById("selSize' + v + '")');
			var oColour = eval('document.getElementById("selColour' + v + '")');

			if (oSize != null) {
				sColour = eval('getSelectText("selColour' + v + '")');
				sSize	= eval('getSelectText("selSize' + v + '")');

				var oQuant = eval('document.getElementById("selQuantity' + v + '")');
				var bQuantityUpdated = false;
				var iStock;

				for (var i=0; i<productVariants[v].length; i++) {
					iStock = productVariants[v][i].stocklevel;
					if((productVariants[v][i].colour.toUpperCase() == sColour.toUpperCase()) &&  productVariants[v][i].size == sSize) {
						insertOptionQuantity(oQuant, iStock);
						bQuantityUpdated = true;
						break;
					}
				}
				if(bQuantityUpdated==false) {
					insertOptionQuantity(oQuant, 0);
				}
			}
		}
	}
	
	
	// == Reusable Functions ==
	function getSelectText(sObjectName) {
		// Get the selected 
		var oObj = document.getElementById(sObjectName);
		var sText = "";

		if (oObj != null) {
			if (oObj.selectedIndex > -1) {
				sText = oObj.options[oObj.selectedIndex].text;
			}
		}
		return sText;
	}

	function insertOption(oSel, sText, sValue) {
		var oOpt = document.createElement('option');
		oOpt.text = sText;
		oOpt.value = sValue;

		try {
			oSel.add(oOpt,null);	// standards compliant
		} catch(ex) {
			oSel.add(oOpt);			// IE only
		}
	}

	function emptyOptions(oSel) {
		for(var o=oSel.length; o>=0; o--) { oSel.remove(o); }
	}

	function insertOptionQuantity(oQuant, iAdd) {
		emptyOptions(oQuant);
		if(iAdd > 0) {
			oQuant.disabled = false;
			insertOption(oQuant,'Select Quantity...',0);
			for(var n=1; n<=iAdd; n++) { insertOption(oQuant,n,n) }
		} else {
			oQuant.disabled = true;
		}	
	}

	/* FUNCTION ==================================================================
	Name:        updateDisplay()
	Description: Function to update the display of variants of the page. This is
				called when initialising the page and changing the size.
	Coded By:    Matt Hall
	Date:        2001-12-13
	=========================================================================== */
	function updateDisplay(iPV, bColourChanged) {	
	
		var strSize				= new String();
		var strColour			= new String();
		var i					= new Number();
		var oQuant				= document.getElementById('selQuantity0');
		var iStock				= 0;
		var bQuantityUpdated	= false;
		var strSugSize			= new String();
		var strSugColour		= new String();
		var sCvSize				= new String();
		var sCvColour			= new String();

if (bColourChanged != true) { CONST_SIZE=getSelectText('selSize0');;}
		// -- Main Product --
		// Get selected Colour and Size
				
		strColour	= getSelectText('selColour0');
		strSize 	= getSelectText('selSize0');

		if(typeof productVariants[0] != 'undefined') {
					
			// Show Price Normal and Price Alternative for SKU

			setPricing(strColour, strSize, CONST_VARIANTS, 0);

			//----------------------------------------------------------------------------------------------------
			// Show Quantity for SKU - just updated the main product in the centre of the page.
			//----------------------------------------------------------------------------------------------------
			for(var i=0;i < CONST_VARIANTS; i++) {
				iStock = productVariants[0][i].stocklevel;
				
				if((productVariants[0][i].colour.toUpperCase() == strColour.toUpperCase()) && (productVariants[0][i].size == strSize)) {
				
					insertOptionQuantity(oQuant, iStock);
					bQuantityUpdated = true;
					break;
				}
			}
		}
		
		if(bQuantityUpdated==false) {
			insertOptionQuantity(oQuant, 0);
		}
		
		// Show Size Label for SKU
		var bShowLabel = false;
		if(typeof labelsArray != 'undefined') {
			for(var i=0;i < CONST_LABELS; i++) {
			
				// check if this item in the array is actually an object - otherwise, break out of the loop.
				if (labelsArray[i]) {
					if(labelsArray[i].size == strSize) {
						if(labelsArray[i].comment != "") {
							document.getElementById('size_label').innerHTML = labelsArray[i].comment;
							document.getElementById('size_label').style.display = "inline";
							bShowLabel = true;
						}
						break;
					}
				} else { break; }
			}
		}		
		
		if(bShowLabel == false) {
			document.getElementById('size_label').innerHTML = "";
			document.getElementById('size_label').style.display = "none";
		}
		bShowLabel = false;	//reset for next label
									
		// Show Availability/Back Order for SKU
		if(typeof productVariants[0] != 'undefined') {

			for(var i=0;i < CONST_VARIANTS; i++) {
				if((productVariants[0][i].size == strSize) && (productVariants[0][i].colour.toUpperCase() == strColour.toUpperCase())) {
								
					if((productVariants[0][i].availability != "") || (productVariants[0][i].backOrder != "")) {
												
						document.getElementById('availability').innerHTML = productVariants[0][i].availability;
						document.getElementById('backOrder').innerHTML = productVariants[0][i].backOrder;
						
						document.getElementById('availability').style.display = "inline";
						document.getElementById('backOrder').style.display = "inline";
						
						if (productVariants[0][i].stocklevel < 1) {
							document.getElementById('availability').style.color = "red";
							document.getElementById('backOrder').style.color = "red";
						}
						else {
//							if ( productVariants[0][i].stocklevel <= productVariants[0][i].expectedstock) {
//								document.getElementById('availability').style.color = "blue";
//								document.getElementById('backOrder').style.color = "blue";
//							}
//							else {
								document.getElementById('availability').style.color = "#666";
								document.getElementById('backOrder').style.color = "#666";
//							}
						}
						bShowLabel = true;
						break;
					}
				}
			}
		}
		if(bShowLabel == false) {
			document.getElementById('availability').innerHTML = ""; 
			document.getElementById('backOrder').innerHTML = ""; 
			document.getElementById('availability').style.display = "none";
			document.getElementById('backOrder').style.display = "none";	
		}

		// -- Suggested Products --
		for(var v=0;v <=CONST_SUGGESTIONS; v++) {
			var oColour	= eval('document.getElementById("selColour' + v + '")');
			var oSize	= eval('document.getElementById("selSize' + v + '")');
			var oQuant	= eval('document.getElementById("selQuantity' + v + '")');
			var bSizesUpdated = false;
			var iStock	= 0;
			var bQuantityUpdated = false;
			
			if (oColour != null) {
				
				// Match to the main product colour, then get selected Suggest Colour
				if (iPV == 0) {
					for(var c=0;c < oColour.length; c++) {
						if (strColour.toUpperCase() == oColour.options[c].text.toUpperCase()) {
							oColour.selectedIndex = c;
							
							if(bColourChanged) {
							
								// Update the list of sizes for this Product.
								// For when the main product colour has changed.
								buildSizesByProduct(v);
								bSizesUpdated = true;
							}
						}
					}	
				}

				if((v == iPV) && bColourChanged && !bSizesUpdated) {
					// Update the list of sizes for this Product, if the list hasn't been yet.'
					// For when the suggested product colour has changed.
					buildSizesByProduct(v);
					eval('setSelectedColourSuggestedImage(getSelectText("selColour' + v + '"), v)');
				}
				
				// Get selected Colour and Size
				strSugColour	= eval('getSelectText("selColour' + v + '")');
				strSugSize		= eval('getSelectText("selSize' + v + '")');

				if(typeof productVariants[v] != 'undefined') {
					var iLenPV = productVariants[v].length;

					// Show Price Normal and Price Alternative for SKU
					setPricing(strSugColour, strSugSize, iLenPV, v);

					// Show Quantity for SKU
					for(var i=0;i < iLenPV; i++) {
						iStock = productVariants[v][i].stocklevel;
						if((productVariants[v][i].colour.toUpperCase() == strSugColour.toUpperCase()) && (productVariants[v][i].size == strSugSize)) {
							insertOptionQuantity(oQuant, iStock);
							bQuantityUpdated = true;
							break;
						}
					}
				}
				if(bQuantityUpdated==false) {
					// disable the quantity drop-down
					insertOptionQuantity(oQuant, 0);
				}
			}
		}	
	}
	

	function setPricing(sColour, sSize, iPVs, iPV) {
	//Size no longer used as price is at colour level BP 19/09/2009
	
		var oNowSale = eval('document.getElementById("pricing_now_sale' + iPV + '")');
		var oNow = eval('document.getElementById("pricing_now' + iPV + '")');
		var oWas = eval('document.getElementById("pricing_was' + iPV + '")');
		
		var bPriceFound = false;
		
		for(var i=0;i < iPVs; i++) {
			if((productVariants[iPV][i].colour.toUpperCase() == sColour.toUpperCase())) {
				if (productVariants[iPV][i].priceDisplayFlag == 'isondiscount') {
					oNowSale.innerHTML = productVariants[iPV][i].promoPrice;
					oNow.innerHTML = "";
					oWas.innerHTML = productVariants[iPV][i].price;

					if(showAltPrice) {
						oNowSale.innerHTML = oNowSale.innerHTML + ' (' + productVariants[iPV][i].altPromoPrice + ')';
						oWas.innerHTML = oWas.innerHTML + ' (' + productVariants[iPV][i].altPrice + ')';
					}
					oNowSale.style.display = "inline";
					oNow.style.display = "none";
					oWas.style.display = "inline";

				} else if (productVariants[iPV][i].salePrice) {
					oNowSale.innerHTML = productVariants[iPV][i].salePrice;
					oNow.innerHTML = "";
					oWas.innerHTML = productVariants[iPV][i].price;
							
					if(showAltPrice) {
						oNowSale.innerHTML = oNowSale.innerHTML + ' (' + productVariants[iPV][i].altSalePrice + ')';
						oWas.innerHTML = oWas.innerHTML + ' (' + productVariants[iPV][i].altPrice + ')';
					}
					oNowSale.style.display = "inline";
					oNow.style.display = "none";
					oWas.style.display = "inline";
					
				} else { 
					oNowSale.innerHTML = "";
					oNow.innerHTML = productVariants[iPV][i].price;
					oWas.innerHTML = "";

					if(showAltPrice) {
						oNow.innerHTML = oNow.innerHTML + ' (' + productVariants[iPV][i].altPrice + ')';
					}
					oNowSale.style.display = "none";
					oNow.style.display = "inline";
					oWas.style.display = "none";
				}
				
				// a price was found based on the size and colour. Set a flag, and get out of the loop.
				bPriceFound = true;
				break;
			}		
		}
	}

	function setSelectedColourImages(sColour, sImageType, bMain) {
		
		//alert(sColour + '_ProductColour' + sImageType + 'Image_medium');
		//Get Medium image
		var oMedium = eval('document.getElementById("' + sColour + '_ProductColour' + sImageType + 'Image_medium")');

		//Set image paths
		var oImg = eval('document.getElementById("img' + sImageType + '")');

		//test if Medium image exists
		if (oMedium != null) {
	
			var oThumb = eval('document.getElementById("' + sColour + '_ProductColour' + sImageType + 'Image_lthumbnail")');
			var oZoom = eval('document.getElementById("' + sColour + '_ProductColour' + sImageType + 'Image_large")');

			if (bMain) {
				var oImgThumb	= eval('document.getElementById("img' + sImageType + 'Thumb")');
				oImg.src		= oMedium.value;
				oImg.alt		= oZoom.value
				oImgThumb.value	= oThumb.value;
			} else {
				var oImgZoom	= eval('document.getElementById("img' + sImageType + 'Zoom")');
				oImg.src		= oThumb.value;
				oImg.alt		= oMedium.value;
				oImgZoom.value	= oZoom.value;
				
				//ensure the image is displayed
				oImg.style.display = "inline";
			}
		} else if(!bMain) {
			oImg.style.display = "none";
		}
	}

	function setSelectedColourSuggestedImages(sColour) {
		//Get Suggested Products images
		for (var v=1; v<=CONST_SUGGESTIONS; v++) {
			setSelectedColourSuggestedImage(sColour, v);
		}
	}
	
	function setSelectedColourSuggestedImage(sColour, iPV) {
		var oShortImage = eval('document.getElementById("' + sColour + '_shortimage' + iPV + '")');

		// Get suggested image
		var oImgSug = eval('document.getElementById("imgSuggested' + iPV + '")');
	
		//test if Short Image image exists, otherwise dont change the image
		if (oShortImage != null) {
			oImgSug.src = oShortImage.value;
		}	
	}
		    
    //------------------------------------------------------------------------------------------------------
	// This is called when the page first loads, and also when the colour of any main item is changed.
	// It updates the main product images, and sets the suggested items, and any complete the outfit items.
    //------------------------------------------------------------------------------------------------------
	function updateDisplayByColour(bSingle) {

		//Get main Selected colour
		var sColour	= getSelectText('selColour0');
				
		// Set Main images to match the colour selected
		setSelectedColourImages(sColour, 'Front', true);
		setSelectedColourImages(sColour, 'Back', false);
		setSelectedColourImages(sColour, 'Alternate', false);
		setSelectedColourImages(sColour, 'Set', false);

		// Set Suggested images to match the colour selected
		setSelectedColourSuggestedImages(sColour);
		
		// If there are 'complete the look' items, run the following...
		
		if(typeof colourVariants[0] != 'undefined') {
			updateRHSColourVariants();
		}
		updateDisplay(0, true);
	}

	//**********************************************************************************************************************************
	// Set of functions to manage the RHS products.
	//**********************************************************************************************************************************

    //-------------------------------------------------------------------------------------------
    // This function is called by the RHS CV Colour-drop-down, when it is changed.
    // It's purpose is to update all the details for the CV, based on the colour change.
    //-------------------------------------------------------------------------------------------
    function updateCVDetailsOnColourChange(iDisplaySequence) {
        //alert('updateCVDetailsOnColourChange'); //##DEBUG##
    
        // Retrieve details regarding this product
        // Product is the same...
    	var iArraySeq_Product = currentlyDisplayedCVs[iDisplaySequence].arraySeq_product;
    	
    	//...but variant will have changed, as a new colour is selected.
    	
    	// Get the colour-drop-down object
    	var objSelect = eval('document.getElementById("selCvColour' + iDisplaySequence + '")');
    	for (i = 0; i < colourVariants[iArraySeq_Product].length ; i++) {
    	    if (colourVariants[iArraySeq_Product][i].colour == objSelect.options[objSelect.options.selectedIndex].text) {
    	        currentlyDisplayedCVs[iDisplaySequence].arraySeq_variant = i;
    	        break;
    	    }
    	}
    	
		var iArraySeq_Variant = currentlyDisplayedCVs[iDisplaySequence].arraySeq_variant;
		
        //---------------------------------------------------------------------------------		
        // Update Sizes
		buildCvSizesByProduct(iArraySeq_Product, iDisplaySequence);

		// Next, update the quantities.
		buildCvQuantity(iArraySeq_Product, iDisplaySequence);
		
		// Next, update the images
		updateCVImages(iDisplaySequence);

		// Lastly, update data.
		updateCVData(iDisplaySequence);
        //---------------------------------------------------------------------------------

    }
	
	//------------------------------------------------------------------------------------------
	// This function runs on page load.
	// This is also called when a main product colour is changed - it updates what is displayed
	// and selected in the RHS complete the outfit accordion, based on colour matches.
	//------------------------------------------------------------------------------------------	
	function updateRHSColourVariants(){
	    
		var i,j,x;
	
		var iNumOfMatchingProducts = 0;
		var sColour = getSelectText('selColour0');
		var sSelectedLabelColour = sColour
		
		var iMatchingCVIndex = 0;
		var sMatchingVariantColour = "";
		
		// Filter the LabelColour - filter out brackets, and replace spaces with underscores
		// 'availableColours' is an objects with items such as 'Black', and 'Pomegranate' in it. These objects in turn have up to 4 ProductColourIDs in.
		
	    sSelectedLabelColour = sSelectedLabelColour.replace(/[(0-9)]|\,| |\)|\.|\/|\\/gi,'')
	    
	    if ((availableColours) && (sSelectedLabelColour)) {
			if (eval("availableColours." + sSelectedLabelColour)) {
				//alert("this item has options");
				
				// Get the number of matching products from the array, by checking the colour Variant label colour against the currently selected.
				for (i=0; i < colourVariants.length; i++){				
					if (colourVariants[i].labelColour == sColour) {
					
						// We've found a matching product.
						// 1. Determine which product variant matched the colour
						
						// Loop through the product variants for this product
						
						iMatchingCVIndex = -1;
						sMatchingVariantColour = "";
						
						for (j=0 ; j<colourVariants[i].length ; j++){
						
							// Loop through the available colours.
							for (x = 0; x< eval("availableColours." + sSelectedLabelColour).length ; x++) {
							
								// Check if the product in the available colours matches the variant								
								if ((eval("availableColours." + sSelectedLabelColour)[x]) == (colourVariants[i][j].productColourID)) {
									iMatchingCVIndex = j;
									sMatchingVariantColour = colourVariants[i][j].colour;
									break;
								}
							}
							
							// drop out of loop if match has been found.
							if (iMatchingCVIndex != -1) { break; }
						}
						if (iMatchingCVIndex==-1) { iMatchingCVIndex = 0; } 
						// 2. Update the RHS items, using the product number in the array, the variant array number, and the sequence number (0 - 3)
						
						updateCVItemFromMain(i, iMatchingCVIndex, iNumOfMatchingProducts, sMatchingVariantColour);
												
						// Increment the count of matching items.
						iNumOfMatchingProducts++;
					}
				}
				
				// number of matching products = (iNumOfMatchingProducts)
			}
		}
	
    	showCVPanels(iNumOfMatchingProducts);
	}
	
	function showCVPanels(iNumPanelsToShow) {
	    var i;
	    for (i=0; i < iNumPanelsToShow; i++) {
    	    document.getElementById('cvProductPanel' + i).style.display = "block";
    	    document.getElementById('cvProductPanel' + i).style.visibility = "visible";
    	}
    	for (i=iNumPanelsToShow; i < 4; i++) {
    	    document.getElementById('cvProductPanel' + i).style.display = "block";
    	    document.getElementById('cvProductPanel' + i).style.visibility = "hidden";
    	}
    	
    	if (iNumPanelsToShow<=0) {
    	
    	    // No items to show in Complete the Look - so hide the second accordion.

            document.getElementById('Accordion2Title').style.display = 'none';
            document.getElementById('Accordion2Content').style.display = 'none';
	        jQuery("#Accordion2Title").animate({
              opacity: 0
            }, { duration: 1, queue: false });

	        jQuery("#Accordion2Content").animate({
              opacity: 0
            }, { duration: 1, queue: false });
            
            
            

            // If the accordion is closed, run it. Crude test, by checking height; accordion has no built-in on/off status.
            if (document.getElementById('Accordion1Content').style.height == "0px") { 
                runAccordion(1,accordionHeight1);
            }

    	} else {
    	
            document.getElementById('Accordion2Title').style.display = 'block';
            document.getElementById('Accordion2Content').style.display = 'block';


    	    jQuery("#Accordion2Title").animate({
              opacity: 1
            }, { duration: 500, queue: false });

    	    jQuery("#Accordion2Content").animate({
              opacity: 1
            }, { duration: 500, queue: false });
    	
//    	    document.getElementById('Accordion2Title').style.visibility = "visible";
//    	    document.getElementById('Accordion2Content').style.visibility = "visible";
    	}
	}
	
	
	//------------------------------------------------------------------------------------------
	// This function updates the drop down and display items for a specified Colour Variant.
	// This function should only be called FROM the main product, as it also sets the default matching colour in the RHS drop-downs
	// It will be called the first time the page loads, and whenever the colour is changed.
	//------------------------------------------------------------------------------------------
	function updateCVItemFromMain(iArraySeq_Product, iArraySeq_Variant, iDisplaySequence, sMatchingVariantColour) {
		var objSelect
		// Update the reference array (currentlyDisplayedCVs[])
		// This allows unique identification of the currently displayed products, without having to loop
		// through matching size/colour, etc...
			
		currentlyDisplayedCVs[iDisplaySequence].arraySeq_product = iArraySeq_Product;
		currentlyDisplayedCVs[iDisplaySequence].arraySeq_variant = iArraySeq_Variant;
		
		// Update the individual item	
        //---------------------------------------
		// First, update the colours
		buildCvColour(iArraySeq_Product, iDisplaySequence);
		// Then, update the sizes
		buildCvSizesByProduct(iArraySeq_Product, iDisplaySequence);
		// Next, update the quantities.
		buildCvQuantity(iArraySeq_Product, iDisplaySequence);		
		// Next, update the images
		updateCVImages(iDisplaySequence);
		// Lastly, update the data for this CV.
		updateCVData(iDisplaySequence);			
    	    	
		// Set the selected item to be - sMatchingVariantColour
		objSelect = eval('document.getElementById("selCvColour' + iDisplaySequence + '")');
		setSelectedDropDown(objSelect, sMatchingVariantColour);
		
	}
	
	function updateCVImages(iDisplaySequence) {
	
	    // Retrieve the image name from the array, and swap it in.
	    
		var iArraySeq_Product = currentlyDisplayedCVs[iDisplaySequence].arraySeq_product;
		var iArraySeq_Variant = currentlyDisplayedCVs[iDisplaySequence].arraySeq_variant;
		
		var sImageStr = "";
		
		if (colourVariants[iArraySeq_Product][iArraySeq_Variant]) {
		
    		sImageStr = colourVariants[iArraySeq_Product][iArraySeq_Variant].productMiniImage;
		    document.getElementById('imgCv' + iDisplaySequence).src = sImageStr;
		    
    	}
	}

    // This updates the Title and Link for a CV specified by display sequence (1 - 4).
	function updateCVData(iDisplaySequence) {
	
		var iArraySeq_Product = currentlyDisplayedCVs[iDisplaySequence].arraySeq_product;
		var iArraySeq_Variant = currentlyDisplayedCVs[iDisplaySequence].arraySeq_variant;
		
		// Update Title
		if (colourVariants[iArraySeq_Product][iArraySeq_Variant]) {
		    var sProductTitle = colourVariants[iArraySeq_Product][iArraySeq_Variant].productTitle;
		    document.getElementById('cvProduct_title' + iDisplaySequence).innerHTML = sProductTitle;
		}

		// Update the HREF on the image
		if (colourVariants[iArraySeq_Product][iArraySeq_Variant]) {
		    var sHREF = "?product_id=" + colourVariants[iArraySeq_Product][iArraySeq_Variant].productCode;
		    document.getElementById('cv_anchor' + iDisplaySequence).href = sHREF;
		}
		
		
		// Reset the price for this item to be that of the 1st variant for the product.
		setCvPricing(iArraySeq_Product, 0, iDisplaySequence);
		
		
		
		//##DEBUG##-LAST
		
	}
	
	
	

	//------------------------------------------------------------------------------------------
	// This builds the colours drop-down for a specified Colour Variant.
	//------------------------------------------------------------------------------------------
	function buildCvColour(iArraySeq_Product, iDisplaySequence) {
		var i,j;
		var oColours;
		var iColour;
		var bFound = false;

		oColours = eval('document.getElementById("selCvColour' + iDisplaySequence + '")');
		iColour = 0;

		if (oColours != null) {
			emptyOptions(oColours);
				
			//check each SKU
			for (i=0; i<colourVariants[iArraySeq_Product].length; i++) {
				//check for duplicates in new list
				bFound = false;
				for (j=0; j < oColours.length; j++) {
					if (oColours[j].text == colourVariants[iArraySeq_Product][i].colour) {
						bFound = true;
						break;
					}
				}
				if (!bFound) {	
					insertOption(oColours, colourVariants[iArraySeq_Product][i].colour, iColour);
					iColour++;
				}
			}
		}	
	}
	//------------------------------------------------------------------------------------------
		
	
	//------------------------------------------------------------------------------------------
	// This function builds the Sizes drop-down for a specified Colour Variant
	//------------------------------------------------------------------------------------------
	function buildCvSizesByProduct(iArraySeq_Product, iDisplaySequence) {
		var sColour;
		var bInList = false;
		var iSize = 0;
		var i,j;

		// Retrieve colour and size for currenctly selected CV.
		
		sColour = eval('getSelectText("selCvColour' + iDisplaySequence + '")');
		var oSize = eval('document.getElementById("selCvSize' + iDisplaySequence + '")');
		
		iSize = 0;

		if (oSize != null) {
			emptyOptions(oSize);

			insertOption(oSize, 'Select size', 'Select size');

			for (var i=0; i<colourVariants[iArraySeq_Product].length; i++) {
				//check for duplicates
				bInList = false;
				for (var j=0; j < oSize.length; j++) {
					if (oSize[j].text==colourVariants[iArraySeq_Product][i].size) {
						bInList = true;
						break;
					}
				}
				if (!bInList && colourVariants[iArraySeq_Product][i].colour == sColour) {
					insertOption(oSize, colourVariants[iArraySeq_Product][i].size, colourVariants[iArraySeq_Product][i].id); //iSize);
					iSize++;
				}
			}
		}	
	}
	//------------------------------------------------------------------------------------------


	//------------------------------------------------------------------------------------------
	//------------------------------------------------------------------------------------------
	function buildCvQuantity(iArraySeq_Product, iDisplaySequence) {
		var sSize;
		var sColour;
		var i;

		// Get the selected size & colour
		var oSize = eval('document.getElementById("selCvSize' + iDisplaySequence + '")');
		var oColour = eval('document.getElementById("selCvColour' + iDisplaySequence + '")');

		if (oSize != null) {
			sColour = eval('getSelectText("selCvColour' + iDisplaySequence + '")');
			sSize	= eval('getSelectText("selCvSize' + iDisplaySequence + '")');

			var oQuant = eval('document.getElementById("selCvQuantity' + iDisplaySequence + '")');
			var bQuantityUpdated = false;
			var iStock;

			for (var i=0; i<colourVariants[iArraySeq_Product].length; i++) {
				iStock = colourVariants[iArraySeq_Product][i].stocklevel;
				if((colourVariants[iArraySeq_Product][i].colour.toUpperCase() == sColour.toUpperCase()) && (colourVariants[iArraySeq_Product][i].size == sSize)) {
					insertOptionQuantity(oQuant, iStock);
					bQuantityUpdated = true;
					break;
				}
			}
			if(bQuantityUpdated==false) {
				// No size / colour combination was matched in the array, or more likely, no size was selected - so disabled Quantity Drop-Down
				insertOptionQuantity(oQuant, 0);
			}
		}
	}
	//------------------------------------------------------------------------------------------

	//-------------------------------------------------------------------------------------------------------------------------------------------------
	// This function is called by a RHS Colour Variation product (complete the look), when the size drop-down is changed. (selCvSize0, selCvSize1, etc.)
	// It's purpose is to update the available quantities in the selCvQuantity drop-down. This data comes from the colourVariants[][] array,
	// in the stocklevel parameter.
	// The colourVariants array consists of a product sequence, and SKU sequence - e.g colourVariants[0][0] is the 1st SKU for the 1st product.
	// This function also calls a function to update the price on the product.
	//-------------------------------------------------------------------------------------------------------------------------------------------------
	function updateCvQuantity(iDisplaySequence) {
				
		var iFound = 0;
		var oSize	= eval('document.getElementById("selCvSize' + iDisplaySequence + '")');
		var oQuant = eval('document.getElementById("selCvQuantity' + iDisplaySequence + '")');
			
		// Loop through each product in the colour variants array.
		for(var i=0; i<colourVariants.length; i++) {
			
			// Loop through each SKU in the colour variant identified by 'i'
			for(var j=0; j<colourVariants[i].length; j++) {
				
				// if the item in the array identified by i,j is equal to the newly selected size (selCvSize), then 
				// update the quantity drop-down with the stock level, from the array.
				
				if (colourVariants[i][j].id == oSize.options[oSize.selectedIndex].value) {
				    // Clear out, then re-populate 'selCvQuantity0/1/2/3' with the stock level.
					insertOptionQuantity(oQuant, colourVariants[i][j].stocklevel);
					// bail out of the 'j' loop
					iFound = 1;
					break;
				}
			}
			// the stock level was found - so bail out of the 'i' loop.
			if (iFound == 1) break;
		}
		
		setCvPricing(i,j,iDisplaySequence);
	}


    // Sets the price for a given product variant
    function setCvPricing(iArraySeq_Product, iArraySeq_Variant, iDisplaySequence) {	

		var oNowSale = eval('document.getElementById("cv_pricing_now_sale' + iDisplaySequence + '")');
		var oNow = eval('document.getElementById("cv_pricing_now' + iDisplaySequence + '")');
		var oWas = eval('document.getElementById("cv_pricing_was' + iDisplaySequence + '")');	
		
        // Check to the see if this variant is on promotion.
		if (colourVariants[iArraySeq_Product][iArraySeq_Variant].priceDisplayFlag == 'isondiscount') {
			oNowSale.innerHTML = colourVariants[iArraySeq_Product][iArraySeq_Variant].promoPrice;
			oNow.innerHTML = "";
			oWas.innerHTML = colourVariants[iArraySeq_Product][iArraySeq_Variant].price;

			if(showAltPrice) {
				oNowSale.innerHTML = oNowSale.innerHTML + ' (' + colourVariants[iArraySeq_Product][iArraySeq_Variant].altPromoPrice + ')';
				oWas.innerHTML = oWas.innerHTML + ' (' + colourVariants[iArraySeq_Product][iArraySeq_Variant].altPrice + ')';
			}
			oNowSale.style.display = "inline";
			oNow.style.display = "none";
			oWas.style.display = "inline";

        // Check if variant is on sale...
		} else if (colourVariants[iArraySeq_Product][iArraySeq_Variant].salePrice) {
			oNowSale.innerHTML = colourVariants[iArraySeq_Product][iArraySeq_Variant].salePrice;
			oNow.innerHTML = "";
			oWas.innerHTML = colourVariants[iArraySeq_Product][iArraySeq_Variant].price;
					
			if(showAltPrice) {
				oNowSale.innerHTML = oNowSale.innerHTML + ' (' + colourVariants[iArraySeq_Product][iArraySeq_Variant].altSalePrice + ')';
				oWas.innerHTML = oWas.innerHTML + ' (' + colourVariants[iArraySeq_Product][iArraySeq_Variant].altPrice + ')';
			}
			oNowSale.style.display = "inline";
			oNow.style.display = "none";
			oWas.style.display = "inline";
			
		// Not on promo or sale
		} else { 
			oNowSale.innerHTML = "";
			oNow.innerHTML = colourVariants[iArraySeq_Product][iArraySeq_Variant].price;
			oWas.innerHTML = "";

			if(showAltPrice) {
				oNow.innerHTML = oNow.innerHTML + ' (' + colourVariants[iArraySeq_Product][iArraySeq_Variant].altPrice + ')';
			}
			oNowSale.style.display = "none";
			oNow.style.display = "inline";
			oWas.style.display = "none";
		}
    }

	function buildCVPanelItems(){
	
		var sHTML = "";	
		var sProductTitle = "";
        
		for (iDisplaySequence = 0; iDisplaySequence < 4; iDisplaySequence++) {

			// left panel		
			sHTML = sHTML + "<li id=\"cvProductPanel" + iDisplaySequence + "\">";
			sHTML = sHTML + "<div class=\"panel_left\">";
			sHTML = sHTML + "<a href=\"?product_id=#\" id=\"cv_anchor" + iDisplaySequence + "\">";
			sHTML = sHTML + "<img src=\"\" alt=\"\" title=\"\" id=\"imgCv" + iDisplaySequence + "\" border=\"0\" class=\"product_suggestion\" /></a></div>";
					
			// right panel
			sHTML = sHTML + "<div class=\"panel_right\">";
			sHTML = sHTML + "<p class=\"item_title\" id=\"cvProduct_title" + iDisplaySequence + "\"></p>";
			sHTML = sHTML + "<p id=\"cv_pricing_now" + iDisplaySequence + "\" class=\"price\"></p>";
			sHTML = sHTML + "<p id=\"cv_pricing_now_sale" + iDisplaySequence + "\" class=\"price_former\"></p>";
			sHTML = sHTML + "<p id=\"cv_pricing_was" + iDisplaySequence + "\" class=\"price\"></p>";
			sHTML = sHTML + "<select id=\"selCvColour" + iDisplaySequence + "\" name=\"selCvColour" + iDisplaySequence + "\" title=\"1. Please select a Colour\" onchange=\"updateCVDetailsOnColourChange(" + iDisplaySequence + ");\"></select>";
			sHTML = sHTML + "<select id=\"selCvSize" + iDisplaySequence + "\" name=\"selCvSize" + iDisplaySequence + "\" title=\"2. Please select a Size\" onchange=\"updateCvQuantity(" + iDisplaySequence + ");\"></select>";
			sHTML = sHTML + "<select id=\"selCvQuantity" + iDisplaySequence + "\" name=\"selCvQuantity" + iDisplaySequence + "\" title=\"3. Please select a Quantity\"></select>";
			sHTML = sHTML + "<span alt=\"Add to bag\" title=\"Add to bag\" onclick=\"addtobag(" + iDisplaySequence + ",2);\" class=\"right_add\">ADD TO BAG</span>";
			sHTML = sHTML + "</div></li>";
		}
		if (document.getElementById('mycarousel2')) {
    		document.getElementById('mycarousel2').innerHTML = sHTML;
    	}
	
	}



	//**********************************************************************************************************************************
	// Helper functions for the section above.
	
	//------------------------------------------------------------------------------------------
	// This function change a combo box selected value, by the text (rather than the value)
	//------------------------------------------------------------------------------------------
	function setSelectedDropDown(objSelect, sTextToFind) {
		var i;
		
		for (i = 0; i < objSelect.options.length ; i++) {
			if (objSelect.options[i].text == sTextToFind) {
				objSelect.options[i].selected = true;
				break;
			}
		}
	}
	//------------------------------------------------------------------------------------------
	
	

	//**********************************************************************************************************************************
	//**********************************************************************************************************************************



	// == Generic functions ==
	function MM_preloadImages() {
		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_findObj(n, d) {
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
	}

	function MM_swapImage() {
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	function MM_swapImagecycle() {
		intcycle++;
		if(intcycle > 3){intcycle=0;}
		if(intcycle > (aImages.length-1)){intcycle=0;}
		MM_swapImage('prodImage','',aImages[intcycle],1);
	}

	function submitQwiserSearch() {
		var searchTerm;
		searchTerm = document.frmProduct.qwterm.value;
		searchTerm = searchTerm.replace(/&amp;/g, "%26");
		window.location = "nsf/qwiser.asp?term=" + searchTerm;
	}

	// START: Shopping Cart Pop-up
	var popUpTimerId;
	function showPopUp() {
		showTimedPopUp();
		//popUpTimerId = setTimeout("hideTimedPopUp()", 3000);
	}

	function showTimedPopUp() {
		var oPopUp = document.getElementById('item_added');

		//display pop up
		oPopUp.style.display = "inline";

		// center pop up
		oPopUp.style.left = parseInt(oPopUp.offsetWidth / 2) + "px";
		oPopUp.style.top = parseInt(oPopUp.offsetHeight / 2) + "px";

		//display overlay
		document.getElementById("overlay").style.display = "inline";
	}

	function hideTimedPopUp() {
		document.getElementById("item_added").style.display = "none";
		document.getElementById("overlay").style.display = "none";
	}

	function cShop() {
		//clearTimeout(popUpTimerId);
		hideTimedPopUp();
	}

	function cCart() {
		//clearTimeout(popUpTimerId);
		var pth = window.location.protocol + '//' + window.location.host + window.location.pathname.substring(0, 4);
		window.location.href = "basket/bsk_basket.asp?cm_re=header-_-textlink-_-viewcart&ShowXSell=on&redirect=" + escape((window.location.href.replace(pth, "")).replace("&added=1",""));
	}
	// END: Shopping Cart Pop-up



	function swapImage(sImageType) {
		// Main product image
		var oImgMain		= document.getElementById('imgFront');
		var oImgMainThumb	= document.getElementById('imgFrontThumb');
		
		// Thumb to swap with
		var oImgThumb		= eval('document.getElementById("img' + sImageType + '")');
		var oImgThumbZm		= eval('document.getElementById("img' + sImageType + 'Zoom")');

		//set the current main image
		sCurrentImg			= oImgMain.src;
		sCurrentZm			= oImgMain.alt;
		sCurrentThumb		= oImgMainThumb.value;

		//set the next main image
		sNextMainImg		= oImgThumb.alt;
		sNextMainZm			= oImgThumbZm.value;
		sNextMainThumb		= oImgThumb.src;
		
		//set main image
		oImgMain.src		= sNextMainImg;
		oImgMain.alt		= sNextMainZm;
		oImgMainThumb.value	= sNextMainThumb;
		
		//replace thumb image
		oImgThumb.src		= sCurrentThumb;
		oImgThumb.alt		= sCurrentImg;
		oImgThumbZm.value	= sCurrentZm;
	}

	function toggle_info(iShow) {
		var oInfo1 = document.getElementById("toggle_info1");
		var oInfo2 = document.getElementById("toggle_info2");
		var oText1 = document.getElementById("toggle1text");
		var oText2 = document.getElementById("toggle2text");

		oInfo1.style.display = "none";
		oInfo2.style.display = "none";
		eval("oInfo" + iShow + ".style.display = 'block'");


		oText1.style.borderBottom = '0px';
		oText2.style.borderBottom = '0px';
		eval("toggle" + iShow + "text.style.borderBottom = '1px dotted #666'");
	}