var imageOver = 0;
var menuOver = 0;
var itemOver = 0;
var linkOver = 0;
var oldCell = "998";
var newCell = "999";
var oldImage = "none";
var newImage = "none";

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function swapImage(id, swap)
{
  document.getElementById(id).src = swap;
}

function changeMenuOut(name)
{
  document.getElementById(name).className = "dropHide";
}

function changeMenuIn(name)
{
  document.getElementById(name).className = "dropShow";
}

function outSwap(imageId, menuName, imageSwap)
{
  if((imageOver == 0 && menuOver == 0) || newImage != oldImage)
  {
    swapImage(imageId, imageSwap);
    changeMenuOut(menuName);
    oldCell = "998";
  }
}

function overImage(imageId, menuName, imageSwap)
{
  imageOver = 1;
  newImage = imageId;
  oldCell = "998";
  if(document.getElementById(menuName).className != "dropShow")
  {
    swapImage(imageId, imageSwap);
    changeMenuIn(menuName);
  }
}

function outImage(imageId, menuName, imageSwap)
{
  imageOver = 0;
  oldImage = imageId;
  setTimeout("outSwap('" + imageId + "', '" + menuName + "', '" + imageSwap + "');", 5);
}

function overMenu()
{
  menuOver = 1;
}

function outMenu(imageId, menuName, imageSwap)
{
  menuOver = 0;
  setTimeout("outSwap('" + imageId + "', '" + menuName + "', '" + imageSwap + "');", 5);
}

function tdSwapOn(cell)
{
//  if(newCell != oldCell || itemOver == 0 && linkOver == 1)
//  {
    document.getElementById(cell).className = "navItemHover";
//  }
}

function tdSwapOff(cell)
{
  if(itemOver == 0 || cell != newCell)
  {
    document.getElementById(cell).className = "navItem";
  }
}

function overItem(cell)
{
  itemOver = 1;
  newCell = cell;
  setTimeout("tdSwapOn(" + cell + ")", 5);
}

function outItem(cell)
{
  itemOver = 0;
  oldCell = cell;
  setTimeout("tdSwapOff(" + cell + ")", 5);
}

function overLink()
{
  linkOver = 1;
}

function outLink()
{
  linkOver = 0;
}
