function changeStyle(elt, hover)
{
	var flavor = document.getElementsByTagName('body')[0].id ;
	var stdColor = "" ;
	var dgdColor = "" ;
	var optBgImage = "" ;
		
	switch(flavor)
	{
		case "Products":
		{
				stdColor = "#BF8326" ;
				dgdColor = "#ECC489" ;
				break ;
		}
		case "Applications":
		{
				stdColor = "#C8292C" ;
				dgdColor = "#D5717A" ;
				break ;
		}
		case "Download":
		{
				stdColor = "#4475BD" ;
				dgdColor = "#96BBF5" ;
				break ;	
		}
		case "AboutUs":
		{
				stdColor = "#286432" ;
				dgdColor = "#62BD84" ;
				break ;
		}
		case "UserCorner":
		{
				stdColor = "#EC6521" ;
				dgdColor = "#FFC500" ;
				break ;
		}
		
		case "ContactUs":
			{
				stdColor = "#87CF36" ;
				dgdColor = "#C6EB9D" ;
			}
	}
	
	if ((document.nav == null) && (document.all != null))
	{
		if (elt.className == "topmenuopen") 
		{
			elt.style.border = "none" ;
			elt.style.color = stdColor ;
			elt.style.padding = "2px 0 2px 12px" ;
			elt.style.backgroundColor = "transparent" ; // "#FFF" ;
		}
		else
		{
			if (hover == true)
			{
				elt.style.border = "1px solid " + stdColor ;
				elt.style.color = stdColor ;
				elt.style.padding = "1px 0 1px 11px" ;
				elt.style.backgroundColor = dgdColor ;
			}
			else
			{
				if (elt.className != "activePage")
				{
					elt.style.border = "none";
					elt.style.padding = "2px 0 2px 12px" ;
					elt.style.backgroundColor = "transparent" ; // "#FFF" ;
				}
				else
				{
					elt.style.border = "1px solid #555";
					elt.style.padding = "1px 0 1px 11px" ;
					elt.style.backgroundColor = dgdColor ;
					
				}
				elt.style.color = stdColor ;
			}
		}
	}
}

function displayMenu()
{
	
	if (document.getElementsByTagName('body')[0].id == "Home")
	{
		return ;
	}
	
	hideAll() ;
	var menu = document.getElementById('verticalpane') ;
	var h2s = menu.getElementsByTagName('li') ;
	var parentLi = null ;
	
	for(var i = 0 ; i < h2s.length ; i++)
	{
		
		if (h2s[i].className == "activePage")
		{
			if (h2s[i].parentNode.id != "vertivalpane")
			{
				var parentLi = h2s[i].parentNode.parentNode ;
			}
		}
		
		if (h2s[i].className == "topmenu")
		{
			h2s[i].onmouseover = function()
			{
				changeStyle(this, true) ;
			}
			h2s[i].onmouseout = function()
			{
				changeStyle(this, false) ;
			}

			var lists = h2s[i].getElementsByTagName('li') ;
			for(var j = 0 ; j < lists.length ; j++)
			{
				if (document.all != null)
				{
				 	lists[j].attachEvent("onclick",function(ev)
					{
						ev.cancelBubble = true;
					});
				}
				else
				{
					lists[j].addEventListener("click",function(ev)
					{
						document.location.href = this.getElementsByTagName('a')[0].href ;
						ev.stopPropagation();
					},false);
				}		
			}
						
			h2s[i].onclick = function()
			{
				
				var cur_ul = this.getElementsByTagName('ul')[0] ;
				if(cur_ul.style.display != "none")
				{
					hideAll() ;
					this.className = this.className.replace("open", "");
					changeStyle(this, true) ;
				}
				else
				{
					hideAll() ;
					cur_ul.style.display = "" ;
					if(this.className != "topmenuopen")
					{
						this.className += "open" ;
					}
					changeStyle(this, false) ;
				}
			}
		}
		else
		{
			if ((document.nav == null) && (document.all != null))
			{
				h2s[i].onmouseover = function()
				{
					changeStyle(this, true) ;
				}
				h2s[i].onmouseout = function()
				{
					changeStyle(this, false) ;
				}
			}
		}
	}
	if (parentLi != null)
	{
		parentLi.className = "topmenuopen" ;
		var cur_ul = parentLi.getElementsByTagName('ul')[0] ;
		cur_ul.style.display = "" ;
		//changeStyle(h2s[i], false) ;
	}
}

function hideAll()
{
	var menu = document.getElementById('verticalpane') ;
	var uls = menu.getElementsByTagName('ul') ;
	for(var j = 0 ; j < uls.length ; j++ )
	{
		uls[j].style.display = "none" ;
		uls[j].parentNode.className = uls[j].parentNode.className.replace("open", "");
	}
}

// window.onload = displayMenu ;
