// Turn selected element on



var currentLink,fired;

function engage(evt) 

	{

if(navigator.appVersion.indexOf("MSIE 4")!=-1 && navigator.appVersion.indexOf("Mac")!=-1)

		{
		return;
		}

if (document.layers)
	{
	if(currentBox.name!= 'baseLayer' && currentLink)
		{
		if (currentSel.id.charAt(0)=='_')
			{
			this.location='http://civilgroup.csc.com';
			return;
			}	
		else if (currentSel.name.charAt(0)!='/')
			{
			window.location=currentLink+currentSel.name;
			}
		else 
			{
			window.location=currentSel.name;
			}
		}
	else if (currentLink)
		{
		window.location= currentLink;
		}	
	}	
	else if (currentSel.className =='nav' && currentSel)
		{
		this.location=currentLink;
		}
	else if (currentSel)	
		{
		if (currentSel.id.charAt(1)=='/')
			{
			this.location='http://civilgroup.csc.com';
			return;
			}	
		else if (currentSel.id.charAt(0)!='/')
			{
			this.location=currentLink+currentSel.id;
			}
		else this.location=currentSel.id;
		}
	}



if (navigator.appVersion.indexOf("MSIE")) 

	{

	var thisLayer,shiftBy,isWinLeftAdjust=0,navLoad=true,mainNavHeight=80;

  	var x1,y1,x2=0,y2,deltaxCoord,currDiv,currentSel=0;

  	var popThis=false,popped=false,popTime;  

  	var popDelay=false,same;

 	 var popThis=false,popped=false,currPopHighlight=false,currHighlightLayer=false; 

 	 }

if(document.layers)

 	 {

 	 document.captureEvents(Event.MOUSEMOVE| Event.CLICK | Event.MOUSEUP | Event.RESIZE );

 	 var thisLayer,shiftBy,globalMenuWidth=160;

 	 var currMainHot=false,currPopHot=false,popped,popTime,popThis,popDelay;

 	 var lastSel,selectedObj;var x1,y1,x2=0,y2,deltaxCoord,currDiv,currentSel=0;

 	 var currentSel=false,currentBox=false;
 	 var isWin;

 	 }







arrowBull=new Image;

arrowBull.src="/FEDMedia/Art/Common/navArrowBullet.gif";



arrowBull_o=new Image;

arrowBull_o.src="/FEDMedia/Art/Common/navArrowBullet_o.gif";



function slope(evt)

	{

	if(document.layers)

		{

		x1=evt.pageX;

		y1=evt.pageY;

		if ((x1-x2)<-1 || (y1-y2)<-1)

			{

			clearTimeout(popTime);

			clearTimeout(popDelay);

			popDelay=false;

			}

		x2=x1;

		x2=x1;

		return;

		}

	else if (navigator.appVersion.indexOf("MSIE"))

		{

		x1=window.event.clientX;

		y1=window.event.clientY;

		if ((x1-x2)<-1 || (y1-y2)<-1)

			{

			clearTimeout(popTime);

			clearTimeout(popDelay);

			popDelay=false;

			}

		x2=x1;

		x2=x1;

		return;

		}

	}



function posLayers(evt)

	{
	if(navigator.appVersion.indexOf("MSIE 4")!=-1 && navigator.appVersion.indexOf("Mac")!=-1)
		{
		return;
		}	
	if(document.layers)
		{
		
		
		for(i=0;i<document.layers.length; i++)

			{
			isWin=2;
			if(navigator.appVersion.indexOf("Mac")!=-1)isWin=0;
			thisLayer=document.layers[i];
			shiftBy=0;

			if(!i)thisLayer.clip.right=142;//139;
			else thisLayer.clip.right=globalMenuWidth+1;
			for(j=0;j<thisLayer.document.layers.length;j++)

				{

				thisLayer.document.layers[j].clip.right=globalMenuWidth;

				thisLayer.document.layers[j].moveBy(0,shiftBy);	

				shiftBy=shiftBy+document.layers[i].document.layers[j].clip.bottom-21;	

				}	

			if(i==0)

				{

				thisLayer.clip.bottom = thisLayer.clip.bottom+shiftBy+3;
 
				}

			else

				{
				if (thisLayer.document.layers[thisLayer.document.layers.length-1].clip.bottom>25)
					{
					thisLayer.clip.bottom-=thisLayer.document.layers[thisLayer.document.layers.length-1].clip.bottom-25-isWin;
					if(navigator.appVersion.indexOf("Mac")==-1)
						{
						isWin=-2;
						}
					}
				thisLayer.clip.bottom = thisLayer.clip.bottom+shiftBy-(3-isWin);
				
				}

			}	
		for(i=0;i<document.layers[0].layers.length; i++)

			{

			thisLayer=document.layers[i+1];

			thisLayer.pageX=document.layers[0].pageX+document.layers[0].clip.right+4;

			thisLayer.pageY=document.layers[0].document.layers[i].pageY+2;

			if ((thisLayer.top+thisLayer.document.layers[thisLayer.document.layers.length-1].top+thisLayer.document.layers[thisLayer.document.layers.length-1].clip.bottom)>window.innerHeight)

				{

				thisLayer.moveBy(0,(window.innerHeight-(thisLayer.document.layers[thisLayer.document.layers.length-1].pageY+thisLayer.document.layers[thisLayer.document.layers.length-1].clip.bottom))-18)

				}

			if (thisLayer.pageY<1) thisLayer.pageY=1;	

			};

		document.layers[0].visibility='visible';	
		document.layers[0].visibility='visible';
		}

	else if (navigator.appVersion.indexOf("MSIE"))

		{

		var check=0;			

		var popLeft=document.all.NavTable.offsetWidth+document.all.NavTable.offsetLeft-isWinLeftAdjust;

		var popTop=mainNavHeight+2,thisTable,bumpUp,MainNavDiv;

		for(i=0;i<document.all.NavTable.children[0].children.length;i++)

			{

			if(document.all.NavTable.children[0].children[i].className == 'nav')

				{

				thisTable=document.all.AllPopTables.children[check];	

				if(popTop+thisTable.children[0].clientHeight>document.body.clientHeight)

					{

					bumpUp= popTop+thisTable.clientHeight-document.body.clientHeight;

					}

				else 

					{

					bumpUp=0;

					}

				if(bumpUp>popTop) 

					{

					thisTable.style.pixelTop =0;

					}

				else

					{

					thisTable.style.pixelTop =(popTop -bumpUp);

					}

				thisTable.style.pixelLeft =popLeft;  //alert(thisTable.id +' '+thisTable.style.pixelLeft +' '+popLeft);

				thisTable.children[0].borderColor="000000";

				thisTable.children[0].borderColorDark="#FF6666";

				thisTable.children[0].borderColorLight="#660033";

				check++;

				popTop=popTop+document.all.NavTable.children[0].children[i].offsetHeight+1;

				}	

			}

		}	

	}



function init() 

	{

	//if(navigator.appVersion.indexOf("MSIE 4") && navigator.appVersion.indexOf("Mac"))return;

	document.onclick = engage;

	document.onmousemove = navMonitor;

	window.onresize = handleResize;

	posLayers();

	 

	}	



function handleResize(evt)

	{

	if (document.layers)

		{

		document.location=this.location;

		}

	else posLayers();

	}







function nsReload()

	{

	if (currentBox.name!= 'baseLayer' && currentSel)

		{

		currentLink=currentLink+currentSel.id

		}

	document.location.reload()

	}



function popHold()

	{

	popDelay=false;

	return;

	}



function navMonitor(evt)

	{

	if(navigator.appVersion.indexOf("MSIE 4")!=-1 && navigator.appVersion.indexOf("Mac")!=-1)

		{

		return;

		}	if(document.layers)

		{

		var clickX = evt.pageX

			var clickY = evt.pageY

			var testObj;

			for (var i = document.layers.length - 1; i >= 0; i--) 

				{

				if (i==0 || document.layers[i]==popped)

					{

					for (var j = document.layers[i].document.layers.length -1; j >= 0; j--) 

						{

						testObj = document.layers[i].document.layers[j];

						if ((clickX > document.layers[i].left) && 

						(clickX < document.layers[i].left+ testObj.clip.width) && 

						(clickY > document.layers[i].top+testObj.top) && 

						(clickY < document.layers[i].top+testObj.top + testObj.clip.height)) 

							{

							lastSel=currentSel;

							currentSel = testObj;

							break;

							}

						else	if(currentBox && clickX>document.layers[1].left+document.layers[1].clip.right || clickX<document.layers[0].left)

							{

							for (var i = document.layers.length - 1;i >0; i--) 

								{

								document.layers[i].visibility="hidden";

								for (var j = document.layers[i].document.layers.length - 1;j >=0; j--) 

									{

									document.layers[i].document.layers[j].bgColor="CC6666";

									}

								}	

							for (var i = document.layers[0].document.layers.length - 1;i >= 0; i--) 

								{

								eval('document.bull'+document.layers[0].document.layers[i].name+'.src=arrowBull.src');

								document.layers[0].document.layers[i].bgColor="CC0000";

								}

							currentBox=false;

							currentSel=false;

							currentLink='';

							currPopHot=false;	

							currMainHot=false;

							break;

							}

						}

					}	

				}

		if(currentSel && currMainHot!=currentSel) 

			{

			if (currentBox!=currentSel.parentLayer && currentBox && currentBox != document.layers[0])

				{

				for (var i = currentBox.document.layers.length - 1;i >=0; i--) 

					{

					currentBox.document.layers[i].bgColor="CC6666";

					}

				}

			currentBox=currentSel.parentLayer;

			if (currentBox.name!="baseLayer")

				{

				currentSel.bgColor="990000";

				for (var i = currentBox.document.layers.length - 1;i >=0; i--) 

					{

					if (currentBox.document.layers[i] != currentSel && currPopHot)

						{

						currentBox.document.layers[i].bgColor="CC6666";

						}

					}

				currPopHot=currentSel;

				}

			else

				{

				currentSel.bgColor="990000";

				currentLink='/'+currentSel.id+'/';

				eval('document.bull'+currentSel.name+'.src=arrowBull_o.src');

				for (var i = document.layers[0].document.layers.length - 1;i >= 0; i--) 

						{

						if (document.layers[0].document.layers[i] != currentSel)

							{

							eval('document.bull'+document.layers[0].document.layers[i].name+'.src=arrowBull.src');

							document.layers[0].document.layers[i].bgColor="CC0000";

							}

						}

				if(document.layers[currMainHot]!=document.layers[currentSel.name] && currMainHot) 

					{

					document.layers[currMainHot.name].visibility='hidden';	

					}

				currMainHot=currentSel;

				popTime=setTimeout("popManager(document.layers[currentSel.name])",80);

				}	

			}

		}

	else if (navigator.appVersion.indexOf("MSIE"))	

		{

		slope();

		currentSel=window.event.srcElement; 

		if(currentSel.className =='nnav') currentSel=window.event.srcElement.parentElement;

		if(currentSel.className =='nav')

			{

			currentLink='/'+currentSel.id+'/';

			if(currentSel==currHighlightLayer)

				{

				same=true;

				}

			else 

				{

				same =false;

				}

			if(popDelay && !same) 

				{

				return;

				}

			popThis=eval("document.all."+currentSel.id+"Pop.style");

			if (popped != popThis)

				{

				popped.visibility='hidden';

				currPopHighlight.bgColor='CC6666';

				currPopHighlight=false;

				}

			clearTimeout(popDelay);	

			eval('document.bull'+currentSel.id+'.src=arrowBull_o.src');

			if (currHighlightLayer!=currentSel && currHighlightLayer) 

				{

				eval('document.bull'+currHighlightLayer.id+'.src=arrowBull.src');

				eval('document.bull'+currHighlightLayer.id+'.src=arrowBull.src');

				currHighlightLayer.bgColor='CC0000';

				}

			popTime=setTimeout("popManager(popThis)",80);//steve:delays the appearance of the 'pop' layer

			popDelay=setTimeout("popHold()",120);//steve: timesout the nav function

			if (currHighlightLayer!=currentSel && currHighlightLayer) 

				{

				eval('document.bull'+currHighlightLayer.id+'.src=arrowBull.src');

				eval('document.bull'+currHighlightLayer.id+'.src=arrowBull.src');

				currHighlightLayer.bgColor='CC0000';

				}

			

			currentSel.bgColor="990000";

			currHighlightLayer=currentSel;

			}

		else if(currentSel.className =='pop')

			{

			clearTimeout(popTime);

			clearTimeout(popDelay);

			popDelay=false;

			if (currPopHighlight!=currentSel) currPopHighlight.bgColor='CC6666';

			currentSel.bgColor="990000";

			currPopHighlight=currentSel;

			return

			}

		else

			{

			if (popDelay) return;

			if(currHighlightLayer)

				{

				currHighlightLayer.bgColor='CC0000';

				eval('document.bull'+currHighlightLayer.id+'.src=arrowBull.src');

				}

			currHighlightLayer=false;

			currPopHighlight.bgColor='CC6666';

			if (popped)popped.visibility='hidden';

				{

				popped=false;

				popDelay=false;

				}

			if (currPopHighlight) currPopHighlight.bgColor='CC6666';

			currPopHighlight=false;

			currentLink=false;

			currentSel=false;

			}

		}

	}

	

function popManager(tthis)

	{	//if(navigator.appVersion.indexOf("MSIE 4") && navigator.appVersion.indexOf("Mac"))return;



	if(document.layers)

		{

		if(currMainHot) document.layers[currMainHot.name].visibility='hidden';	

		if (tthis) tthis.visibility='visible';

		for (var i = document.layers.length - 1;i > 0; i--) 

				{

				if (document.layers[i] != tthis)

					{

					document.layers[i].visibility="hidden";

					}

				}

		popped=tthis;

		//popThis=false;

		}	

	else if (navigator.appVersion.indexOf("MSIE"))

		{

		if (popped && popped!=tthis)

			{

			popped.visibility='hidden';

			}

		popThis.visibility='visible';

		popped= popThis;

		}

	}

  if (navigator.platform == "Win32") isWinLeftAdjust=0;