
//fix ie6 flicker
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}




// MouseOver function
function onImage(imgName, imgSrc)
{
        if (document.images)
        {
                document.images[imgName].src = "/images/" + imgSrc + "2.gif";
        }
}


//MouseOut function
function offImage(imgName, imgSrc)
{
        if (document.images)
        { 
                document.images[imgName].src = "/images/" + imgSrc + "1.gif";
        }
}



//buy a product function - most pages
function SubmitMe(productID)
{
	
	window.location.href="AddToBasket.asp?id=" + productID;
}


// more info function displaying popup window - most pages
function MoreInfo(myvar,media,review,info)
{
	var sURL;
	sURL = "more_info.asp?id=" + myvar + "&media=" + media + "&review=" + review + "&info=" + info;
	window.open(sURL,'moreinfo','width=620,height=300,scrollbars=yes,top=0,left=0');
}

function ViewMore(myval)
{
	document.foSearch.media.options[myval].selected = true;
	document.foSearch.submit();
}

// validate search - all pages
function searchValid()
{
	if (document.forms[0].search.value == "")
	{
		alert("You must enter some search criteria in the text field above.");
	}
	else
	{
		document.forms[0].submit();
	}
}


NS4 = (document.layers) ? true : false;

function checkEnter(event)
{ 	
	var code = 0;
	
	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
	if (code==13)
	{
		searchValid();
	}
}


//recommend to friend
function recFriend()
{

	var rUrl="rec_friend.asp";
	window.open(rUrl, 'recommend','width=600,height=300,scrollbars=yes,top=0,left=0');

}

// if user cant find what they're looking for, we'll see if we can get hold of it
function findIt(type)
{
	var qstring="";
	if (type)
	{
		qstring="?pType="+type;
	}
	var rUrl="find.asp"+qstring;
	window.open(rUrl, 'find','width=600,height=300,scrollbars=yes,top=0,left=0');
}

// review of product popup window - results page and more info window
function seeReview(myvar,media,review,info)
{
	var sURL;
	sURL = "review.asp?revID="+myvar+"&media="+media+"&review="+review+"&info="+info;
	window.open(sURL,'review','width=620,height=300,scrollbars=yes,top=0,left=0');
}

function checkLogoff()
{
	if (confirm("Are you sure you wish to logoff?"))
	{
		window.location.href="Logoff.asp"
	}
}

function findLeftIconPos()
{
	// winW = screen width
	// left td width = 210px
	// right td width = 210px
	// y = winW - left td width - right td width = middle section width ... y=winW-420
	// z = (y - 355)/2 ... (winW-420-355)/2 ... (winW-775)/2
	// left = left td width + z ... 210+((winW-775)/2)
	
	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false
	
	winW = (ns4)? window.innerWidth-16 : document.body.offsetWidth-20
	//winH = (ns4)? window.innerHeight : document.body.offsetHeight

	var leftValue = Math.round(210+((winW-775)/2))
	return leftValue;
}
