/**
 * leftnav 
 */
 
 
 
//hides all the UL elements within the container irrespective of its id
function ulCollapseAll(incontainer){
		if (document.getElementById(incontainer) != null ) {
			var allsubul = document.getElementById(incontainer).getElementsByTagName("UL");
			for(var i=0; i < allsubul.length ; i++)	{
				allsubul[i].style.display="none";                     
				}
			}
		}
 
 
function openUpMenu(containerId,menuToOpen){
	 //collapse all the menu links
	 ulCollapseAll(containerId);
	 
	 //open up the menu upto the specified level
	 if (document.getElementById(containerId) != null ) {	 
	 	var allSubMenues = document.getElementById(containerId).getElementsByTagName("UL");
		var node = document.getElementById(containerId);
		digin(node, menuToOpen,containerId);
	 }
	 
	 //highlight the current page link
	 highlightCurrentPageLink();
}//functcion openUpMenu()
 
 
 
flag="notyetfound";
function digin(node, diggingfor, topMenuId){
     if (!document.getElementById || !document.getElementsByTagName) {
         return false;
     }
 
    if (node.nodeName == "UL") {
        if (node.id == diggingfor) {
               flag = "found";
              node.style.display = "block";                                              
              (node.parentNode).childNodes[0].className = "selected";  
            
                          
                grandparent=(node.parentNode).parentNode;
                while( grandparent.id != topMenuId ){
                    grandparent.style.display ="block";                                               
                    (grandparent.parentNode).childNodes[0].className="selected";       
                    grandparent=(grandparent.parentNode).parentNode;                   
                }
                               
                               //for top most menu settings
                               grandparent.style.display ="block";                                               
                (grandparent.parentNode).childNodes[0].className="selected";       
                               
        }
    }                     
 
    if (node.hasChildNodes()) {
        for (var i = 0; i < node.childNodes.length; i++) {
            if(flag=="found"){
                break;
            }
            digin(node.childNodes[i], diggingfor, topMenuId);
        }
    }
 
}//function digin         
    
 
//highlights the current page link in the menu
function highlightCurrentPageLink(){
        var currentPage = "";
        var currentSection = "";
        var path = window.location.pathname;           
        var path_array = path.split("/");                      
        
        if (path_array.length > 1) {
            var currentPage = path_array[path_array.length - 1];        
            var currentSection = path_array[path_array.length - 2];    
        }
        
        var page = "";
        var section= "";
        var links = document.getElementById("leftnav").getElementsByTagName("a");            
        
        for (i = 0; i < links.length; i++) {                                                            
                    var link = links[i].getAttribute('href');                                          
                    if (link) {                                                                                                          
                            var link_array = link.split("/");                                                    
                            if (link_array.length>1) {                                     
                                var page = link_array[link_array.length-1];                      
                                var section = link_array[link_array.length-2];                   
                            }
                    }
                
                	//alert("CPage: "+currentPage+" CSection:"+currentSection+ " UPage: "+page+" USection: "+section);
                
                  if ( (section == currentSection) && (page == currentPage) ){        
                      links[i].className="current";                                                   
                      break;
                  }  
        }
}//function 
 
               //window.onload = function()
               //{
 
               //var currentURL = window.location.pathname;
               //var currentURL = window.location.href;
               //var URLpart = currentURL.split("/");        
 
               //openUpMenu(URLpart[3],URLpart[URLpart.length-2]);
               //openUpMenu(URLpart[3],"economic");
 
               //}
               
               
               
 
               var currentURL = window.location.pathname;
               var currentURL = window.location.href;
               var URLpart = currentURL.split("/");
			   var URLFolderFull = currentURL.split(".com/");
               var URLFolderRight = URLFolderFull[1];
			   
				/*alert("currentURL: "+currentURL)
				alert("URLpart: "+URLpart)
				alert("URLpart length: "+URLpart.length)			   
				alert("URLFolderFull: "+URLFolderFull)
				alert("URLFolderRight: "+URLFolderRight)		
			   
				alert("URLpart[4]: "+URLpart[4])
				
				alert(URLpart[URLpart.length - 1])
				alert(URLpart[URLpart.length - 2])		*/		
				
				
			   
				if (URLpart[URLpart.length - 1] == "archive-reports-Index.shtml" || URLpart[URLpart.length - 1] == "PDF-Index.shtml" || URLpart[URLpart.length - 2] == "case-studies-a-z" || URLpart[URLpart.length - 2] == "download-pdf-report" || URLpart[URLpart.length - 2] == "archive-reports") 
					{
					window.onload = function()
						{ 
						openUpMenu(URLpart[3],URLpart[URLpart.length-3]);
						}
					} 
				else
					{
					if (URLpart[URLpart.length - 1] == "our-journey.shtml" )
						{
						window.onload = function()
							{ 
							openUpMenu(URLpart[3],URLpart[URLpart.length-2]); 
							onLoad(); 
							}              
						} 
					else 
						{
						if (URLpart[4] == "index.shtml" || URLFolderRight == "products-services/terms-conditions.shtml" || URLFolderRight == "products-services/privacy.shtml" || URLFolderRight == "products-services/accessibility.shtml" || URLFolderRight == "products-services/copyright.shtml" || URLFolderRight == "about-us/our-vision.shtml" || URLFolderRight == "careers/launch-your-career.shtml" || URLFolderRight == "careers/diversity-inclusion.shtml" || URLFolderRight == "careers/environmental-community-support.shtml" || URLFolderRight == "media-centre/contacts-cross-business/index.shtml" || URLFolderRight == "media-centre/press-kit/index.shtml" || URLFolderRight == "media-centre/press-news/index.shtml" || URLFolderRight == "media-centre/image-library/index.shtml" || URLFolderRight == "media-centre/media-awards/index.shtml" || URLFolderRight == "careers/customer-branch.shtml" || URLFolderRight == "careers/networks-branch.shtml" || URLFolderRight == "careers/energy-branch.shtml" || URLFolderRight == "careers/corporate-branch.shtml" || URLFolderRight == "products-services/site-map.shtml" || URLFolderRight == "products-services/fuel-mix.shtml" || URLpart[4] == "press-news" || URLpart[4] == "education") 
							{
							// nothing
							} 
						else 
							{
							window.onload = function(){ openUpMenu(URLpart[3],URLpart[URLpart.length-2]); 
							}	
						}
					}
				}
               
               
               
 
 

