$(document).ready(function(){
	quicklinkgo();
});	

function quicklinkgo(){
	var btn = document.getElementById('quicklinks_go');
	if(!btn)
		return false;
	btn.style.display='none';//hide the button

	btn = document.getElementById('quicklinks_select');
	if(btn)btn.onchange=function(){this.parentNode.submit();}
}
function cleanOnFocus(field,defaultText){
	try{
		if(!field.tagName == "INPUT" || !field.type=="text" || !field.value)
			return false;
		if(field.value == defaultText)
			field.value='';
	}catch(e){
		return false;
	}
}
function resetOnLostFocus(field,defaultText){
	try{
		if(!field.tagName == "INPUT" || !field.type=="text")
			return false;
		if(!field.value)
			field.value=defaultText;
	}catch(e){
		return false;
	}
}

function testShipCat(product, category) {
	if ( category === 4 ) {
		if(confirm("Adding this item to your basket will remove all other items as this item can only be shipped seperately")) {
			window.location = "product_basket_actions.cfm?catditem=" + product;
			return false;
		} else return false;
	} else return true;
}

function toggleDisable(e) {
	
	if (e.checked) {
		bgColour = "#eeeeee";
		isDisabled = true;
	} else {
		bgColour = "#ffffff";
		isDisabled = false;
	}
	
	document.orderform.del_forename.disabled = isDisabled;
	document.orderform.del_forename.style.backgroundColor = bgColour;
	
	document.orderform.del_surname.disabled = isDisabled;
	document.orderform.del_surname.style.backgroundColor = bgColour;
	
	document.orderform.del_address_1.disabled = isDisabled;
	document.orderform.del_address_1.style.backgroundColor = bgColour;
	
	document.orderform.del_address_2.disabled = isDisabled;
	document.orderform.del_address_2.style.backgroundColor = bgColour;
	
	document.orderform.del_city.disabled = isDisabled;
	document.orderform.del_city.style.backgroundColor = bgColour;
	
	document.orderform.del_postcode.disabled = isDisabled;
	document.orderform.del_postcode.style.backgroundColor = bgColour;
	
	document.orderform.del_country.disabled = isDisabled;
	document.orderform.del_country.style.backgroundColor = bgColour;
}
