try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

function FormElementsHide() {
	//var SearchSuggestHide = document.getElementsByTagName("input");
	//for (var i = 0; i < SearchSuggestHide.length; i++) {
	//	if (SearchSuggestHide[i].style.visibility != "hidden") {
	//		SearchSuggestHide[i].style.visibility = "hidden";
	//	}
	//}
	//var SearchSuggestHide2 = document.getElementsByTagName("select");
	//for (var i = 0; i < SearchSuggestHide2.length; i++) {
	//	if (SearchSuggestHide2[i].style.visibility != "hidden") {
	//		SearchSuggestHide2[i].style.visibility = "hidden";
	//	}
	//}
	//document.getElementById("HeaderSearch").style.visibility = "hidden";
	//document.getElementById("HeaderSearchButton").style.visibility = "hidden";
}
function FormElementsShow() {
	//var SearchSuggestHide = document.getElementsByTagName("input");
	//for (var i = 0; i < SearchSuggestHide.length; i++) {
	//	if (SearchSuggestHide[i].style.visibility != "visible") {
	//		SearchSuggestHide[i].style.visibility = "visible";
	//	}
	//}
	//var SearchSuggestHide2 = document.getElementsByTagName("select");
	//for (var i = 0; i < SearchSuggestHide2.length; i++) {
	//	if (SearchSuggestHide2[i].style.visibility != "visible") {
	//		SearchSuggestHide2[i].style.visibility = "visible";
	//	}
	//}
	//document.getElementById("HeaderSearch").style.visibility = "visible";
	//document.getElementById("HeaderSearchButton").style.visibility = "visible";
}

function HeaderSearchClick(TheSearchBox) {
	if (TheSearchBox.value == "Search") {
		TheSearchBox.value = "";
	}
	TheSearchBox.style.color = "#000000";
}
function HeaderSearchBlur(TheSearchBox) {
	if (TheSearchBox.value == "" || TheSearchBox.value == "Search") {
		TheSearchBox.value = "Search";
	}
	TheSearchBox.style.color = "#1D6CB2";
}
function HeaderSearchButtonClick() {
	document.forms.HeaderSearch.submit();
}

function ToggleTab(TheTab, TheTabStatus) {
	if (document.getElementById("TabMid" + TheTab).className != "TabMid" + TheTabStatus) {
		document.getElementById("TabMid" + TheTab).className = "TabMid" + TheTabStatus;
	}
	if (document.getElementById("TabLeft" + TheTab).className != "TabLeft" + TheTabStatus) {
		document.getElementById("TabLeft" + TheTab).className = "TabLeft" + TheTabStatus;
	}
	if (document.getElementById("TabRight" + TheTab).className != "TabRight" + TheTabStatus) {
		document.getElementById("TabRight" + TheTab).className = "TabRight" + TheTabStatus;
	}
	if (document.getElementById("TabPad" + TheTab).className != "TabPad" + TheTabStatus) {
		document.getElementById("TabPad" + TheTab).className = "TabPad" + TheTabStatus;
	}
}
function ToggleMenu(TheTab, TheMenuStatus) {
	if (TheMenuStatus == "On") {
		if (document.getElementById("Menu" + TheTab).style.display != "block") {
			document.getElementById("Menu" + TheTab).style.display = "block";
		}
	} else {
		if (document.getElementById("Menu" + TheTab).style.display != "none") {
			document.getElementById("Menu" + TheTab).style.display = "none";
		}
	}
}

function BasketGet() {
	xmlHttp = GetXmlHttpObject(StateChangedBasket);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function BasketAdd(TheMFGno,ThePrice,TheQty) {
	xmlHttp = GetXmlHttpObject(StateChangedBasket);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Add&MFGno=" + TheMFGno + "&Price=" + ThePrice + "&Qty=" + TheQty;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function BasketAddImage(TheMFGno,ThePrice,TheQty) {
	document.getElementById("Button" + TheMFGno).style.display = "none";
	document.getElementById("ButtonClick" + TheMFGno).style.display = "";
	BasketAdd(TheMFGno,ThePrice,TheQty);
	window.location = "#";
	setTimeout("document.getElementById('Button" + TheMFGno + "').style.display = ''",500);
	setTimeout("document.getElementById('ButtonClick" + TheMFGno + "').style.display = 'none'",500);
}
function BasketEdit(TheMFGno,TheQtyBox) {
	TheQty = document.getElementById(TheQtyBox).value;
	if (TheQty != "") {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var TheQty;
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Edit&MFGno=" + TheMFGno + "&Qty=" + TheQty;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function BasketDelete(TheMFGno) {
	xmlHttp = GetXmlHttpObject(StateChangedBasket);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Delete&MFGno=" + TheMFGno;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function BasketPaymentType() {
	xmlHttp = GetXmlHttpObject(StateChangedBasket);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=PaymentType&Selection=" + document.getElementById("PaymentType").value;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function BasketExpress(TheAction,NotInStock) {
	if (NotInStock == "Y") {
		var answer = confirm("At least one of the items in your basket is not currently in stock. Please note that these items will probably not be with you within the next working day, although the rest of your order should be. Click 'OK' to select express shipping, or click 'Cancel' to revert back to our standard delivery rate.");
	} else {
		answer = true;
	}
	if (answer) {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Express&State=" + TheAction;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function BasketCourierPack(TheAction,NotInStock) {
	if (NotInStock == "Y") {
		var answer = confirm("At least one of the items in your basket is not currently in stock. Please note that these items will probably not be with you in 24hrs, although the rest of your order should be. Click 'OK' to select courier pack, or click 'Cancel' to revert back to our standard delivery rate.");
	} else {
		answer = true;
	}
	if (answer) {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=CourierPack&State=" + TheAction;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function BasketCollect(TheAction,NotInStock) {
	if (NotInStock == "Y") {
		var answer = confirm("At least one of the items in your basket is not currently in stock. Please note that these items will probably not be available to collect. Please call to discuss availability. Click 'OK' to select free collection, or click 'Cancel' to revert back to our standard delivery rate.");
	} else {
		answer = true;
	}
	if (answer) {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Collect&State=" + TheAction;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function BasketCoupon() {
	if (document.getElementById("DiscountCode").value != "") {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Coupon&Code=" + document.getElementById("DiscountCode").value;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	} else {
		alert("You haven't entered a discount code. Please do so and click 'update' again.");
	}
}
function SaveBasket() {
	if (document.getElementById("BasketTitle").value != "" || document.getElementById("BasketTitle").value != "Enter a title") {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=SaveBasket&Title=" + document.getElementById("BasketTitle").value;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	} else {
		alert("You haven't entered a basket title. Please do so and click 'save' again.");
	}
}
function SaveBasketRestore(TheID) {
	if (confirm('Delete existing basket contents and restore this basket?')) {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=SaveBasketRestore&ID=" + TheID;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function SaveBasketDelete(TheID) {
	if (confirm('Delete this basket?')) {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=SaveBasketDelete&ID=" + TheID;
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function BasketCancel() {
	var answer = confirm("Are you sure you want to cancel this order? Clicking 'OK' will empty your current shopping basket.");
	if (answer) {
		xmlHttp = GetXmlHttpObject(StateChangedBasket);
		var Stamp = new Date();
		var Hours = Stamp.getHours();
		var Mins = Stamp.getMinutes();
		var Secs = Stamp.getSeconds();
		var Millis = Stamp.getMilliseconds();
		var url = "include_basket.asp?Time=" + Hours + Mins + Secs + Millis + "&Action=Cancel";
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}
function StateChangedBasket() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText != "") {
			if (document.getElementById("Basket").innerHTML != xmlHttp.responseText) {
				document.getElementById("Basket").innerHTML = xmlHttp.responseText;
			}
			//if (document.getElementById("Content").style.marginRight != "170px") {
			//	document.getElementById("Content").style.marginRight = "170px";
			//}
			if (document.getElementById("Basket").style.display != "block") {
				document.getElementById("Basket").style.display = "block";
			}
			BasketSize();
		} else {
			if (document.getElementById("Basket").style.display != "none" && document.getElementById("Basket").style.display != "") {
				document.getElementById("Basket").style.display = "none";
			}
			//if (document.getElementById("Content").style.marginRight != "5px" && document.getElementById("Content").style.marginRight != "") {
			//	document.getElementById("Content").style.marginRight = "5px";
			//}
			BasketSize();
		}
	}
}
function GetXmlHttpObject(handler) {
	var objXmlHttp = null;
	if (window.XMLHttpRequest) {
		// Mozilla | Netscape | Safari | IE7
		objXmlHttp = new XMLHttpRequest();
		if (objXmlHttp != null) {
			objXmlHttp.onload = handler;
			objXmlHttp.onerror = handler;
			objXmlHttp.onreadystatechange = handler;
			objXmlHttp.oncomplete = handler;
		}
	} else {
		// Microsoft
		objXmlHttp = GetMSXmlHttp();
		if (objXmlHttp != null) {
			objXmlHttp.onreadystatechange = handler;
		}
	}
	return objXmlHttp;
}
function GetMSXmlHttp() {
	var xmlHttp = null;
	var clsids = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP.2.6","Microsoft.XMLHTTP.1.0", "Microsoft.XMLHTTP.1","Microsoft.XMLHTTP"];
	for(var i = 0; i < clsids.length && xmlHttp == null; i++) {
		xmlHttp = CreateXmlHttp(clsids[i]);
	}
	return xmlHttp;
}
function CreateXmlHttp(clsid) {
	var xmlHttp = null;
	try {
		xmlHttp = new ActiveXObject(clsid);
		lastclsid = clsid;
		return xmlHttp;
	}
	catch(e) {}
}
function BasketToggleShippingMessage() {
	if (document.getElementById("BasketSummaryShippingMessage").style.display != "block") {
		document.getElementById("BasketSummaryShippingMessage").style.display = "block";
	} else {
		document.getElementById("BasketSummaryShippingMessage").style.display = "none";
	}
	BasketSize();
}
function BasketToggleInfo(TheMFGno) {
	if (document.getElementById("BasketToggleInfo" + TheMFGno).style.display != "block") {
		document.getElementById("BasketToggleInfo" + TheMFGno + "Image").style.backgroundImage = "url(images/basket_item_on.gif)";
		document.getElementById("BasketToggleInfo" + TheMFGno).style.display = "block";
	} else {
		document.getElementById("BasketToggleInfo" + TheMFGno + "Image").style.backgroundImage = "url(images/basket_item_off.gif)";
		document.getElementById("BasketToggleInfo" + TheMFGno).style.display = "none";
	}
	BasketSize();
}
function BasketCheckout() {
	if (document.getElementById("PaymentType").value != "") {
		window.location = "main_checkout.asp";
	} else {
		alert("Please select a payment method and click 'Checkout' again.");
	}
}
function BasketSize() {
	if (document.getElementById("Basket") && document.getElementById("Content") && document.getElementById("ContentBottomSpacer")) {
		var BasketHeight = document.getElementById("Basket").offsetHeight;
		var ContentHeight = document.getElementById("Content").offsetHeight;
		if (parseInt(BasketHeight) > parseInt(ContentHeight) && BasketHeight != "" && ContentHeight != "") {
			var HeightDifference = parseInt(BasketHeight) - parseInt(ContentHeight);
			document.getElementById("ContentBottomSpacer").style.height = (30 + parseInt(HeightDifference));
		} else {
			document.getElementById("ContentBottomSpacer").style.height = 30;
		}
	}
}

function ContentToggleCompatibleMessage() {
	if (document.getElementById("ContentResultsCompatibleMessage").style.display != "block") {
		document.getElementById("ContentResultsCompatibleMessage").style.display = "block";
	} else {
		document.getElementById("ContentResultsCompatibleMessage").style.display = "none";
	}
}

function Login() {
	xmlHttp = GetXmlHttpObject(StateChangedLogin);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "include_basket_login.asp?Time=" + Hours + Mins + Secs + Millis + "&EMail=" + document.getElementById("LoginEMail").value + "&Password=" + document.getElementById("LoginPassword").value;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function StateChangedLogin() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText == "Y") {
			window.location = "http://www.gradientbiz.com";
			//location.reload(true);
		} else {
			alert("Sorry - login failed!");
		}
	}
}

function AdminFeatured(TheMFGno, TheAction) {
	xmlHttp = GetXmlHttpObject(StateChangedAdminFeatured);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "admin_functions.asp?Time=" + Hours + Mins + Secs + Millis + "&Setting=Featured&MFGno=" + TheMFGno + "&Action=" + TheAction;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function StateChangedAdminFeatured() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText == "Y") {
			location.reload(true);
		} else {
			alert("Sorry - product not changed!");
		}
	}
}
function AdminEnabled(TheMFGno, TheAction) {
	xmlHttp = GetXmlHttpObject(StateChangedAdminEnabled);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "admin_functions.asp?Time=" + Hours + Mins + Secs + Millis + "&Setting=Enabled&MFGno=" + TheMFGno + "&Action=" + TheAction;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function StateChangedAdminEnabled() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText == "Y") {
			location.reload(true);
		} else {
			alert("Sorry - product not changed!");
		}
	}
}
function AdminStock(TheMFGno) {
	var AdminStock = document.getElementById("AdminStock" + TheMFGno).value;
	var AdminStockSystemOn = document.getElementById("AdminStockSystemOn" + TheMFGno).checked;
	var AdminStockSystemDisableWhen0 = document.getElementById("AdminStockSystemDisableWhen0" + TheMFGno).checked;
	var AdminStockSystemMessageWhen0 = document.getElementById("AdminStockSystemMessageWhen0" + TheMFGno).value;
	xmlHttp = GetXmlHttpObject(StateChangedAdminStock);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "admin_functions.asp?Time=" + Hours + Mins + Secs + Millis + "&Setting=Stock&MFGno=" + TheMFGno + "&Stock=" + AdminStock + "&StockSystemOn=" + AdminStockSystemOn + "&StockSystemDisableWhen0=" + AdminStockSystemDisableWhen0 + "&StockSystemMessageWhen0=" + AdminStockSystemMessageWhen0;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function StateChangedAdminStock() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText == "Y") {
			location.reload(true);
		} else {
			alert("Sorry - product not changed!");
		}
	}
}
function AdminEMail(TheMFGno, TheAction) {
	xmlHttp = GetXmlHttpObject(StateChangedAdminEMail);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "admin_functions.asp?Time=" + Hours + Mins + Secs + Millis + "&Setting=EMail&MFGno=" + TheMFGno + "&Action=" + TheAction;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function StateChangedAdminEMail() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText == "Y") {
			location.reload(true);
		} else {
			alert("Sorry - product not changed!");
		}
	}
}
function AdminPrice(TheMFGno) {
	var AdminPrice = document.getElementById("Price" + TheMFGno).value;
	xmlHttp = GetXmlHttpObject(StateChangedAdminPrice);
	var Stamp = new Date();
	var Hours = Stamp.getHours();
	var Mins = Stamp.getMinutes();
	var Secs = Stamp.getSeconds();
	var Millis = Stamp.getMilliseconds();
	var url = "admin_functions.asp?Time=" + Hours + Mins + Secs + Millis + "&Setting=Price&MFGno=" + TheMFGno + "&Price=" + AdminPrice;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}
function StateChangedAdminPrice() {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
		if(xmlHttp.responseText == "Y") {
			location.reload(true);
		} else {
			alert("Sorry - product not changed!");
		}
	}
}