/* preload images objects indicating lefthand nav menu state (right/down arrows).
   objects are used in functions : toggleMenu(); shutOpenMenu(). */
	var imgMenuOpen = new Image(); // for down-arrow image
	var imgMenuShut = new Image(); // for right-arrow image
	
	imgMenuOpen.src = '/TWOLOST/GRAPHICS/goldarrowdown.gif';
	imgMenuShut.src = '/TWOLOST/GRAPHICS/goldarrow.gif';


/*=======================================================================================/
/  toggleMenu : toggles open|shut the lefthand menu divs when user clicks parent link.
/  param: linkID[string]; return: [none]. */
 
function toggleMenu(linkID)
{
  if ((eval("document.getElementById(linkID + '_div') ;" ).style.display)=="block")
  {
	//shutOpenMenu();
	
	eval("document.getElementById(linkID + '_div') ;" ).style.display="none";
    eval("document.getElementById(linkID + '_img') ;" ).src=imgMenuShut.src;
  }
  else
  {
    //shutOpenMenu();
      
    eval("document.getElementById(linkID + '_div') ;" ).style.display="block";
    eval("document.getElementById(linkID + '_img') ;" ).src=imgMenuOpen.src;
  }
  //event.returnValue=0;
}



/*=======================================================================================/
/  shutOpenMenu : shuts all lefthand menu divs. is called from toggleMenu() function.
/  param: [none]; return: [none]. */
 
function shutOpenMenu()
  {
	var strThis = document.location.href;
	
	if(strThis.indexOf('/TWOLOST/') != -1)
	{
		nIndex = 1;
	}
	else
	{
		nIndex = 0;
	}

	for (var k=0; k<=nIndex; k++)
	{    
		if (eval("document.getElementById('Link" + k + "_img'); ").src==imgMenuOpen.src)
		{
			eval("document.getElementById('Link" + k + "_div'); ").style.display="none";
			eval("document.getElementById('Link" + k + "_img'); ").src=imgMenuShut.src;
		}
	}
  }


/*=======================================================================================/
/	initMaps : navigation (three image maps stacked on each other, changed with CSS.
/	preload images via body tag
/	example: <body onload="initMaps('btnprevMap', 'btnnextMap')"
*/
function initMaps()
{
   if (document.getElementById)
   {
      var mapIds = initMaps.arguments;    // pass string IDs of containing map elements
      var i, j, area, areas;
      for (i = 0; i < mapIds.length; i++) {
        areas = document.getElementById(mapIds[i]).getElementsByTagName("area");

        for (j = 0; j < areas.length; j++) {  // loop thru area elements
           area = areas[j];
           area.onmousedown = imgSwap;    // set event handlers
           area.onmouseout = imgSwap;
           area.onmouseover = imgSwap;
           area.onmouseup = imgSwap;
        }
      }
   }
}

// image swapping event handling
function imgSwap(evt) {
   evt = (evt) ? evt : event;                   // equalize event models
   var elem = (evt.target) ? evt.target : evt.srcElement;
   var imgClass = elem.parentNode.name;         // get map element name
   var coords = elem.coords.split(",");         // convert coords to clip
   var clipVal = "rect(" + coords[1] + "px " +
                           coords[2] + "px " +
                           coords[3] + "px " +
                           coords[0] + "px)";
   var imgStyle;
   switch (evt.type) {
      case "mousedown" :
         imgStyle = document.getElementById(imgClass + "Down").style;
         imgStyle.clip = clipVal;
         imgStyle.visibility = "visible";
         break;
      case "mouseout" :
         document.getElementById(imgClass + "Over").style.visibility = "hidden";
         document.getElementById(imgClass + "Down").style.visibility = "hidden";
         break;
      case "mouseover" :
         imgStyle = document.getElementById(imgClass + "Over").style;
         imgStyle.clip = clipVal;
         imgStyle.visibility = "visible";
         break
      case "mouseup" :
         document.getElementById(imgClass + "Down").style.visibility = "hidden";
         // guarantee click in IE
         if (elem.click) {
             elem.click();
         }
         break;
   }
   evt.cancelBubble = true;
   return false;
}


	var WindowName;
	function CloseWindow()
	{
		if(WindowName != null && !WindowName.closed) 
			WindowName.close();
	}
	
	function MM_openBrWindow(theURL,winName,features) 
	{
		CloseWindow();
		WindowName = window.open(theURL,winName,features);
	}