var iex = document.all ? true : false;
var pageWidth = 1000;	//site specific
var curDD = null;
var Menus = new Object();

function newImage(src) {
  img = new Image();
  img.src = src;
  return img;
}

function imageSwap(img, obj, div) {
  document.images[img].src = eval(obj + '.src');
}

function createDD(name, left, rollover) {
  Menus[name] = new DD(name, left, rollover);
}

function hideDD() {
  if(curDD != null) {
    Menus[curDD].hideIt();
	curDD = null;
} }

DD = function(name, left, rollover) {
  this.name = name;
  this.left = left;
  this.rollover = rollover;
  this.timer = null;
  this.obj = name + 'Object'; 
  eval(this.obj + '=this');
}

DD.prototype.show = function() {
  var windowWidth = iex ? document.body.clientWidth : window.innerWidth-20;		//subtract 20 for the scrollbar
  var leftOffset = Math.floor((windowWidth-pageWidth)/2) + this.left;
  clearTimeout(this.timer);
  document.getElementById(this.name).style.left = leftOffset + 'px';
  document.getElementById(this.name).style.display = 'block';
  imageSwap(this.rollover, this.rollover + '_on');
  curDD = this.name;
}

DD.prototype.hide = function() {
  this.timer = setTimeout(this.obj + '.hideIt()', 500);
}

DD.prototype.hideIt = function() {
  document.getElementById(this.name).style.display = 'none';
  imageSwap(this.rollover, this.rollover + '_off');
}