var sectNum;
var whatPage
whatPage = "home";

var outSfx = "_over.gif" 
var inSfx = "_off.gif"   

if (document.images)
{
  var state, gblprefix
  state = "_over";
  gblprefix = "gbl_cor_";
  var aImages = new Array(
    '/images/' + gblprefix + 'homemenu0',
    '/images/' + gblprefix + 'menu1',
    '/images/' + gblprefix + 'menu2',
    '/images/' + gblprefix + 'menu3',
    '/images/' + gblprefix + 'menu4'
  )
 preloadImages(aImages);
}

 
function preloadImages(the_images_array)
{
 // build image names to preload. 
 if (document.overArray==null || document.overArray == undefined) 
 {
  document.OverArray = new Array();
  document.OffArray = new Array();
 }
	
 var i = the_images_array.length;
	
 for(var loop = 0; loop < the_images_array.length; loop++)
 {
  //Set a new image for each index of each array.
  //NOTE: the indexes (starting with zero) must match the anchor IDs, image NAME attribute, and the rollover div's ID.
  document.OverArray[loop] = new Image;
  document.OffArray[loop] = new Image;
		
  //Set the source of each image, starting with the constants and adding the correct suffix.	   
   document.OverArray[loop].src = the_images_array[loop] + outSfx;
   document.OffArray[loop].src = the_images_array[loop] + inSfx;
 }
}

//Place menus
var numbMenus, menuTop
numbMenus = 5;	//Total number of menus on the page.
menuTop = 76;

function menu(idx,t,l,h,w)
{
 //don't mess with this function.
 this.idx=idx;
 this.l=l;
 this.t=t;
 this.h=h;
 this.w=w;
}

//Don't mess with this next line.
aMenu = new Array(numbMenus);

//Add a new one of these for each menu.  
//idx = the dot's ID, starting with 'I'.  First menu's number = 0.  This number will match up with the number of the popup layer, which starts with 'L'.
//t = top; l = left; h = rollover div's height; w = rollover div's width; s = switch.  
//Values = l for left, r for right (on which side of the dot the div appears).
//                   id   t     l  h  w
aMenu[0] = new menu("0",menuTop,0,52,125);			//Home
aMenu[1] = new menu("1",menuTop,aMenu[0].w,52,128);		//Menu1
aMenu[2] = new menu("2",menuTop,aMenu[1].l+125,52,125);		//Menu2
aMenu[3] = new menu("3",menuTop,aMenu[2].l+125,52,125);		//Menu3
aMenu[4] = new menu("4",menuTop,aMenu[3].l+125,52,125);		//Menu4

function PlaceMenus()
{
 window.name="main";
 //Don't change this function //Places menus and divs
 for (var i = 0; i < numbMenus; i++)
 {
  var el, el2
  var whatDiv,whatL, whatTop,whatLeft, whath, whatw
  whatLeft = aMenu[i].l + "px";
  whatTop = aMenu[i].t + "px";
  whath = aMenu[i].h + "px";
  whatw = aMenu[i].w + "px";
		
  if(sectNum == i)
  {
   var szArea, objArea
   szArea = "I" + i;
   objArea = fLayerTypeID(szArea);
   eval("document."+szArea+".src = document.OverArray[" + i + "].src");
  }		
		
  if((doAll) || (NS6))
  {
   whatDiv = "X" + i;
   el = fLayerTypeID(whatDiv); //document.all[whatDiv] for IE; getElementById(whatDiv) for NS6.
   el.style.top = aMenu[i].t;
   el.style.left = aMenu[i].l;
   el.style.height = aMenu[i].h;
   el.style.width = aMenu[i].w;
   el.style.display = "none";
  }
 }
}

function menuOver(whoNumb)
{
 if(PageIsLoaded)
 {
  if(sectNum != whoNumb)
  {
   eval("document.I"+whoNumb+".src = document.OverArray[" + whoNumb +"].src");
   if(doAll)
   {
    el=fLayerTypeID("X"+whoNumb);
    el.style.display="block";
   }
  }
 }
}

function menuOut(whoNumb)
{
 if(PageIsLoaded)
 {
  if(sectNum != whoNumb)
  {
   eval("document.I"+whoNumb+".src = document.OffArray[" + whoNumb + "].src");
   if(doAll)
   {
    el=fLayerTypeID("X"+whoNumb);
    el.style.display="none";
   }
  }
 }
}

function getSearch()
{ return document.location.search; }


function setLeftNav()
{
 init(); // initializes the photocaption code in the coremenu.js
	
 if((doAll) || (NS6))
 {
  var whatSearch, szSearch
  var navon, navoff
  if(sectNum == 0)
  {
   navon="homeleftnavOn";
   navoff="homeleftnav";
  }
  else
  {
   navon="leftnavOn";
   navoff="leftnav";
  }
		
  whatSearch = getSearch();
  szSearch = whatSearch.substring(1,whatSearch.length);
  var vColl, vNSCollGrp
  
  //collection of all anchors with id= LeftA
  if(doAll) { vColl = document.all.item("LeftA"); }
  if(NS6)
  {
   vNSCollGrp = document.getElementById("dvLN");
   vColl = vNSCollGrp.getElementsByTagName("a"); //collection of all anchors within dvLN.
  }		
		
  if (vColl != null) 
  {
   //NS6 is super-sensitive, so all numbers are parseInt.
   if(szSearch == "") 
   {
    //Assures that no secondary menu item will be selected on default.
    if((sectNum==0) || (sectNum=="0")) { szSearch = parseInt(999); }
	else { szSearch = parseInt(0); }
   }
   else { szSearch = parseInt(szSearch); }
			
   for (i=parseInt(0); i<vColl.length; i++) 
   {
    if (szSearch == i)
    {
     vColl.item(i).className=navon;
     var szHref = vColl.item(i).href + "?"+i;
     vColl.item(i).href = szHref;
    }
    if(szSearch != i)
    {
     vColl.item(i).className=navoff;
     var szHref = vColl.item(i).href + "?"+i;
     vColl.item(i).href = szHref;
    }
   } 
  } 
 } 
} 
