function checkSearch(){
	if ( document.search.searchField.value == "" ) {
		alert("Please type something to search for.")
		document.search.searchField.focus()
		return false
	}
	else
		return true
}
function checkAdd(intQuantity, strProduct){
	//if (confirm("Do you want to add "+intQuantity+" x \""+strProduct+"\" to your basket?"))
		return true;
	//else
	//	return false;
}
function collectionOnly(intQuantity, strProduct)
{

	alert("Sorry, the "+strProduct+" is only available for collection or local delivery, please contact us to check if we can deliver to your area.");
	return false;
}
function checkAddoption(intQuantity, strProduct, frm){
	var selectedItem = frm.selectedIndex;
	var selectedText = frm.options[selectedItem].text;
	var selectedValue = frm.options[selectedItem].value;
	if (selectedValue > 0){
		//if (confirm("Do you want to add "+intQuantity+" x \""+strProduct+" ("+selectedText+")\" to your basket?"))
			return true;
		//else
		//	return false;
	}
	else{
		alert("Please select which type of \""+strProduct+"\" to add\nby clicking the drop down box next to the add button.");
		return false;
	}
}
function GenEmail(user, domain, suffix){ 
	return(user + '@' + domain + '.' + suffix)
}
function PrintEmail(user, domain, suffix, url){
	if (url=="")
		document.write('<A HREF=mail'+'to:' + user + '@' + domain + '.' + suffix + '>' + user + '@' + domain + '.' + suffix + '</A>')
	else
		document.write('<A HREF=' + url + '>' + user + '@' + domain + '.' + suffix + '</A>')
}

var UniqueID = 314 // Make each link open in a new window 
function PlayerOpen(id, desc) { 
	PlayWin = window.open('/categories/videoplayer.asp?ID='+id, UniqueID, 'width=320,height=350,left=0,resizable=1,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus();
	UniqueID = UniqueID + 1
}

var dropdownstate 	= 0;
var timerID  		= 0;
var topoffset		= 112;
var bottomoffset	= 95;

function ChangeStateDropDown(newstatus){
	var dropdownshadow  = document.getElementById('brandsdropshadow');
	var dropdowncontent = document.getElementById('brandsdd');
	if (dropdownshadow && dropdowncontent){
		if (newstatus == 1 && dropdownstate == 0) {
			var doc3region = YAHOO.util.Region.getRegion(YAHOO.util.Dom.get('doc3'));
			var maxheight  = doc3region.height - topoffset - bottomoffset;
			var newheight  = Math.min(maxheight, YAHOO.util.Dom.getViewportHeight()-topoffset);

			dropdownshadow.style.display = 'block';
			dropdowncontent.style.display= 'block';
			dropdownshadow.style.height  = '0px'; 
			dropdowncontent.style.height = '0px';
			
			var myAnim2 = new YAHOO.util.Anim(dropdowncontent, { height: { to: newheight-26 } }, 0.5, YAHOO.util.Easing.easeOut);
			myAnim2.animate(); 
			var myAnim = new YAHOO.util.Anim(dropdownshadow, { height: { to: newheight-10 } }, 0.5, YAHOO.util.Easing.easeOut);
			myAnim.animate();
			
		} else if (newstatus == 0 && dropdownstate == 1) {
			var myAnim2 = new YAHOO.util.Anim(dropdowncontent, { height: { to: 0 } }, 0.5, YAHOO.util.Easing.easeOut);
			myAnim2.animate(); 
			var myAnim = new YAHOO.util.Anim(dropdownshadow, { height: { to: 0 } }, 0.5, YAHOO.util.Easing.easeOut);
			myAnim.animate();
			myAnim.onComplete.subscribe(function() {
				dropdownshadow.style.display  = 'none';
				dropdowncontent.style.display = 'none';
			});
		}
		dropdownstate = newstatus;
	}
}
function HideDropDown(timerset){
	if (timerset==0 || (timerset==1 && timerID>0)){
		ChangeStateDropDown(0)
	}
	ClearDropDownTimer();
}
function ShowDropDown(timerset){
	if (timerset==0 || (timerset==1 && timerID>0)){
		ChangeStateDropDown(1)
	}
	ClearDropDownTimer();
}
function HideDropDownDelay(){
	timerID = self.setTimeout("HideDropDown(1)", 750)
}
function ClearDropDownTimer(){
	timerID = 0;
}
function view_ingredients(linkid, ingid){
	document.getElementById(linkid).style.display = 'none';
	document.getElementById(ingid).style.display = '';
}
var atbstatus = 0;
function view_aboutthebrand(){
	elem = YAHOO.util.Dom.get('aboutthebrandcontainer');
	if (elem){
		if (atbstatus == 0)
			show_aboutthebrand(elem);
		else
			hide_aboutthebrand(elem);
	}
}
function show_aboutthebrand(elem){
	atbstatus = 1;
	var region = YAHOO.util.Region.getRegion(YAHOO.util.Dom.get('aboutthebrand'));
	var intHeight = region.height + 30;
	var attributes = {
		height: { from: 0, to: intHeight }
	};
	var anim = new YAHOO.util.Anim(elem, attributes, 2, YAHOO.util.Easing.easeBoth);
	anim.animate();
}
function hide_aboutthebrand(elem){
	atbstatus = 0;
	var attributes = {
		height: { to: 0 }
	};
	var anim = new YAHOO.util.Anim(elem, attributes, 1, YAHOO.util.Easing.easeBoth);
	anim.animate();
}