
function RolloverMenu(varName, barType, barSize, lastClass, lastAlign, imgsPath, fileExt) {
  this.varName    = varName;
  this.isVertical = (barType == 'vert')
  this.barSize    = barSize;
  this.lastClass  = lastClass;
  this.lastAlign  = lastAlign;

  this.imgsPath = (typeof imgsPath == 'undefined') ? 'images/' : imgsPath;
  this.fileExt  = (typeof fileExt  == 'undefined') ? '.jpg'    : fileExt;

  this.items   = new Array();
  this.indices = new Array();
  this.isRollo = new Array();

  this.addEntry = romAddEntry;
  this.addSpace = romAddSpace;
  this.onMouse  = romMouseEvent;
  this.srcHTML  = romSourceHTML;
  }

function romAddEntry(name, size, helpText, linkTo) {
  var i = this.items.length;
  var link = ( (typeof linkTo == 'undefined') ? name + '.htm' : linkTo );
  var wide = (this.isVertical) ? this.barSize : size;
  var high = (this.isVertical) ? size : this.barSize;
  this.items[i] = new Rollover(this.varName + '.items[' + i + ']', name, link, helpText, wide, high, 'down', this.imgsPath, this.fileExt);
  this.indices[name] = i;
  this.isRollo[i] = true;
  preLoader.addObject(this.items[i]);
  }

function romAddSpace(name, size) {
  var i = this.items.length;
  this.items[i] = new Array();
  this.items[i].name = name;
  this.items[i].width  = (this.isVertical) ? this.barSize : size;
  this.items[i].height = (this.isVertical) ? size : this.barSize;
  this.isRollo[i] = false;
  }

function romMouseEvent(evt) {
  var elem = (evt.target) ? evt.target : ( (evt.srcElement) ? evt.srcElement : null );
  if (elem && (elem.name != this.pickName)) {
    if (evt.type == 'mouseover') {
      this.items[this.indices[this.pickName]].showImage('out');
      }
    else if (evt.type == 'mouseout') {
      this.items[this.indices[this.pickName]].showImage('down');
      }
    }

  return true;
  }

function romSourceHTML(pickName, isDisabled) {
  var i, t;

  this.pickName = ((typeof pickName == 'undefined') ? '' : pickName);

  var useFull = (typeof this.lastClass != 'undefined');
  var iLast   = this.items.length - 1;
  var str     = '<table border=0 cellpadding=0 cellspacing=0';

  if ( !(isDisabled || (this.pickName == '')) ) {
    var func = '="return ' + this.varName + '.onMouse(event);"';
    str += ' onMouseOver' + func + ' onMouseOut' + func;
    }

  if (this.isVertical) {
    str += 'width=' + this.barSize + ((useFull) ? ' height="100%"' : '') + '>\n';
    }
  else {
    str += 'height=' + this.barSize + ((useFull) ? ' width="100%"' : '') + '>\n<tr>\n';
    }

  for (i = 0; i <= iLast ; i++) {
    t = this.items[i];
    if (this.isVertical) {
      if ((i == iLast) && useFull) {
        str += '<tr><td  valign="' + this.lastAlign + '" class="' + this.lastClass + '">\n';
        }
      else {
        str += '<tr height=' + t.height + '><td>\n';
        }
      }
    else {
      if ((i == iLast) && useFull) {
        str += '<td  align="' + this.lastAlign + '" class="' + this.lastClass + '">\n';
        }
      else {
        str += '<td>\n';
        }
      }

    if (this.isRollo[i]) {
      str += (t.name == pickName) ? t.srcHTML('fixed', 'down') : t.srcHTML();
      }
    else {
      str += '<img src="' + this.imgsPath + t.name + this.fileExt + '" width=' + t.width + ' height=' + t.height + '>';
      }
    str += '</td>' + ( (this.isVertical) ? '</tr>\n' : '\n' );
    }

  if (!this.isVertical) str += '</tr>\n';
  return str + '</table>\n';
  }

