﻿
// flash menu swapper

function autoFocus()
{
  var e = null;
  for(i = 0; i < document.theForm.elements.length; i++)
  {
    if(document.theForm.elements[i].type == "text")
    {
      e = document.theForm.elements[i];
      e.focus();
      setCursorTo(e, 0);
      break;
    }
  }
}

// hover menu

var hoverMenuShown = "";
var zIndex = 20;

function showHoverMenu(link, id)
{
  var e = getElement("menu" + id);
  var p = getElement("page");
  if(e)
  {
    if(id != hoverMenuShown) hideHoverMenuCallback(hoverMenuShown);
    if(link)
    {
      var left = getLeft(link) - 10;
      e.style.left = left + "px";
      e.style.top = getTop(link) + "px";
      e.style.backgroundPosition = (getLeft(p) - left) + "px -22px";
      e.style.zIndex = zIndex;
      zIndex++;
    }
    e.style.display = "block";
    hoverMenuShown = id;
  }
}

function hideHoverMenu(id)
{
  hoverMenuShown = "";
  window.setTimeout("hideHoverMenuCallback('" + id + "');", 500);
}

function hideHoverMenuCallback(id)
{
  if(id != hoverMenuShown)
  {
    var e = getElement("menu" + id);
    if(e) e.style.display = "none";
  }
}

function showCompanyPopup()
{
  showPopup("/companyInfo.html", 300, 150);
}

function showImage(url)
{
  showPopup("/image.aspx?url=" + url, 640, 480);
}

function showImageLarge(url)
{
  showPopup("/image.aspx?url=" + url, 875, 750);
}

function showImageForm(url)
{
  showPopup("/image.aspx?url=" + url, 600, 750);
}

function showPopup1(url, width, height)
{
  var left = (screen.width - width) / 2;
  var top = (screen.height - height) / 2;
  window.open(url, "", "width=" + width + ",height=" + height + ",screenX=" + left + ",left=" + left + ",screenY=" + top + ",top=" + top + ",menubar=no,toolbar=no,status=no,scrollbars=yes,location=no,directories=no");
}


function showImageSide(url)
{
  showPopup1("/image.aspx?url=" + url, 720, 450);
}