var loadingHTML     = "<center>Please wait.</center><br /><center>" +
                      "<img src='/images/loading.gif' width='220' height='19' alt='Loading...' /></center>";
var loadingTHTML    = "<center>Please wait.</center><br /><center>" +
                      "<img src='/images/loadingT.gif' width='220' height='19' alt='Loading...' /></center>";
var loading3HTML    = "<center><img src='/images/loading3.gif' width='16' height='16' alt='Loading...' /></center>";
var searchingHTML   = "<center>Searching. Please wait.</center><br />" +
                      "<center><img src='/images/loading.gif' width='220' height='19' alt='Searching...' /></center>";
var modalPars       = {overlayCss:{backgroundColor:'#ffffff',cursor:'wait'},opacity:75,persist:true};

if (browserIE6)
  modalPars.position = ['10px','10px'];

var openMenuId = null;

function closeMenu ()
{
  if (openMenuId != null)
  {
    document.hideDIV(openMenuId);
		if(BrowserDetect.version < 7 && BrowserDetect.browser=="Explorer") 
		{
			var oRef = document.getObjectRef(openMenuId);
			showSelects (true,oRef);			
		}
    openMenuId = null;
  }
}

function openMenu (mainMenuId)
{
  var oTD = document.getObjectRef("menu-" + mainMenuId);

  newMenuId = "subMenu-" + mainMenuId;

  if (newMenuId == openMenuId)
    closeMenu();
  else
  {
    closeMenu();
    openMenuId = newMenuId;
    document.showDIVBelow(openMenuId,oTD);
		
		if(BrowserDetect.version < 7 && BrowserDetect.browser=="Explorer") 
		{
			var oRef = document.getObjectRef(openMenuId);
			showSelects (false,oRef);			
		}
  }
}

function openMenu2 (mainMenuId)
{
  var oTD = document.getObjectRef("menu-" + mainMenuId);

  newMenuId = "subMenu-" + mainMenuId;

  if (newMenuId == openMenuId)
    closeMenu();
  else
  {
    closeMenu();
    openMenuId = newMenuId;
    document.showDIVAboveCenter(openMenuId,oTD);
  }
}

function doSearch ()
{
  var oForm = document.getObjectRef("searchForm");

  oForm.submit();
}

function showSelects (flag,oExcept)
{
  var s     = document.body.getElementsByTagName("SELECT"),
      sLen  = s.length,
      es    = oExcept.getElementsByTagName("SELECT"),
      esLen = es.length;
  var si,
      esi;
 
  for (si = 0;si < sLen;si++)
  {
    so  = s[si];
 
    for (esi = 0;esi < esLen;esi++)
    {
      if (es[esi] == so)
        break;
    }
 
    if (esi == esLen) // not found in except object?
    {
      if (flag)
        so.style.visibility = "visible";
      else
        so.style.visibility = "hidden";
    }
  }
}
