

var menuTimer=0;
var op;
function swapColor(obj, color)
{
	obj.style.backgroundColor=color;
}


function openWindow(URL, winWidth, winHeight)
{
	leftPosition=(screen.width)?(screen.width-winWidth)/2:100;
	topPosition=(screen.height)?(screen.height-winHeight)/2:100;

	settings='width=' + winWidth + ',height=' + winHeight + ',top=' + topPosition + ',left=' + leftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(URL,'OpenWindow',settings);	
}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function clsT() { menuTimer=setTimeout("hideMenusAndIndicator()",3000);}
function clrT() { clearTimeout(menuTimer); }
function hideMenusAndIndicator() { showLayers();}	

function showLayers()
{
	var strMenuItem, iMenuCount, iHCount;
	var showArgs = showLayers.arguments;
	
	// If Highlight array doesn't exist, create it.
	if(!document.SetHighlight) {aryHighlight=new Array();document.SetHighlight=true;}	
	
	// If no arguments
	if (showArgs.length == 0) { 
		// Close all open menus.
		autoLayers(); 

		// Loop thru array of Highlighted link and return background color.
		for(iHCount=0; iHCount < aryHighlight.length;iHCount++)
		{
			swapColor(findObj(aryHighlight[iHCount]), "transparent");
		}
	}
	else {	
		
		// Populate Highlight array (no existing items)
		if (aryHighlight.length == 0)
		{
			aryHighlight[0] = showArgs[0];
		}
		else
		{

			// Loop thru array of Highlighted link and return background color.
			for(iHCount=0; iHCount < aryHighlight.length;iHCount++)
			{
				swapColor(findObj(aryHighlight[iHCount]), "transparent");
			}			
			
			aryHighlight[0] = showArgs[0];
		}

		// Swap Background color of highlighted link.
		swapColor(findObj(showArgs[0]), "#CCCCCC");
		
		// Create string of menus
		strMenuItem = "autoLayers(";
		for(iMenuCount=1; iMenuCount < showArgs.length;iMenuCount++)
		{
			//strMenuItem += "\"" + showArgs[iMenuCount] + "\","
			strMenuItem += "'" + showArgs[iMenuCount] + "',"
		}
		
		// Show all menus passed to function.
		strMenuItem = strMenuItem.substring(0, strMenuItem.length - 1);
		strMenuItem += ")"
		
		eval(strMenuItem);
	}	
}

function autoLayers()
/* 
     Purpose: Display any menu passed as an argument.
        Args: example: 'layer1', 'layer2', etc...
   Exception: If all layers are to be hidden, pass nothing.
*/ 
{
 var g,b,k,f,args=autoLayers.arguments;
 
 if(!document.pSetC) {pItems=new Array();document.pSetC=true;}

 for(k=0; k<pItems.length; k++) 
 {
	if((g=findObj(pItems[k]))!=null) 
	{
		b=(document.layers)?g:g.style;b.visibility="hidden";b.display="none";
	}
 }

	for(k=0; k<args.length; k++) 
	{
		if((g=findObj(args[k])) != null) 
		{
			b=(document.layers)?g:g.style;b.visibility="visible";b.display="block";f=false;
			
			for(j=0;j<pItems.length;j++) 
			{
				if(args[k]==pItems[j]) {f=true;}
			}
		
			if(!f) {pItems[pItems.length++]=args[k];}
		}	
	}
}

function modSelects(strVisibility)
/*
	Purpose: Hide or show all <Select> lists visible on a page.

	   Note: <Select> lists appear on the lowest z-index and will appear 
	         thru drop-down menus if not hidden.
	   Args: "visible" or "hidden".
*/
{
	var oFrame;
	bNoForm = true;
	
	if (bNetscape)		
	{
		if (eval(parent.main.document.forms[0]))
		{
			oFrame = parent.main.document.forms[0];
			bNoForm = false;
		}
	}
	else
	{
		if (eval(document.main.document.forms[0]))
		{
			oFrame = document.main.document.forms[0];
			bNoForm = false;
		}
	}
	
	if (!bNoForm)
	{
		if (typeof(oFrame) != 'undefined')
		{
			for (i=0;i < oFrame.length;i++) 
			{	
				var tempobj = oFrame.elements[i];
				if (tempobj.type =="select-one" || tempobj.type =="select-multiple")
				{
					tempobj.style.visibility = strVisibility;
				}
			}
		}
	}
}
