// v1.7 Copyright (c) 2006 TJKDesign - Thierry Koblentz
// For help, visit http://www.tjkdesign.com/articles/navigation_links_and_current_location.asp

//modified to support Sliding Doors tabbed menu by adding the option to specify a different class for the LI


function currentLink(zMenu,subMenu,linkClass,listClass){
if(document.getElementById && document.createElement && document.getElementById(zMenu)){
var strLocation = top.location.hostname+top.location.pathname;

	var a = document.getElementById(zMenu).getElementsByTagName("a");
	var li = document.getElementById(zMenu).getElementsByTagName("li");
	
	if(document.getElementById(subMenu)){
		var subAs = document.getElementById(subMenu).getElementsByTagName("a");
		strLocation = top.location.hostname + "/site/go/" + subAs[0].getAttribute("rel");
	}
	
	
	
	if(top.location.pathname == "/"){ 
				for (var x=0,i=a.length;x<i;x++){
					if(a[x].href.indexOf("/sales/go/home") >= 0){
						a[x].className += " "+linkClass;
						li[x].className += " "+listClass;
					}
				}
	}
		
	else{
		for (var x=0,i=a.length;x<i;x++){

				if (a[x].href.indexOf(strLocation,0)>0){
									
						a[x].className += " "+linkClass;
						li[x].className += " "+listClass;
				}

	}
	}
}
}


function callLink(){
	currentLink('siteNav','subNav','currentLink','currentListItem');
}


/************** ADD LOAD EVENT **************/

function addLoadEvent(newFunction) {
    var oldOnload = window.onload;
    
    if (typeof window.onload != 'function')
        window.onload = newFunction;
    else {
        window.onload = function() {
            if (oldOnload)
                oldOnload();
            
            newFunction();
        }
    }
}
