if(window.attachEvent)
    {
        window.attachEvent("onload",  treemenu);        
    }
    else if(window.addEventListener)
    {
        window.addEventListener('load',  treemenu,  false);        
    }

function treemenu()
{

	var url = document.location.href.toString();
	//alert(url);
	url = url.replace("http://","");
	var urls = url.split("/");
	//alert(urls[0]);
	var channel;
	var regExp1 = /%5F%5F%5F/g;
	var regExp2 = /%5F/g;
	var regExp3 = /___/g;
	var regExp6 = /_/g;

	var times = 0;
	
	for(i=0;i<urls.length;i++)
	{
		if(times == 3)
			break;

		channel = urls[i];
		channel = channel.replace(regExp1," & ");
		channel = channel.replace(regExp2," ");
		channel = channel.replace(regExp3," & ");
		channel = channel.replace(regExp6," ");
		channel = decodeURI(channel);
		
		//alert(channel);
		var currentChannel = document.getElementById(channel);
		if(currentChannel != null)
		{
			times ++ ;
			//alert(currentChannel.id);
			
			if(currentChannel.parentNode.parentNode.id == "channelMenu")
			{
			   //alert(currentChannel.parentNode.parentNode.id);
			    currentChannel.firstChild.style.color="#00EAFF";
			}
			else if(currentChannel.parentNode.parentNode.id =="treenav")
			{		   
				 //alert(currentChannel.parentNode.parentNode.id);
				currentChannel.firstChild.style.color="white";	
				
				var childs = currentChannel.getElementsByTagName("UL");
				if(childs.length > 0 && childs[0].style.display == "none")
				{
				    //alert(childs[0].tagName);
					childs[0].style.display = "block";				
				}
			}
			else 
			{				
				currentChannel.firstChild.style.color="#648BB1";
				currentChannel.firstChild.style.fontWeight ="bolder";    								
				if(currentChannel.parentNode.style.display == "none")
				     currentChannel.parentNode.style.display = "block";
			}
		}
	 }
	
	
	
	
	/*if(urls[urls.length - 1] != "")
		channel= urls[urls.length - 1];
	else
		channel= urls[urls.length - 2];
	//alert(channel);
	
	channel = channel.replace("%5F"," ");
	channel = channel.replace("_"," ");
	//alert(channel);
	var currentChannel = document.getElementById(channel);
	
	if(currentChannel != null){
	    //alert(currentChannel.id);
	    if (currentChannel.tagName.toUpperCase() == "UL"){
		   if(currentChannel.style.display == "none") 		   
				currentChannel.style.display = "block";
	    }
	    else if(currentChannel.tagName.toUpperCase() == "LI"){

		    //currentChannel.style.color="red";
			currentChannel.firstChild.style.color="#2D5586";
			//currentChannel.firstChild.style.fontWeight="bold";
		    if(currentChannel.parentNode.style.display == "none")
				currentChannel.parentNode.style.display = "block";
			//if(currentChannel.parentNode.style.visibility="hidden")
			//	currentChannel.parentNode.style.visibility = "visible";
	    }
	}
	*/
	
	//alert(currentChannel.tagName);

}


function display(oid){
    //alert(oid); 
    if(oid != null){
    //alert(oid);   
		
        var oWorkItem=event.srcElement; 
        var aReturn=oWorkItem.parentNode.parentNode.parentNode.getElementsByTagName("UL");
        //alert(aReturn.length);
        
        for(i=0;i<aReturn.length;i++){
            
            var uu = aReturn[i];
            //alert(uu.uniqueID);
            if(uu.style.display == "block" && uu.id != oid)
                uu.style.display = "none";
        }
        
        var o = document.getElementById(oid);
        if(o.style.display == "none")
			o.style.display = "block";
    }
}