function getElementsByClass(node, className)
{
  var elements = node.getElementsByTagName('*');
  var ret = new Array();
  for(var i in elements)
    if(elements[i].className == className)
      ret.push(elements[i]);
  return ret;
}

function getDropDownContent(element)
{
  for(var i = 0; i < element.childNodes.length; i++)
  {
    var child = element.childNodes[i];
    if(child.className == 'DropDownContent')
      return child;
  }
  return null;
}

function startDropDown()
{
  var divs = getElementsByClass(document, 'DropDown');
  for(var i in divs)
  {
    var element = divs[i];
    var content = getDropDownContent(element);
    if(content != null)
    {
      element.onmouseover = function()
      {
	getDropDownContent(this).style.visibility = 'visible';
      }
      element.onmouseout = function()
      {
	getDropDownContent(this).style.visibility = 'hidden';
      }
    }
  }
}

function startHover()
{
  imageCache = new Array();
  function cacheImage(path)
  {
    var img = new Image();
    img.src = path;
    imageCache.push(img);
  }

  var hovers = getElementsByClass(document, 'Hover');

  for(var i in hovers)
  {
    var el = hovers[i];

    cacheImage(el.id + '_hover.jpg');
    cacheImage(el.id + '_button.jpg');

    el.onmouseover = function()
    {
      this.src = this.id + '_hover.jpg';
    }
    el.onmouseout = function()
    {
      this.src = this.id + '_button.jpg';
    }
  }
}

function start()
{
  startDropDown();
  startHover();
}

window.onload=start;
