
//hide the number of layers given as a parameter. Layer name is always L1, L2, L3, L4, ...Ln where n=val.
//should work for old MSIE, Netscape4 and browsers that support the DOM.
//val is total number of buying guides sections
function hideVisibility(val)
{
	if(document.getElementById){
		for(i=1; i<=val; i++)
		{
			var str = new String();
			str = "document.getElementById('L" + i + "').style.visibility = 'hidden'";
			eval(str);
		}
	}
	else if (document.all) {
		for(i=1; i<=val; i++)
		{
			var str = new String();
			str = "document.all['L" + i + "'].style.visibility = 'hidden'";
			eval(str);
		}
	}
	else if (document.layers) {
		for(i=1; i<=val; i++)
		{
			var str = new String();
			str = "document.layers['L" + i + "'].visibility = 'hide'";
			eval(str);
		}
	}
}

//shows one section, hides all the others. id is section to show, val is total number of buying guides sections
function showLayer(id, val)
{
	hideVisibility(val);
	if (document.getElementById) {
	// DOM
	document.getElementById(id).style.visibility = "visible";
	}
	else if (document.all) {
	// OLD MSIE VERSIONS
	document.all[id].style.visibility = "visible";
	}
	else if (document.layers) {
	// NETSCAPE 4
	document.layers[id].visibility = "show";
	}
}

//hide all product descriptions
//val is total number of descriptions (= number of sections + 1)
function hideDesc(val)
{
		if(document.getElementById){
			for(i=1; i<=val; i++)
			{
				eval("document.getElementById('prodDesc" + i + "').style.visibility = 'hidden'");
			}
		}
		else if (document.all) {
			for(i=1; i<=val; i++)
			{
				eval("document.all['prodDesc" + i + "'].style.visibility = 'hidden'");
			}
		}
		else if (document.layers) {
			for(i=1; i<=val; i++)
			{
				eval("document.layers['prodDesc" + i + "'].visibility = 'hide'");
			}
		}
}

//show the description of the product id given as a parameter
//num is section to hide; id is section to show
function showDesc(id, num)
{
	hideDesc(num);
	if (document.getElementById) {
	// DOM
	document.getElementById(id).style.visibility = "visible";
	}
	else if (document.all) {
	// OLD MSIE
	document.all[id].style.visibility = "visible";
	}
	else if (document.layers) {
	// NN4
	document.layers[id].visibility = "show";
	}
}

//show standard text for product description (always onmouseout)
//num is total number of descriptions; prodDesc1 is standard text that will show onmouseout
function showText(num)
{
	hideDesc(num);
	if(document.getElementById)
		document.getElementById('prodDesc1').style.visibility = "visible";
	else if (document.all) {
		document.all['prodDesc1'].style.visibility = "visible";
	}
	else if (document.layers) {
		document.layers['prodDesc1'].visibility = "show";
	}
}

//set arrow to point to  first link (always the default one)
function setStartCol()
{
	if (document.getElementById) {
	// DOM
		document.getElementById('bullet1').src = "/wcsstore/homebase/en_US/images/arrow_select.gif";
	}
	else if (document.all) {
	// OLD MSIE
		document.all['bullet1'].src = "/wcsstore/homebase/en_US/images/arrow_select.gif";
	}
	// NN4
	else if(document.layers){
		document.bullet1.src = "/wcsstore/homebase/en_US/images/arrow_select.gif";
	}
}

//set arrow to point to the selected link
//elem is section we want arrow to point to; val is total number of buying guides sections
function setColour(elem, val)
{
	if(document.getElementById)
	{
		for (i=1; i<=val; i++)
		{
			eval("document.getElementById('bullet" + i + "').src = '/wcsstore/homebase/en_US/images/bullet_green.gif'");
		}
		document.getElementById(elem).src = "/wcsstore/homebase/en_US/images/arrow_select.gif";
	}
	else if (document.all){
		for (i=1; i<=val; i++)
		{
			eval("document.all['bullet" + i + "'].src = '/wcsstore/homebase/en_US/images/bullet_green.gif'");
		}
		eval("document.all['" + elem + "'].src = '/wcsstore/homebase/en_US/images/arrow_select.gif'");
	}
	else if(document.layers){
		for (i=1; i<=val; i++)
		{
			eval("document.bullet" + i + ".src = '/wcsstore/homebase/en_US/images/bullet_green.gif'");
		}
		eval("document." + elem + ".src = '/wcsstore/homebase/en_US/images/arrow_select.gif'");
	}
}

//green arrow moves up and down as user hovers mouse between menu selections. If selection is already
//highlighted, the arrow stays red, otherwise, the bullet turns into a green arrow when the mouse goes
//over the menu item
//elem is the id of the bullet image that the mouse is moving over

function arrow_navigate(elem)
{
	var str_url = new String();
	var img_url = new RegExp('arrow_select.gif');

	//DOM
	if(document.getElementById)
	{
		str_url = document.getElementById(elem).src;

		//determines whether there is a selecting red arrow. If there is, ignore.
		if(!str_url.match(img_url))
			document.getElementById(elem).src = "/wcsstore/homebase/en_US/images/arrow_select_green.gif";
	}
	//OLD MSIE
	else if (document.all)
	{
		str_url = eval("document.all['" +elem+ "'].src");

		//determines whether there is a selecting red arrow. If there is, ignore.
		if(!str_url.match(img_url))
			eval("document.all['" + elem + "'].src = '/wcsstore/homebase/en_US/images/arrow_select_green.gif'");
	}
	//NETSCAPE
	else if(document.layers)
	{
		str_url = eval("document."+elem+".src");

		//determines whether there is a selecting red arrow. If there is, ignore.
		if(!str_url.match(img_url))
			eval("document." + elem + ".src = '/wcsstore/homebase/en_US/images/arrow_select_green.gif'");
	}
}

//After the previous function arrow_navigate(), on mouseout, turn the green arrow into a bullet again, ensuring
//that the red arrow stays as it is.
//elem is the id of the bullet image that the mouse is moving over
function set_bullet(elem)
{
	var str_url = new String();
	var img_url = new RegExp('arrow_select.gif');

	//DOM
	if(document.getElementById)
	{
		str_url = document.getElementById(elem).src;

		//determines whether there is a selecting red arrow. If there is, ignore.
		if(!str_url.match(img_url))
			document.getElementById(elem).src = "/wcsstore/homebase/en_US/images/bullet_green.gif";
	}
	//OLD MSIE
	else if (document.all)
	{
		str_url = eval("document.all['" +elem+ "'].src");

		//determines whether there is a selecting red arrow. If there is, ignore.
		if(!str_url.match(img_url))
			eval("document.all['" + elem + "'].src = '/wcsstore/homebase/en_US/images/bullet_green.gif'");
	}
	//NETSCAPE
	else if(document.layers)
	{
		str_url = eval("document."+elem+".src");

		//determines whether there is a selecting red arrow. If there is, ignore.
		if(!str_url.match(img_url))
			eval("document." + elem + ".src = '/wcsstore/homebase/en_US/images/bullet_green.gif'");
	}
}



