function go_to_basket(varLink) {
// This function is now obsolete and remains only for legacy page support
var specInteger, specString, colourInteger, colourString, productIDString, ranNumber
specInteger=document.forms[0].specselect.selectedIndex
specString=document.forms[0].specselect.options[specInteger].value
colourInteger=document.forms[0].colourselect.selectedIndex
colourString=document.forms[0].colourselect.options[colourInteger].value
ranNumber=(new Date).getTime()

window.open("/cgi-bin/basket.cgi?conlink=" + varLink + "&items=" + specString + colourString + "&control=Add&" + ranNumber, "_self")
}
function add_to_basket(oForm, sConLink) 
{
	var sBasketLinkString = ""; 
	var sNoCache = (new Date).getTime();
	var sItemCodeValue = GetFormItemValue(oForm.itemcode);
	var sVariantValue = GetFormItemValue(oForm.variant);
	if (sConLink == undefined) 
	{
		sConLink = document.location.pathname;
	}
	if(sVariantValue != 0 && sVariantValue != "undefined")
	{ 
		sBasketLinkString = sItemCodeValue + sVariantValue + "_1";
	}
	else
	{
		sBasketLinkString = sItemCodeValue + "_1";
	}
	if (oForm.ckbxitemcode != null)
	{
		var len = oForm.ckbxitemcode.length;
		if(len == undefined) len = 1;
		for (i = 0; i < len; i++) 
		{
			if (oForm.ckbxitemcode[i].checked)
			{
				sBasketLinkString += "_" + oForm.ckbxitemcode[i].value;
				if(oForm.ckbxquantity[i].value != 0 && oForm.ckbxquantity[i].value != "undefined")
				{
					sBasketLinkString += "_" + oForm.ckbxquantity[i].value;
				}
				else
				{
					sBasketLinkString += "_1";
				}
			}
		}
	}
	if(sBasketLinkString != "")
	{
		sNoCache=(new Date).getTime()
		sBasketLinkString = "/cgi-bin/basket.cgi?items=" + sBasketLinkString + "&control=Add&conlink=" + sConLink + "&" + sNoCache;
		window.open(sBasketLinkString, "_self");
	}
}
function GetFormItemValue(formItem)
{
	var itemValue = "";
	
	if (formItem) 
	{
		if (formItem.tagName) 
		{
			switch (formItem.tagName) 
			{
				case "INPUT":
				switch (formItem.type) 
				{
					case "hidden":
					itemValue = formItem.value;
					break;
				}
				
				break;
				
				case "SELECT":
					var val = [];
					for (var x=0;x<formItem.options.length;x++)	
					{
						var option = formItem.options[x];
						if (option.selected) 
						{
							itemValue = option.value;
						}
					}
				break;
				
				case "CHECKBOX":
					
					if (formItem.checked)
					{
					itemValue = formItem.value;
					}
				
				break;
				
				case "UNDEFINED":
				
					itemValue = "0";
				
				break;
			}

		}
	}
	
	return itemValue;
}
function BuildBasketLink(sConLink) 
{
	var sBasketLinkString = "";
	var sNoCache = (new Date).getTime();
	if (sConLink == undefined) 
	{
		sConLink = document.location.pathname;
	}
	for (i=0;i<document.AccessoriesForm.ItemQuantity.length;i++)
	{
		var iItemQuantity = GetFormItemValue(document.AccessoriesForm.ItemQuantity[i])
		var sItemValue = GetFormItemValue(document.AccessoriesForm.ItemValue[i])
		if(iItemQuantity != 0 && iItemQuantity != "undefined")
		{ 
			sBasketLinkString += sItemValue + "_" + iItemQuantity + "_";
		}
	}
	if(sBasketLinkString != "")
	{
		sBasketLinkString = "/cgi-bin/basket.cgi?items=" + sBasketLinkString + "&control=Add&conlink=" + sConLink + "&" + sNoCache;
		window.open(sBasketLinkString, "_self");
	}
}



