var imagedir = "/NR/DU_Shared/Images/";
var currentOverName,currentOver,bodyLeft,bodyTop,highlit,activeToolMenu,hotLink,fromLeft,applied;
var tabs=new Array();
var appname=navigator.appName.toLowerCase();
var version=navigator.appVersion.toLowerCase();
var ua=navigator.userAgent.toLowerCase();
var n4=appname=="netscape"&&document.layers?1:0;
var n6=appname=="netscape"&&(parseInt(version) >= 5)?1:0;
var ie=appname=="microsoft internet explorer"?1:0;
var ie5=(version.indexOf('msie 5')>0);
var ie6=(version.indexOf('msie 6')>0);
var ie5_1=(ua.indexOf('msie 5.1')>0);
var platform = "other";
if (ua.indexOf("win")>-1) platform = "win";
else if (ua.indexOf("mac")>-1) platform = "mac";
function init(){		
	
	thisTools=document.getElementById("toolbar").getElementsByTagName("a");
	for(i=0;i<thisTools.length;i++){
		thisTools[i].onmouseover=activateToolMenu;
	}

	document.body.id="topBody";
	
	bodyTop=((document.all)?(document.getElementById("body").offsetTop-1):-1);
	if(platform=="mac"&&ie5)bodyTop+=5;
	highlit=document.getElementById("highlight");
}

function activateToolMenu(){
	which=this.name;
	toolmenu=document.getElementById("menu"+which);
	highlightMe(this);
	if(toolmenu){
		if(ie){
			toolmenu.style.width="200px";
		}
		fromLeft=findXPosition(this)-5;
		toolmenu.style.left=fromLeft+"px";
		toolmenu.style.visibility="visible";
		setTimeout("clearToolMenu('"+toolmenu.id+"')",10);
	}else if(activeToolMenu){
		toolmenu=document.getElementById(activeToolMenu);
		toolmenu.style.visibility="hidden";
	}
}
function clearHighlight(){
	if((currentOver=="mainNav")||(currentOver=="body"))highlit.style.visibility="hidden";
	else setTimeout("clearHighlight()",100);
}
function clearToolMenu(who){
        if((currentOverName!=who)&&(who!="menu"+currentOverName)){
                toolmenu=document.getElementById(who);
                toolmenu.style.visibility="hidden";
       		if((currentOver!=who)||(activeToolMenu!=who))highlit.style.visibility="hidden";
        }else setTimeout("clearToolMenu('"+who+"')",100);
}

function getBodyLeft(){
	bodyLeft=((ie)?(document.getElementById("body").offsetLeft+document.getElementById("toolbar").offsetLeft+32):0);
	return bodyLeft;
}

function highlightMe(who){
	fromLeft=findXPosition(who);
	fromTop=findYPosition(who);
	highlit.style.width=(who.offsetWidth)+"px";
	highlit.style.height=who.offsetHeight+"px";
	highlit.style.left=(fromLeft-5)+"px";
	highlit.style.top=(fromTop)+"px";
	highlit.style.visibility='visible';
	setTimeout("clearHighlight()",10);
	hotLink=who.href;
	highlit.onclick=function(){location.href=hotLink}
}

function findYPosition(thisObject){
	if(thisObject.offsetParent){
		return (thisObject.offsetTop + findYPosition(thisObject.offsetParent));
	} else { 
		return thisObject.offsetTop;
	}
}

function findXPosition(thisObject){
	if(thisObject.offsetParent != null){
		return (thisObject.offsetLeft + findXPosition(thisObject.offsetParent));
	} else { 
		return thisObject.offsetLeft;
	}
}

document.onmouseover=function(e){
        if(ie)target=window.event.srcElement;
        else target=e.target;
        if(target.id){
				currentOver=target.id;
				currentOverName=target.name;
        } else {
                t=target;
                currentOver="";
                while(t.parentNode){
                        if(t.parentNode.id){
                                currentOver=t.parentNode.id;
                                currentOverName=t.parentNode.name;
                                break;
                        }else t=t.parentNode;
                }
        }
}
