
var vertical = false;

/* VERY IMPORTANT!
 It should put here the number of menus, the script is not able to count all
 alone! :-p So if your code is going to have to put it <p id="menu5"...> 5. */
var nbmenu = 7;



/* Center the menu? (true / false).
 Center horizontally or vertically depending on the selected mode. */
var centrer_menu = false;

/* We are obliged to define a width for menus.
 To menu of different widths:
 largeur_menu var = new Array (menu1 width, width menu2, menu3 width ...)
 We must be careful to put as much value as the number of menu!
 Warning, if you're vertical menu, put a fixed width (not Array) !
	*/
var largeur_menu = 95;

/* In vertical mode, you need to know the height of each menu.
 Even if the "boxes" are not sized by height.
 Set this variable if the menus are too close together or spaced vertically.
 To menu of different heights:
 hauteur_menu var = new Array (menu1 height, height menu2, menu3 height ...)
 We must be careful to put as much value as the number of menu!
 Warning, if you're horizontal menu, put a fixed width (not Array)!	*/
var hauteur_menu = 25;

/* In horizontal mode.
 Width of the submenus, only for IE, other browsers are the width
 self. Turn "Auto"only if you are sure you have put in place
 space items!
 To sub-menus of different widths:
 largeur_sous_menu var = new Array (largeur1, width2 ...).
 We must be careful to put as much value as menus.
 If a menu has no sub-menus, there must be something anyway!
 It is possible to "self"in some columns, provided they meet the
 above set.	*/
var largeur_sous_menu = 150;

/* For browsers automatically knowing the width (fit to content), this
 option (on by default) provides a wide automatic. Otherwise
 (false), the submenus will largeur_sous_menu width. */
var largeur_auto_ssmenu = true;

/* ... to put some space between the menus! */
var espace_entre_menus = 5;


/* position of the menu from the top of the screen or page.
 0 = menu at the top. by px */
var top_menu = 1;

/* Flat version.
 position of sub-menus from the top of the screen or page. There should be
 the height of the menus, so do not get to 0 and "groping". by px */
var top_ssmenu = top_menu + 34;

/* Position of the left menu, px */
var left_menu = 0;

/* In vertical version.
 Position of sub-menus from the left edge of the screen */
var left_ssmenu = largeur_menu+2;

/* When the mouse leaves a sub-menu, if the sub-menu disappears immediately,
 it hurts the user. Then you can put a delay before disappearance of the sub-menu.
 500 ms is good :-) */

var delai = 100; // en milliseconde

/* As the menu may overlap with the text of the page, it is possible to
 Page down a bit (we increase the top margin) for airing a little page,
 forty pixel is not bad. by px*/
var marge_en_haut_de_page = top_menu; //+ 40;
/* In vertical version.
 Is shifted to the right for the document not on the menu overlays.
 */
var marge_a_gauche_de_la_page = largeur_menu + 10;


/* Set to true if you want the menu is always visible.
 Set false if you do not want, in this case the menu will disappear "when you
 descend into the page.
 */
var suivre_le_scroll=true;

/* For IE only tags <select> always go over the menu, so
 default the dropdown is hidden when the menu is open, then the fact
 reappear at the close of the menu. To prevent this, set to false. */
var cacher_les_select=true;


var timeout; //do not touch, is to declare the variable
var agt = navigator.userAgent.toLowerCase();
var isMac = (agt.indexOf('mac') != -1);
var isOpera = (agt.indexOf("opera") != -1);
var IEver = parseInt(agt.substring(agt.indexOf('msie ') + 5));
var isIE = ((agt.indexOf('msie')!=-1 && !isOpera && (agt.indexOf('webtv')==-1)) && !isMac);
var isIE5win = (isIE && IEver == 5);
var isIE6win = (isIE && IEver == 6);
var isIE7win = (isIE && IEver == 7);
var isIE8win = (isIE && IEver == 8)
var isIE5mac = ((agt.indexOf("msie") != -1) && isMac);
var blnOk=true;
//to remove the "px" to compute ...
var reg = new RegExp("px", "g");
var menu = "";
var para = "";
//var whiteline = "ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_whiteLine";
//var blueExtendArea = "ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_DHTMLBlueExtendArea";
var whiteline = "";
var blueExtendArea = "";

// onscroll for Internet Explorer, position: fixed does this work for other browsers

// Meeting Standards CSS ...

//window.onscroll = function()
//{
//	if (blnOk && suivre_le_scroll && (isIE || isIE5mac))
//	{
//		if (isIE5mac) document.getElementById("conteneurmenu").style.visibility="hidden";
//		var cumul=0;
//		for(i=1;i<=nbmenu;i++)
//		{
//			if (!vertical) {
//				document.getElementById(para+i).style.top = document.body.scrollTop + top_menu + "px";
//				if (document.getElementById(menu+i))//undefined
//				{
//					document.getElementById(menu+i).style.top = document.body.scrollTop + top_ssmenu + "px";
//			    }
//			} 
//		}
//		if (isIE5mac) document.getElementById("conteneurmenu").style.visibility="visible";
//	}
//}

function preChargement()
{
	if (document.getElementById("conteneurmenu"))
	{
	    
		document.getElementById("conteneurmenu").style.visibility="hidden";
		//IE5 mac has a bug: when a text is in a style element float, it is not
		/*if (isIE5mac)
		{
			document.getElementById("conteneurmenu").style="";
		}*/
	}
}

function Chargement(menuname, paraname, whiteLineName, blueExtendAreaName) {
    menu = menuname;
    para = paraname;
    //alert(whiteLineName+ "      "+blueExtendAreaName);
    whiteline = whiteLineName;
    blueExtendArea = blueExtendAreaName;
    if (typeof menuname != "undefined")
    {
    
	if (!blnOk) {
		if(document.body.style.backgroundColor!="") { blnOk=false; }
		if(document.body.style.color!="") { blnOk=false; }
		if(document.body.style.marginTop!="") { blnOk=false; }
		if(document.getElementById) {
			with(document.getElementById("conteneurmenu").style) {
				if(position!="" || top!="" || left!=""
						|| width!="" || height!="" || zIndex!=""
						|| margin!="" || visibility!="") {
					blnOk=false;
				}
			}
		}
		else{
			blnOk=false;
		}
	}

	if(blnOk)
	{
	    if (document.getElementById("conteneurmenu"))
	    {
		    document.getElementById("conteneurmenu").style.visibility="hidden";
		}
		
		trimespaces();
		if ((document.body))
		{
		    with(document.body.style) {
			    if (!vertical) marginTop=marge_en_haut_de_page+"px";
		    }
		}
		
		positionne();
		HideMenus();
	}

	// was avoided as blinking, now it brings up the menu;-)
	if (document.getElementById("conteneurmenu"))
	    document.getElementById("conteneurmenu").style.visibility='';
	
	}
	else
	{
	 //blnOk = false;
	}
	
	
}
//window.onresize = Chargement(menu,para);
 
 // Incident Number : INC700013415492 
 //Not Implemented menu.js ur://www.whsmith.co.uk/Script/menu.js
 
//window.onresize = Chargement(menu,para,whiteline,blueExtendArea);
window.onresize = function(){
    Chargement(menu,para,whiteline,blueExtendArea);
}

// This function will set the zIndex of the div tags in IE 6.0 and IE 7.0.
// Because, in this two browser zIndex is not working properly.
// So we need to explicitly set the zIndex as -1. 

function ChangeStyleOfControls()
{
    //alert(isIE6win +"   "+ isIE7win);
    if (isIE6win || isIE7win || isIE8win)
	{
       if (document.getElementById("divID")!=null)
	   {
	    //alert(document.getElementById("divID"));
	    document.getElementById("divID").style.zIndex = -1;
	   }
	   if (document.getElementById("subnav-wrapper")!=null)
	   { 
	    document.getElementById("subnav-wrapper").style.zIndex = -1;
	    if (isIE7win)
	    {
	     document.getElementById(menu+"1").style.zIndex = 3000;
	    }
	    //document.getElementById("subnav-wrapper").position = "absolute";
	   }
	   if (document.getElementById("search")!=null)
	   {
	    document.getElementById("search").style.zIndex = -1;
	   }
	   if (document.getElementById("breadcrumb")!=null)
	   {
	    //if(!isIE7win)
	    document.getElementById("breadcrumb").style.zIndex = -1;
	   }
	   if (document.getElementById("main")!=null)
	   {
	    document.getElementById("main").style.zIndex = -1;
	   }
	   if (document.getElementById("footer"))
	   {
	    document.getElementById("footer").style.zIndex = -1;
	   }
	   if (document.getElementById("product-image"))
	   {
	    document.getElementById("product-image").style.zIndex = -1;
	   }
	   
	}
}

/*
 * Place the menu items correctly, loading, scrolling, resizing
 * the window
 */
function positionne() {
var largeur_fenetre = 0; 
var hauteur_fenetre = 0; 
    if (document.body)
    {
	largeur_fenetre = (isIE?document.body.clientWidth:window.innerWidth);
	hauteur_fenetre = (isIE?document.body.clientHeight:window.innerHeight);
	}
	else
	{
	largeur_fenetre = (window.innerWidth);
	hauteur_fenetre = (window.innerHeight);
	}
	if (centrer_menu) {
		if (!vertical) {
			var largeur_totale = espace_entre_menus * (nbmenu-1);
			if (isFinite(largeur_menu))
				largeur_totale += largeur_menu * nbmenu;
			else {
				for (i = 1; i <= nbmenu; i++)
					largeur_totale += largeur_menu[i-1];
			}
			left_menu = (largeur_fenetre - largeur_totale)/2;
		} 
	}
	
	
	//Menus
	var cumul = 0;
//	for(i=1;i<=nbmenu;i++) {
//	    //alert(document.getElementById(para+i));
//		with(document.getElementById(para+i).style) {
//			if (!vertical) {
//			    //alert("TOP = "+top_menu);
//				top=top_menu+"px";
//				//left=(((i-1)*(largeur_menu+espace_entre_menus))+1+left_menu)+"px";
//				left=(((i-1)*espace_entre_menus)+cumul+1+left_menu)+"px";
//				//alert("LEFT = "+left);
//				
//			} 

//			if (!suivre_le_scroll || isIE || isIE5mac)
//				position="absolute";
//			else 
//			position="absolute";
//			//if (vertical) height=hauteur_menu+"px";
//			margin="0";
//			zIndex="99";
//			
//			if (vertical || isFinite(largeur_menu))
//			{
//			    {
//				    width=largeur_menu+"px";
//				}
//			}
//				
//			else
//				width=largeur_menu[i-1]+"px";
//			
//			if ((!vertical && isFinite(largeur_menu)) || (vertical && isFinite(hauteur_menu))) {
//				cumul += (!vertical?largeur_menu:hauteur_menu);
//			}
//			else {
//				cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
//				if (vertical) height=hauteur_menu[i-1]+"px";
//			}

            //zIndex = "";
//		}
//	}
	//alert("Hi2");
	//Sous-menus
	cumul = 0;
	for(i=1;i<=nbmenu;i++) {
		if (document.getElementById(menu+i))//undefined
		{
			with(document.getElementById(menu+i).style) {
				if (!suivre_le_scroll || isIE || isIE5mac)
					position="absolute";
				else 
				position="absolute";
				if (isIE7win)
				{
				 //position="relative";
				}
				
				if (i==1 || i==2 || i==3)
				{
				    // set to the left most side of the page. 
				    left = "2px";
				    if (i==3)
				    {
				        //alert(largeur_sous_menu[i-1]);
				        var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				        if (noOfColumns == 1)
				        {
				            left = "145px";
				        }
				        else if (noOfColumns == 2)
				        {
				            left = "55px";
				        }
				    }
				}
				if (i==4)
				{
				   var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				   if (noOfColumns == 1)
				   {
				    
				    left = "245px";
				   }
				   else if (noOfColumns == 2)
				   {
				    left = "145px";
				   }
				   else
				   {
				    left = "55px";
				   }
				}
				if (i==6 || i==7)
				{
				    // set to the right of the menu bar.
				    //left = "";
				    // This need to be changed since the right side can be changed after uppermost menu bar....
				    
				    if (i==6)
				    {
				       var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				       if (noOfColumns == 1)
				       {
				        right = "137px";
				       }
				       else if (noOfColumns == 2)
				       {
				        right = "65px";
				       }
				       else
				       {
				        right = "45px";
				       }
				    }
				    
				    if (i==7)
				    {
				       var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				       if (noOfColumns == 1)
				       {
				        right = "20px";
				       }
				       else if (noOfColumns == 2)
				       {
				        right = "20px";
				       }
				       else
				       {
				        right = "20px";
				       }
				    }
				}
				
				if(i==5)
				{
				       var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				       if (noOfColumns == 1)
				       {
				        right = "315px";
				       }
				       else if (noOfColumns == 2)
				       {
				        right = "125px";
				       }
				       else
				       {
				        left = "55px";
				       }
				    
				}
				
				if (!vertical) {
					top=top_ssmenu+"px";
					//left=(((i-1)*(largeur_menu+espace_entre_menus))+1+left_menu)+"px";
				} 

				if (isIE || isOpera || isIE5mac || !largeur_auto_ssmenu) {
					if (isFinite(largeur_sous_menu))
					{
						width = largeur_sous_menu+(largeur_sous_menu!="auto"?"px":"");
				    }
					else
					{
						width = largeur_sous_menu[i-1]+(largeur_sous_menu[i-1]!="auto"?"px":"");
				    }
				}
				else
				 width = "auto";
				if (!vertical && !isIE5mac) {
					//repositioning if overflows right
					if ((width != "auto")
						&& ((left.replace(reg,'').valueOf()*1 + width.replace(reg,'').valueOf()*1) > largeur_fenetre))
						{
						//left = (largeur_fenetre-width.replace(reg,'').valueOf())+"px";
						}
				}
				
				margin="0";
				zIndex="100";
				
				if (isIE7win || isIE8win)
				{
				 zIndex="3000";
				}
				
			}
		}

		if ((!vertical && isFinite(largeur_menu)) || (vertical && isFinite(hauteur_menu))) {
			cumul += (!vertical?largeur_menu:hauteur_menu);
		}
		else {
			cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
		}
	}
	
	cumul = 0;
	    for(i=1;i<=nbmenu;i++) 
		{
		    //alert(whiteline);
		    if (document.getElementById(whiteline+i))//undefined
		    {
		        //alert(document.getElementById(whiteline+i) + "          "+i);
		        with(document.getElementById(whiteline+i).style) {
				if (!suivre_le_scroll || isIE || isIE5mac)
					position="absolute";
				else 
				position="absolute";
				
				backgroundColor = "#A2C3DF";
				
				height="7px";
				if (i==1 || i==2 || i==3)
				{
				    // set to the left most side of the page. 
				    left = "2px";
				    if (i==3)
				    {
				        //alert(largeur_sous_menu[i-1]);
				        var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				        if (noOfColumns == 1)
				        {
				            left = "115px";
				        }
				        else if (noOfColumns == 2)
				        {
				            left = "55px";
				        }
				    }
				}
				if (i==4 )
				{
				   var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				   if (noOfColumns == 1)
				   {
				    
				    left = "245px";
				   }
				   else if (noOfColumns == 2)
				   {
				    left = "145px";
				   }
				   else
				   {
				    left = "55px";
				   }
				}
				if (i==6 || i==7)
				{
				    // set to the right of the menu bar.
				    //left = "";
				    // This need to be changed since the right side can be changed after uppermost menu bar....
				    if (i==6)
				    {
				       var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				       if (noOfColumns == 1)
				       {
				        right = "137px";
				       }
				       else if (noOfColumns == 2)
				       {
				        right = "65px";
				       }
				       else
				       {
				        right = "45px";
				       }
				    }
				    
				    if (i==7)
				    {
				       var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				       if (noOfColumns == 1)
				       {
				        right = "20px";
				       }
				       else if (noOfColumns == 2)
				       {
				        right = "20px";
				       }
				       else
				       {
				        right = "20px";
				       }
				    }
				}
				if (i==5)
				{
				    var noOfColumns = largeur_sous_menu[i-1] / 220 ;
				       if (noOfColumns == 1)
				       {
				        right = "315px";
				       }
				       else if (noOfColumns == 2)
				       {
				        right = "125px";
				       }
				       else
				       {
				        left = "55px";
				       }
				}
				
				if (!vertical) {
					top="34px";
					//left=(((i-1)*(largeur_menu+espace_entre_menus))+1+left_menu)+"px";
				} 

				if (isIE || isOpera || isIE5mac || !largeur_auto_ssmenu) {
					if (isFinite(largeur_sous_menu))
					{
						width = largeur_sous_menu+(largeur_sous_menu!="auto"?"px":"");
				    }
					else
					{
					    var index = parseInt(largeur_sous_menu[i-1]);// = largeur_sous_menu[i-1;
					    largeur_sous_menu[i-1] = index + 14;
					
					
						width = largeur_sous_menu[i-1]+(largeur_sous_menu[i-1]!="auto"?"px":"");
						
				    }
				}
				else
				 width = "auto";
				if (!vertical && !isIE5mac) {
					//repositioning if overflows right

					if ((width != "auto")
						&& ((left.replace(reg,'').valueOf()*1 + width.replace(reg,'').valueOf()*1) > largeur_fenetre))
						{
						//left = (largeur_fenetre-width.replace(reg,'').valueOf())+"px";
						}
				}
				margin="0";
				//zIndex="98";
				
				
				//if (i==1)
				zIndex = "0";
				
				
			}
		    }
		    if ((!vertical && isFinite(largeur_menu)) || (vertical && isFinite(hauteur_menu))) {
			cumul += (!vertical?largeur_menu:hauteur_menu);
		    }
		    else {
			    cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
		    }
    		
		}
		
		
		
		
		cumul = 0;
	    for(i=1;i<=nbmenu;i++) 
		{
		    if (document.getElementById(blueExtendArea+i))//undefined
		    {
		        
		        with(document.getElementById(blueExtendArea+i).style) {
				if (!suivre_le_scroll || isIE || isIE5mac)
					position="absolute";
				else 
				position="absolute";
				
				backgroundColor = "#081158";
				border = "1px solid #A2C3DF";
				borderStyle = "none solid none solid";
				height="10px";
				
				if (i==1)
				{
				    borderStyle = "none solid none none";
				    left = "2px";
				    width = "87px";
				}
				else if (i == 2)
				{
                    left = "89px";
				    width = "87px";
				}
				else if (i == 3)
				{
                    left = "177px";
				    width = "109px";
				}
				else if (i == 4)
				{
                    left = "287px";
				    width = "165px";
				}
				else if (i == 5)
				{
                    left = "453px";
				    width = "174px";
				}
				else if (i == 6)
				{
                    left = "628px";
				    width = "208px";
				}
				else if (i == 7)
				{
				    borderStyle = "none none none solid";
				    backgroundColor = "#000000";
                    left = "837px";
				    width = "128px";
				}
				
				if (!vertical) {
					top="29px";
				} 

				margin="0";
				zIndex = "4";
				
			}
		    }
		    if ((!vertical && isFinite(largeur_menu)) || (vertical && isFinite(hauteur_menu))) {
			cumul += (!vertical?largeur_menu:hauteur_menu);
		    }
		    else {
			    cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
		    }
    		
		}
}

function ShowMenuNew(strMenu, strLine) {
	if(blnOk) {
		CancelHide();
		HideMenus();
		if (document.getElementById(strMenu))//undefined
			with (document.getElementById(strMenu).style)
			{
                display="block";
				visibility="visible";
				}
				
	    if (document.getElementById(strLine))//undefined
	    with (document.getElementById(strLine).style)
	    {
		    visibility="visible";
		}
		    
		if (document.getElementById(blueExtendArea+"1"))//undefined
	    with (document.getElementById(blueExtendArea+"1").style)
	    {
		    visibility="visible";
		}
		
	}
	SelectVisible("hidden",document.getElementsByTagName('select'));
	
	//alert(document.getElementById('ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_CornerImg1'));
	
}

function ShowMenu(strMenu, strLine, strBlueArea) {
	if(blnOk) {
		CancelHide();
		HideMenus();
		if (document.getElementById(strMenu))//undefined
			with (document.getElementById(strMenu).style)
			{
                display="block";
				visibility="visible";
				}
				
				
	    if (document.getElementById(strLine))//undefined
	    with (document.getElementById(strLine).style)
	    {
	        //alert(strLine);
	        visibility="visible";
		}
		    
		if (document.getElementById(strBlueArea))//undefined
	    with (document.getElementById(strBlueArea).style)
	    {
		    visibility="visible";
		}
		
	}
	SelectVisible("hidden",document.getElementsByTagName('select'));
	
	//alert(document.getElementById('ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_CornerImg1'));
	
}


function Test(param){
}

function HideDelay() {
	if (blnOk) {
		timeout = setTimeout('HideMenus()',delai);
	}
}

function CancelHide() {
	if (blnOk && timeout) {
	    
		clearTimeout(timeout);
		//alert(blnOk +"  "+ timeout);
	}
}
function HideMenus() {
    if (typeof menu!="undefined")
    {
        if(blnOk) {
		    for(i=1;i<=nbmenu;i++) {
			    if (document.getElementById(menu+i))//undefined
				    with(document.getElementById(menu+i).style)
					    visibility="hidden";
		    }
		    
		    for(i=1;i<=nbmenu;i++) {
			    if (document.getElementById(whiteline+i))//undefined
				    with(document.getElementById(whiteline+i).style)
				    {
					    visibility="hidden";
					}
		    }
		    
		    for(i=1;i<=nbmenu;i++) {
			    if (document.getElementById(blueExtendArea+i))//undefined
				    with(document.getElementById(blueExtendArea+i).style)
				    {
					    visibility="hidden";
					}
		    }
		    
	    }
	}
	else
	{
	    if(blnOk) {
		    for(i=1;i<=nbmenu;i++) {
			    if (document.getElementById("ctl00_WHSHeader1_WHSCategoryTabMenu1_ssmenu"+i))//undefined
				    with(document.getElementById("ctl00_WHSHeader1_WHSCategoryTabMenu1_ssmenu"+i).style)
					    visibility="hidden";
		    }
	    }
	}
	
	
	SelectVisible("visible",document.getElementsByTagName('select'));
}

function trimespaces() {
	//Circumvents a bug in IE5 / win ... it does not pick out the css for <li>, so they are fired!
	if(blnOk&&isIE5win) {
		for(i=1;i<=nbmenu;i++) {
			if (document.getElementById(menu+i))//undefined
				with(document.getElementById(menu+i))
					innerHTML = innerHTML.replace(/<LI>|<\/LI>/g,"");
		}
	}
}


function SetMenuWidth(ssmenu1, menu1, hdnValue){
            var menuname ="";
            var paraname ="";
            menuname = ssmenu1.id;
            menuname = menuname.substring(0,menuname.length-1);
            paraname = menu1.id;
            paraname = paraname.substring(0,paraname.length-1);
                
            if (hdnValue)
        	{
		        var menu1 = hdnValue.value;
                var arr = menu1.split(",");
                var largeur_menu = new Array(100,100,100,150,130,200,100);
                largeur_sous_menu = new Array(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6]);
                //var largeur_sous_menu = new Array("400, 400, 400, 480, 400, 250, 200");
                var largeur_auto_ssmenu = false;
                //alert(menuname+"            "+ paraname);
                //Chargement(menuname, paraname);
		    }
}

// This function will hide/make visible the list of drop downs in the page for IE.
// Since IE browsers select tag gets visible infront of the menubar...

function SelectVisible(v,elem) {
    if (blnOk && cacher_les_select && (isIE||isIE5win))
	{
	    for (var i=0;i<elem.length;i++)
		{
            // Need to remove the the search categories after completion of UI because it will be at the top of the menubar..
            // || "ctl00_ctl00_Footer_WHSSearchCategory1_ddlSearchCategories" == elem[i].id for footer search ddl.
		    if ("ctl00_cph_content_twoColumnCustomDIV_WHSEvoucherProductSummary_ddlGiftCardValue" == elem[i].id
		        || "ctl00_ctl00_cph_content_twoColumnCustomDIV_WHSEvoucherProductSummary_ddlGiftCardValue" == elem[i].id
		        
		        )
        	{
		        elem[i].style.visibility=v;
		    }
		    
		}
	}
}


function CornerImageChange(cornerid, TrueOrFalse, isBookPage){
    if (isBookPage == "False")
    {
        //alert(TrueOrFalse);
        if (TrueOrFalse == "1")
        {
            //alert(document.getElementById(cornerid));
            document.getElementById(cornerid).style.background = "url(../../images/buttons/stylesprite.png) -1189px 0px";
            document.getElementById(cornerid).style.borderStyle = "none";
        }
        else
        {
            document.getElementById(cornerid).style.background = "url(../../images/buttons/stylesprite.png) -1076px 0px";
            document.getElementById(cornerid).style.borderStyle = "none";
        }
    }
    else
    {
        document.getElementById(cornerid).style.background = "url(../../images/buttons/stylesprite.png) -1133px 0px";
    }
    //alert(TrueOrFalse);
}

function CornerImageChangeForSelectedTab(cornerid, TrueOrFalse, isBookPage){
        if (TrueOrFalse == "1")
        {
            document.getElementById(cornerid).style.background = "url(../../images/buttons/stylesprite.png) -1189px 0px";
        }
        else
        {
            document.getElementById(cornerid).style.background = "url(../../images/buttons/stylesprite.png) -1133px 0px";
        }
}

function ChangeBackgroundImage(ElementID, OverOrOut){
    //if (isIE6win)
    {
        var url = document.location.href;
        var isBooksPage = url.toLowerCase().indexOf("/books.aspx");
        var iseBooksPage = url.toLowerCase().indexOf("/ebooks.aspx");
        var isMagazinesPage = url.toLowerCase().indexOf("/magazines.aspx");
        var isStationeryPage = url.toLowerCase().indexOf("/stationerycards.aspx");
        var isGiftsPage = url.toLowerCase().indexOf("/giftgamestoys.aspx");
        var isComputingPage = url.toLowerCase().indexOf("/computingelectronics.aspx");
        
        //alert(isBooksPage);
        if (((para+"1") == ElementID))// && isBooksPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3760px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -1463px 0px";
            }
        }
        else if (((para+"2") == ElementID))// && iseBooksPage==-1)
        {
            //alert(ElementID+"   "+OverOrOut);
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3864px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -1568px 0px";
            }
        }
        else if (((para+"3") == ElementID))// && isMagazinesPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3970px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -1676px 0px";
            }
        }
        else if (((para+"4") == ElementID))// && isStationeryPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -4100px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -1805px 0px";
            }
        }
        else if (((para+"5") == ElementID))// && isGiftsPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -4285px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -1990px 0px";
            }
        }
        else if (((para+"6") == ElementID))// && isComputingPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -4479px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -2184px 0px";
            }
        }
    }
}
    
function ChangeAnchorColor(elementid, color){
    if (document.getElementById(elementid))
    {
        var element = document.getElementById(elementid);
        element.style.color = color;
    }
}

function ChangeBackgroundImageForSelectedTab(ElementID, OverOrOut, TextID){
    //if (isIE6win)
    {
        var url = document.location.href;
        var isBooksPage = url.toLowerCase().indexOf("/books.aspx");
        var iseBooksPage = url.toLowerCase().indexOf("/ebooks.aspx");
        var isMagazinesPage = url.toLowerCase().indexOf("/magazines.aspx");
        var isStationeryPage = url.toLowerCase().indexOf("/stationerycards.aspx");
        var isGiftsPage = url.toLowerCase().indexOf("/giftgamestoys.aspx");
        var isComputingPage = url.toLowerCase().indexOf("/computingelectronics.aspx");
        
        //alert(isBooksPage);
        if (OverOrOut == "1")
        {
            if (document.getElementById(TextID))
                document.getElementById(TextID).style.color = "#FFFFFF";
                
            if (((para+"7") == ElementID))
            {
                //alert('here FFFFFF');
                if (document.getElementById(TextID))
                    document.getElementById(TextID).style.color = "#FFFFFF";
            }
        }
        else
        {
            if (document.getElementById(TextID))
                document.getElementById(TextID).style.color = "#1A19A3";
                
            if (((para+"7") == ElementID))
            {
                //alert('here FFFFFF');
                if (document.getElementById(TextID))
                    document.getElementById(TextID).style.color = "#1A19A3";
            }
        }
        
        
        if (((para+"1") == ElementID))// && isBooksPage==-1)
        {
            //alert(OverOrOut );
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3760px 0px";
                if (document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_Corner"))
                {
                 document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_Corner").style.background = "url(../../images/buttons/stylesprite.png) -1190px 0px";
                }
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -2612px 0px";
                if (document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_Corner"))
                {
                 document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_Corner").style.background = "url(../../images/buttons/stylesprite.png) -1133px 0px";
                }
            }
        }
        else if (((para+"2") == ElementID))// && iseBooksPage==-1)
        {
            //alert(ElementID+"   "+OverOrOut);
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3864px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -2715px 0px";
            }
        }
        else if (((para+"3") == ElementID))// && isMagazinesPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3970px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -2822px 0px";
            }
        }
        else if (((para+"4") == ElementID))// && isStationeryPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -4100px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -2952px 0px";
            }
        }
        else if (((para+"5") == ElementID))// && isGiftsPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -4285px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3137px 0px";
            }
        }
        else if (((para+"6") == ElementID))// && isComputingPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -4479px 0px";
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3331px 0px";
            }
        }
        else if (((para+"7") == ElementID))// && isComputingPage==-1)
        {
            if (OverOrOut == "1")
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -2412px 0px";
                if (document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_tabendgadget"))
                {
                 document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_tabendgadget").style.background = "url(../../images/buttons/stylesprite.png) -1020px 0px";
                }
            }
            else
            {
                document.getElementById(ElementID).style.background = "url(../../images/buttons/stylesprite.png) -3559px 0px";
                if (document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_tabendgadget"))
                {
                 document.getElementById("ctl00_ctl00_WHSHeader1_WHSCategoryTabMenu1_tabendgadget").style.background = "url(../../images/buttons/stylesprite.png) -3716px 0px";
                }
            }
        }
    }
}

