
var poc;
if ((mainCat == 1) && (subCat == 1)) { var poc = true }
else { var poc = false }


var activNav = false

var activSub;

var timerm = null;

var stayFolded=false;

var n = (document.layers) ? 1:0;

var ie = (document.all) ? 1:0;

var n6 = (document.getElementById && !document.all) ? 1:0;

var browser=((n || ie || n6) && parseInt(navigator.appVersion)>=4); 

var activVar;

// these 2 prev and next arrays set the order of the menu items on the left.
// they must start with 1 though.
// right now the order is:
// 1, 8, 2, 3, 4, 5, 6, 7, 14, 9, 10, 11, 12, 13
// to change the order simple change the values of the arrays

var prev;
var next;
prev=new Array();
next=new Array();
prev[1] = 0;
prev[2] = 8;
prev[3] = 2;
prev[4] = 3;
prev[5] = 4;
prev[6] = 5;
prev[7] = 6;
prev[8] = 1;
prev[9] = 14;
prev[10] = 9;
prev[11] = 10;
prev[12] = 15;
prev[13] = 12;
prev[14] = 7;
prev[15] = 11;

next[1] = 8;
next[2] = 3;
next[3] = 4;
next[4] = 5;
next[5] = 6;
next[6] = 7;
next[7] = 14;
next[8] = 2;
next[9] = 10;
next[10] = 11;
next[11] = 15;
next[12] = 13;
next[13] = -1; //mark the last one as -1
next[14] = 9;
next[15] = 12;


// netscape resize fix
if (document.layers) 
	{
		widthCheck = window.innerWidth
		heightCheck = window.innerHeight
		window.onResize = resizeFix
	}
function resizeFix()
	{
		if (widthCheck != window.innerWidth || heightCheck != window.innerHeight)
		document.location.href = document.location.href
	}


function makeMenu(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'	
	
	if (n) {
		this.css = eval(nest+'document.'+obj)
		this.ref = eval(nest+'document.'+obj+'.document')
		this.height = this.ref.height
		this.x = this.css.left
		this.y = this.css.top
	}
	
	if (ie) {
		this.css = eval('document.all.'+obj+'.style')
		this.ref = eval('document');
		this.height = eval(obj+'.offsetHeight')
		this.x = this.css.pixelLeft;
		this.y = this.css.pixelTop;
	}
	
	if (n6) {
		this.css = document.getElementById(obj).style
		this.ref = document.getElementById(obj)
		this.height = parseInt(this.ref.offsetHeight)
		this.x = parseInt(this.ref.offsetLeft)
		this.y = parseInt(this.ref.offsetTop)
	}

	this.hideIt=b_hideIt;
	this.showIt=b_showIt;
	this.vis=b_vis;
	this.moveIt=b_moveIt
	this.zindex=b_zindex;
	
	return this
}

function b_showIt(){this.css.visibility="visible"}

function b_hideIt(){this.css.visibility="hidden"}

function b_zindex(znum){this.css.zIndex=znum}

function b_vis(){if(this.css.visibility=="hidden" || this.css.visibility=="hide") return true;}

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}

// function added to put the move logic on one place in case we ever have to 
// add stuf to the menu again, it can be done here.
//millum 11-24-2003
//function function_move(i, sub){
//	// pass 0 if you don't want the sub added in
//	if (i==8){
//		oTop[8].moveIt(0,oTop[14].y+oTop[14].height+(sub*(oSub[14].height-10)));
//	}
//	// if we are on 7 do 14 also, as it should be right after 7
//	else if (i == 7){
//		oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height+(sub*(oSub[i-1].height-10))); 
//		oTop[14].moveIt(0,oTop[7].y+oTop[7].height+(sub*(oSub[7].height-10)));
//	}
//	else if (i != 14){
//		oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height+(sub*(oSub[i-1].height-10))); 
//	}
//
//}


function function_move(i, sub){
	// pass 0 if you don't want the sub added in
	
	//don't need to mess with #1
	if (i > 1) {
		oTop[i].moveIt(0,oTop[prev[i]].y+oTop[prev[i]].height+(sub*(oSub[prev[i]].height-10)));
	}
}

function init(){

	oTop=new Array()
	
	oTop[1]=new makeMenu('divTop1','divCont');
	oTop[2]=new makeMenu('divTop2','divCont');//('divTop2','divCont');
	oTop[3]=new makeMenu('divTop3','divCont');
	oTop[4]=new makeMenu('divTop4','divCont');
	oTop[5]=new makeMenu('divTop5','divCont');
	oTop[6]=new makeMenu('divTop6','divCont');
	oTop[7]=new makeMenu('divTop7','divCont');
	oTop[8]=new makeMenu('divTop8','divCont');
	oTop[9]=new makeMenu('divTop9','divCont');
	oTop[10]=new makeMenu('divTop10','divCont');
	oTop[11]=new makeMenu('divTop11','divCont');
	oTop[12]=new makeMenu('divTop12','divCont');
	oTop[13]=new makeMenu('divTop13','divCont');
	oTop[14]=new makeMenu('divTop14','divCont');
	oTop[15]=new makeMenu('divTop15','divCont');

	oSub=new Array()

	oSub[1]=new makeMenu('divSub1','divCont.document.divTop1');
	oSub[2]=new makeMenu('divSub2','divCont.document.divTop2');
	oSub[3]=new makeMenu('divSub3','divCont.document.divTop3');
	oSub[4]=new makeMenu('divSub4','divCont.document.divTop4');
	oSub[5]=new makeMenu('divSub5','divCont.document.divTop5');
	oSub[6]=new makeMenu('divSub6','divCont.document.divTop6');
	oSub[7]=new makeMenu('divSub7','divCont.document.divTop7');
	oSub[8]=new makeMenu('divSub8','divCont.document.divTop8');
	oSub[9]=new makeMenu('divSub9','divCont.document.divTop9');
	oSub[10]=new makeMenu('divSub10','divCont.document.divTop10');
	oSub[11]=new makeMenu('divSub11','divCont.document.divTop11');
	oSub[12]=new makeMenu('divSub12','divCont.document.divTop12');
	oSub[13]=new makeMenu('divSub13','divCont.document.divTop13');
	oSub[14]=new makeMenu('divSub14','divCont.document.divTop14');
	oSub[15]=new makeMenu('divSub15','divCont.document.divTop15');
	
	for(i=1;i<oSub.length;i++){ oSub[i].hideIt() }

	//now because they are out of numeric order we can't just go from 2 to max
	//for(i=2;i<oTop.length;i++){ 
	//	function_move(i,0);
	//}
	
	i = 1; // starts at 1
	while (i > -1){
		function_move(i,0);
		i = next[i];
	}
	
	
	if ((mainCat == 2) || (mainCat ==4) || (mainCat == 8)) { activNav=true; menuDo(mainCat);}
	


if (mainCat == 12) // check mainCat 12
{
if ((subCat > 0) && (subCat < 5)) { 
activNav=true;
//



	if (n)
		{
		mainCat=2;
menuDo(2);
		img = eval('document.divCont.document.divTop2.document.divSub2.document.Sub2Content.document.images["x12'+subCat+subbCat+'"]');
		img.src = "images_menu/12"+subCat+subbCat+"_on.gif";
		subCat=0;
		}
	if (ie || n6)
		{
		mainCat=2;
		activVar = true
menuDo(2);

		imgz = "x12" + subCat + subbCat  // a letter must be part of the name of the image for this to work in IE -- it can not be only numbers
		img = eval('document.images[imgz]');
		img.src = "images_menu/12"+subCat+subbCat+"_on.gif";
		
		}

}
else
{
	if (n)
		{
		img = eval('document.divCont.document.divTop'+mainCat+'.document.images["x'+mainCat+subCat+subbCat+'"]');
		img.src = "images_menu/"+mainCat+subCat+"0_on.gif";
		}
	if (ie || n6)
		{
		imgz = "x" + mainCat + subCat + "0"  // a letter must be part of the name of the image for this to work in IE -- it can not be only numbers
		img = eval('document.images[imgz]');
		img.src = "images_menu/"+mainCat+subCat+"0_on.gif";
		}

}

}
	
if (mainCat < 11)
{
	// this highlights the menu items based on the mainCat and subCat variables
	if (n) 
	{	
		//mainCat
		if ((mainCat == 2) || (mainCat ==4) || (mainCat == 8))
		{
		img = eval('document.divCont.document.divTop'+mainCat+'.document.divSub'+mainCat+'.document.images["bckgr'+mainCat+'"]');
		img.src = "images_menu/space.gif";
		}
		if (poc)  // special call for section 1.1.0 Public Offering Center // not a mainCat BUT Located in the mainCat space
		{
		img = eval('document.divCont.document.divTop3.document.images["x'+mainCat+'10"]');
		img.src = "images_menu/"+mainCat+"10_on.gif";
		}
		//else if (mainCat == 0){
		//img = eval('document.divCont.document.divTop1.document.images["x100"]');
		//img.src = "images_menu/100_off.gif";		
		//}
		//else 
		else if (mainCat > 0)
		{
		img = eval('document.divCont.document.divTop'+mainCat+'.document.images["x'+mainCat+'00"]');
		img.src = "images_menu/"+mainCat+"00_on.gif";
		}

		//subCat
		if ((subCat!=0) && (!poc) && (activNav) )
		{
		img = eval('document.divCont.document.divTop'+mainCat+'.document.divSub'+mainCat+'.document.Sub'+mainCat+'Content.document.images["x'+mainCat+subCat+subbCat+'"]');
		img.src = "images_menu/"+mainCat+subCat+subbCat+"_on.gif";
		}
	}
	
	
    if (ie || n6)
	{	
		//mainCat
		if ((mainCat == 2) || (mainCat ==4) || (mainCat == 8))
		{
		bimg = "bckgr"+mainCat
		img = eval('document.images[bimg]')
		img.src = "images_menu/space.gif";
		}
		
		if (poc)   // special call for section 1.1.0 Public Offering Center // not a mainCat BUT Located in the mainCat space
		{
		img = eval('document.images["x110"]');
		img.src = "images_menu/"+mainCat+"10_on.gif";
		}
		//else{
		else if (mainCat > 0){
		imgz = "x" + mainCat +"00"  // a letter must be part of the name of the image for this to work in IE -- it can not be only numbers
		img = eval('document.images[imgz]');
		img.src = "images_menu/"+mainCat+"00_on.gif";
		}

		//subCat
		if ((!poc) && (activNav))
		{
		if (!activVar) {
		imgz = 'x' + mainCat + subCat + subbCat	// a letter must be part of the name of the image for this to work in IE -- it can not be only numbers
		img = eval('document.images[imgz]');
		img.src = "images_menu/"+mainCat+subCat+subbCat+"_on.gif";
		}
		}
	}
}


//topp nav selected

if (mainCat > 12)
{
document.images["x"+mainCat].src = "images_menu/"+mainCat+"_on.gif"
}


	// hide the menu till it loads then show it
	if (n) document.layers["divCont"].visibility = "show"
	else if (ie) document.all["divCont"].style.visibility = "visible"
	else if (n6) document.getElementById("divCont").style.visibility = "visible"

}

// this function delays the mouseover for a split second before expanding
function menu(isIt,num,sta) 
{
	if (mainCat != num)
	{
		if (isIt == 1) 
		{
			clearTimeout(timerm);
			activNav = true
			timerm = setTimeout('menuDo('+num+',"'+sta+'")',300);

		}
		if (isIt == 0) 
		{
			activNav = false;
			clearTimeout(timerm);
			//hidL('off')
			
		}
	}
}
	
	
function hidL(sta)
{
	if (sta == 'on') 
	{
	 // show hidLayer
	if (n) document.layers["hidLayer"].visibility = "show"
	else if (ie) document.all["hidLayer"].style.visibility = "visible"
	else if (n6) document.getElementById("hidLayer").style.visibility = "visible"
	}
	
	if (sta == 'off')
	{
	if (n) document.layers["hidLayer"].visibility = "hide"
	else if (ie) document.all["hidLayer"].style.visibility = "hidden"
	else if (n6) document.getElementById("hidLayer").style.visibility = "hidden"
	}
}


//This is the function that changes the sub menus to folded or unfolded 

function menuDo(num,sta)
{

	clearTimeout(timerm);
	if (activNav == true)
	{
	// show hidLayer
	hidL(sta)

		if(browser)
		{
		
			if(!stayFolded)
			{
				if (num !=0) oTop[num].zindex(10)
				
				i = 1; // starts at 1
				while (i > -1)
				//for(i=1;i<oSub.length;i++)
				{
					//alert(i-1);
					if(i!=mainCat) oSub[i].hideIt()
					i = next[i];
				}
				i = 1; // starts at 1
				while (i > -1)
				//for(i=2;i<oTop.length;i++)
				{
					if (i!=num) {oTop[i].zindex(3)}
					//if (i-1 != mainCat) {oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height);}
					if (prev[i] != mainCat) {
						function_move (i, 0);
					}
					i = next[i];
				}	
				
			}
			
			if (num !=0)
			{
				oSub[num].vis()?oSub[num].showIt():oSub[num].hideIt()
				i = 1; // starts at 1
				while (i > -1)
				//for(i=2;i<oTop.length;i++)
				{ 
					// this moves the menus down relative to the expanded menu.
					if(mainCat == num && i > 1)
					{ //this is the height and/or dist. between the expanded menu and the next nav item
						//if(!oSub[i-1].vis()) {
						if(!oSub[prev[i]].vis()) {
							function_move(i,1);
						}
						else {
							function_move(i,0);
						}
					}
					i = next[i];
				}
			}
		}
	}
	// sets rollovers to off when menus hide
	onM(2,0,0,'off');onM(4,0,0,'off');onM(8,0,0,'off')
}




// rollover for main categories
function onM(layM,numM,nimM,sta) 
{
	var pocc = ((layM ==1) && (numM == 1)) ?  true : false //identify if poc 1.1.0 located in 3.0.0 space
	var hom = ((layM ==1) && (numM == 0)) ?  true : false


 
if(oSub[layM].css.visibility=="hidden" || oSub[layM].css.visibility=="hide")  //keeps rollover 'on' while subMenu visible
{

if ((!pocc) && (!hom))
{
	if (layM == 13) { layM = 0 } // work around for corp. Home button (number 13 in array) same as consumer 13.0.0
	if (layM != mainCat)
	{
	if (layM == 0) { layM = 13 }
	    if (n) 
		{
			img = eval('document.divCont.document.divTop'+layM+'.document.images["x'+layM+numM+nimM+'"]');
			img.src = "images_menu/"+layM+numM+nimM+"_"+sta+".gif";
		}
	    if (ie || n6)
		{
			imgz = "x" + layM + numM + nimM	// a letter must be part of the name of the image for this to work in IE
			img = eval('document.images[imgz]');
			img.src = "images_menu/"+layM+numM+nimM+"_"+sta+".gif";
		}
	}
}

else // required to make 1.0.0 home rollover co-exhist with 1.1.0 poc rollover call
{
		if (n)
		{
				if ((pocc) && (poc)) { }
				else
				{
				if (pocc) { layMm = 3 } // jdn changed from 3 to 4
				else  { layMm = layM  }
				img = eval('document.divCont.document.divTop'+layMm+'.document.images["x'+layM+numM+nimM+'"]');
				img.src = "images_menu/"+layM+numM+nimM+"_"+sta+".gif";
				//alert(img)
				}
		}
	
		if(ie || n6)
		{	
				if ((pocc) && (poc)) { }
				else
				{
				imgz = "x" + layM + numM + nimM	// a letter must be part of the name of the image for this to work in IE
				img = eval('document.images[imgz]');
				img.src = "images_menu/"+layM+numM+nimM+"_"+sta+".gif";
				}
		}
	

}
}
}

function onS(layS,numS,nimS,sta) // rollover for sub categories
{

if ((nimS != 0) && (nimS == subbCat)) {}
else
{

if ((mainCat != layS) || (subCat != numS)) 
{

	if (n) 
	{
		if (layS == 12) laySs=2 // set sections 12.x in the 2.x space
		else laySs = layS
		img = eval('document.divCont.document.divTop'+laySs+'.document.divSub'+laySs+'.document.Sub'+laySs+'Content.document.images["x'+layS+numS+nimS+'"]');
		img.src = "images_menu/"+layS+numS+nimS+"_"+sta+".gif";
	}
	if (ie || n6)
	{
		imgz = "x" + layS + numS +nimS	// a letter must be part of the name of the image for this to work in IE
		img = eval('document.images[imgz]');
		img.src = "images_menu/"+layS+numS+nimS+"_"+sta+".gif";
	}


}
}
}



function tNav(nam,sta) 
{
if (mainCat != nam)
{
 document.images["x"+nam].src = "images_menu/"+nam+"_"+sta+".gif"
}
}




