function TopNavRollover (ImgId) {
	var ThisImg = null;
	
	if (document.getElementById) {
		ThisImg = document.getElementById(ImgId);
	}
	else if (document.all) {
		ThisImg = document.all[ImgId];
	}
	else {
		ThisImg = document.images[ImgId];
	}
	
	if (ThisImg != null) {
		if (ThisImg.src.indexOf ("03.gif") > -1) {
			return true;
		}
		if (ThisImg.src.indexOf ("02.gif") > -1) {
			ThisImg.src = ThisImg.src.replace (/02\.gif/, "01.gif");
		}
		else if (ThisImg.src.indexOf ("02.gif") < 0) {
			ThisImg.src = ThisImg.src.replace (/01\.gif/, "02.gif");
		}
	}
	return true;
}


var LastShownSubMenu = null;
var LastShownMenu = null;

function GetObjectRef (ObjId) {
	if (document.getElementById) {
		return document.getElementById (ObjId);
	}
	else if (document.all) {
		return document.all[ObjId];
	}
	else {
		return null;
	}
}
function GetParentObjectRef (ObjId) {
	return GetObjectRef (ObjId.substring (3, ObjId.length));
}
function ShowSubMenu (thisObj, e) {
	var SubMenuObj = GetObjectRef ("Sub" + thisObj.id.replace (/^Sub(.*)/, "$1"));
	
	var MenuObjId = thisObj.id.replace (/^Sub(.*)/, "$1");
	MenuObjId = MenuObjId.replace (/^TopMenu(.*)/, "TopNav$1");
	var MenuObj = GetObjectRef (MenuObjId);
	
	if (SubMenuObj == null) {
		return true;
	}

	if (LastShownSubMenu != null && LastShownSubMenu != SubMenuObj) {
		LastShownSubMenu.style.display = "none";
		LastShownSubMenu = null;
		LastShownMenu.className = "InactiveLeftNav";
	}
	if (LastShownMenu != null) {
		LastShownMenu.src = LastShownMenu.src.replace (/02\.gif/, "01.gif");
	}
	LastShownSubMenu = SubMenuObj;
	LastShownMenu = MenuObj;

	SubMenuObj.style.display = "block";
	MenuObj.className = "ActiveLeftNav";
	
	if (MenuObj.src.indexOf ("01.gif") > -1) {
		MenuObj.src = MenuObj.src.replace (/01\.gif/, "02.gif");
		LastShownMenu = MenuObj;
	}
	
	e.cancelBubble = true;
}
function KillSubMenu () {
	if (LastShownSubMenu != null) {
		LastShownSubMenu.style.display = "none";
		LastShownSubMenu = null;
	}
	if (LastShownMenu != null) {
		LastShownMenu.src = LastShownMenu.src.replace (/02\.gif/, "01.gif");
	}
}
function MenuScriptInit () {
	if (document.getElementById || document.all) {
		if (document.captureEvents) {
			document.captureEvents(Event.MOUSEOVER); 
		}
		document.onmouseover = KillSubMenu;
	}
}




/*
	This version only supports one level of sub nav.
	
	To use this script, code your HTML like normal. 
	Remember to make the sub menu an absolutely positioned layer.
	The display attribute of the sub menu's style should be set to "none".

	The whole roll over process involves 2 objetcs:
	
	1) 	The trigger object: it may be the <a> tag or the <td> that contains the nav trigger.
		When an action is applied to this object (ex, mouseover), the sub nav will be triggered
		and shown.
		
	2)	The subnav object: this can be any absolute positioned layer. The inital state of the
		layer is usually hidden.
		
		
	Instruction:
		1)	Add an id to the trigger object, and name it like this: "TopMenu????"
		2)	Add an onmouseover="ShowSubMenu (this, event);" to the trigger object
		3)	Add an id to the <img> tag that is enclosed by the trigger object, and 
			name it like this: "TopNav???"
		4)	Add an id to the subnav object, and name it like this: "SubTopMenu???"
			Ex, if you have a trigger object "TopMenuAbc", its subnav object
				should be called "SubTopMenuAbc", and its image object will be
				"TopNavAbc".
		5)	Add an onmouseover="ShowSubMenu (this, event);" to the subnav object
			YES, the mouseover is the same as (2)
		6)	Add a <script> tag to the header and set the src attribute to this js file
		7)	Add a onload handler to the <body> tag if there isn't one already
		8)	In the body tag's onload handler, call MenuScriptInit ();



*/


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHideLayers() { //v6.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}
