	// JavaScript Document

var NavItems;
var SubNavParents;
var SubNavChilds;
var NavImgs;
var ImgArray;
var t;
var _Suffix;
var mainNavID;
var menuPosL;
function getMenuItems(ID){
if(ID=='nav3'){
	menuItems= new Array([]);
	menuPosL = '290';
}
if(ID=='nav4'){
	menuItems= new Array([]);
	menuPosL = '377';
}
if(ID=='nav5'){
	menuItems= new Array([]);
	menuPosL = '464';
}
if(ID=='nav6'){
	menuItems= new Array([]);
	menuPosL = '550';
}
if(ID=='nav7'){
	menuItems= new Array([]);
	menuPosL = '521';
}
if(ID=='nav8'){
	menuItems= new Array([]);
	menuPosL = '605';
}
}

window.onload=function(){
var div = document.getElementById('theContent');
var tile1 =document.getElementById('expando1');
tile1.style.height=div.offsetHeight+40; //look at again
	NavItems = document.getElementById('NavSt1').getElementsByTagName('A');
	setImgArray();
	for(var a=0;a<NavItems.length;a++){
		var _Img;
		
		NavItems[a].childNodes[0].onmouseover=function(){//finds images within the a tags and sets up the rollovers
				_Img = this.src // get img src
				if(_Img.indexOf('_')!=-1){ //if it has an underscore in it (and is therefore in the down state)
					var minus = (_Img.length)-(_Img.indexOf('_'));
					 _Suffix=_Img.substr(0,_Img.length-minus)// _Suffix is the src minus the characters from the underscore
				}
				else{
					_Suffix=_Img.substr(0,_Img.length-4); // otherwise it just the src minus 4 characters for '.gif'
				}
				this.src=_Suffix+'_over.gif';
		}
		NavItems[a].childNodes[0].onmouseout=function(){
				this.src=_Suffix+'.gif';
				resetImages();// has to reset all images to the original ones incase one was originally in the active state;
		}
		
		if(NavItems[a].className=='roll'){
			NavItems[a].setAttribute('id','nav'+a)
			NavItems[a].onmouseover=function(){
				hideEm();
				clearTimeout(t);
				buildNav(this.id);
			
			}
			NavItems[a].onmouseout=function(){
				t=setTimeout('hideEm()',200);
			}
		}
		else{
			NavItems[a].onmouseover=function(){
				//alert('no')
			}
		}
	}
}
function setImgArray(){
	ImgArray=new Array();
	for(var b=0;b<NavItems.length;b++){
		ImgArray[b] = NavItems[b].childNodes[0].src;
	}
}
function resetImages(){
	for(var c=0;c<NavItems.length;c++){
		NavItems[c].childNodes[0].src=ImgArray[c]
	}
}

function buildNav(ID){
mainNavID=ID;
getMenuItems(ID);
var Table='<table align="left" border="0" cellpadding="0" cellspacing="0" width="200">';
	for(var d=0;d<menuItems[0].length;d++){
		Table+='<tr><td>'+menuItems[0][d]+'</td></tr>';
	}
	Table +='</table>';
var setDiv = document.getElementById('menuDiv');
	setDiv.style.left=menuPosL +'px';
	setDiv.innerHTML=Table;
	
	SubNavParents=document.getElementById('menuDiv').getElementsByTagName('TD');
	for(var e=0;e<SubNavParents.length;e++){
		SubNavParents[e].setAttribute('id','subNav'+e)
		SubNavParents[e].onmouseover=function(){
			document.getElementById(ID).childNodes[0].src=_Suffix+'_over.gif'
			this.style.background='#E9ADC2';
			buildSubNav(this.id)
		}
		SubNavParents[e].onmouseout=function(){
			document.getElementById(ID).childNodes[0].src=_Suffix+'.gif'
			this.style.background='#F4D6E1';
		}
	}
	setDiv.style.display='block';	
}

function buildSubNav(theID){
var whichMenuItem=parseInt(theID.substr(6,99))+1;
var subTable = '<table align="left" border="0" cellpadding="0" cellspacing="0" width="200">';
if(menuItems[whichMenuItem]){
	for(var f=0;f<menuItems[whichMenuItem].length;f++){
		subTable+='<tr><td>'+menuItems[whichMenuItem][f]+'</td></tr>';
	}
	subTable +='</table>';
var setSubDiv = document.getElementById('subMenuDiv');
	if(menuPosL>460){
	setSubDiv.style.left=parseInt(menuPosL)-200+'px';
	setSubDiv.style.filter='progid:DXImageTransform.Microsoft.dropshadow(OffX=-2, OffY=2, Color=#C4BFD6, Positive=true)';
	}
	else{
	setSubDiv.style.left=parseInt(menuPosL)+200+'px';
	setSubDiv.style.filter='progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color=#C4BFD6, Positive=true)';
	}
	setSubDiv.style.top='265px';
var menuPosT = setSubDiv.style.top;
menuPosT = parseInt(menuPosT)+((whichMenuItem-1)*14)+'px';
setSubDiv.style.top = menuPosT;
	setSubDiv.innerHTML=subTable;
	SubNavChilds=document.getElementById('subMenuDiv').getElementsByTagName('TD');
	for(var f=0;f<SubNavChilds.length;f++){
		SubNavChilds[f].onmouseover=function(){
		document.getElementById(mainNavID).childNodes[0].src=_Suffix+'_over.gif'
		document.getElementById(theID).style.background='#E9ADC2';
			this.style.background='#F4D6E1';
		}
		SubNavChilds[f].onmouseout=function(){
			document.getElementById(mainNavID).childNodes[0].src=_Suffix+'.gif'
			document.getElementById(theID).style.background='#F4D6E1';
			this.style.background='#E9ADC2';
		}
	}
	setSubDiv.style.display='block';
	}
	else{
	return;
	}
}

//function doSomething(e)
//{
	//if (!e) e = window.event;
	//if (e.target) var trg = e.target;
	//else if (e.srcElement) var trg = e.srcElement;
	//if (trg.tagName != 'DIV') return; // Mouseout on links, ignore event
	//else if(trg.tagName == 'DIV'){

	//t=setTimeout('hideEm()',500);
//}

function hideEm(){
	document.getElementById('menuDiv').style.display='none';
	document.getElementById('subMenuDiv').style.display='none';
}