/*** colors ***/
var overcolor = '#800';
var outcolor  = '#000';

/*** mouseover, out functions ***/
function over(elem) { elem.style.color = overcolor; }
function out(elem)  { elem.style.color = outcolor;  }

/** object representing state of mouse vs menu **/
function State(id) {                                //  define state object
 this.id = id;
 this.elem = document.getElementById(this.id);      // get primary tab dom element
 this.major = false;                                // primary tab state
 this.minor = false;                                // menu tab state
 this.menuid = this.id + 'menu';                    // dropmenu id is main id concat with 'mrnu'
 this.menu = document.getElementById(this.menuid);  // get dropment dom element
 this.menu.style.zIndex     = 4;                    // dropmenu on top
 this.menu.style.position   = 'absolute';
 this.menu.style.left = this.elem.offsetLeft  + 'px';
 this.menu.style.top  = this.elem.offsetTop + 35 + 'px'; 
 this.menu.style.visibility = "hidden";
 this.menu.style.backgroundColor = '#ffffff';          // set background for dropmenu
}  //  define state object

/*** some functions in object State ***/
State.prototype.mouseOff = function () {  // true if mouse not over either menu or submenu
   if ( (!this.major)
      &&(!this.minor)  )   return true; }
State.prototype.turnon = function () {
  this.elem.style.color = overcolor;
  this.menu.style.visibility = "visible"; }
State.prototype.turnoff = function () {
  this.elem.style.color = outcolor;
  if ( this.mouseOff() ) this.menu.style.visibility = "hidden"; }
    
/*** mouseover, out functions for button and drop menus ***/
function turnonTab(id) {   // on mouse over primary menu item
  state = states[id];      // get state object (State)of this primary menu item
  state.major = true;      // true means mouse is over button
  state.turnon();  }       // turn drop menu on
function turnonMenu(id) {  //  on mouse over drop menu group
  id = id.substring(0,id.indexOf('menu'));  // get primary id from menu id
  state = states[id];
  state.minor = true;
  state.turnon();  }
function turnoffTab(id) {  //  on mouse out primary menu item
  state = states[id];
  state.major = false;
  state.turnoff();  }
function turnoffMenu(id) {  //  on mouse out drop menu group
  id = id.substring(0,id.indexOf('menu'));
  state = states[id];
  state.minor = false;
  state.turnoff();  }

/** arrays to hold various menu entities **/
var states = new Array();  //  holds the state objects
var urls   = new Array();  //  holds the urls

// get new page
function send(item) {
  location.href = urls[item]; }	
