function Rollover (img_name, src_off, src_on, hierarchy ) {
  if (document.images) { // ! (NS2 || IE3)
      this.on   = new Image(); //this.on.src  = src_off.replace(/0./,"1.");
      this.on.src  = src_on;
      this.off  = new Image(); this.off.src = src_off;
      this.name = img_name;
      this.turn_on   = turn_on;
      this.turn_off  = turn_off;
      this.status    = "OFF"; 
      this.hierarchy = (hierarchy)?hierarchy:""; 
  }
}


function turn_on() {           
	       
  if (NS && this.hierarchy!="")       //img_obj = eval("window.document."+this.hierarchy.replace(/\./g,".document.")+".document.images."+this.name);
      img_obj = eval(this.hierarchy+".images."+this.name);
  else          img_obj = eval("window.document.images."+this.name);	
  if (img_obj)  img_obj.src = this.on.src;
  
}

function turn_off() {   
  if (NS && this.hierarchy!="")      img_obj = eval(this.hierarchy+".images."+this.name);
  else         img_obj = eval("window.document.images."+this.name);	
  if (img_obj) img_obj.src = this.off.src;

  
}

/************************************** MENU  Object ********************/

function Menu() {    

  this.selected = null; // nessun elemento selezionato
  this.on       = on;  // turn on  an item
  this.off      = off; // turn off an item
  this.reset_menu         = reset_menu;  // menu reset
  this.sel           = sel;    // select an item and turn off the previus selected
  this.select        = select; // just select an item whithout turning off the previous selected
  this.selected_item = selected_item; // return the selected item
  this.turn_off_current = turn_off_current; // turn off the selected item
}


function on(roller) {                   
  if (this.selected != roller)  roller.turn_on();  
}

function off(roller){
  if (this.selected != roller)  roller.turn_off();
}                  

function turn_off_current() {
  this.selected.turn_off();
}

function reset_menu() {
 if (this.selected != null) {	
  this.selected.turn_off();
  this.selected = null;      
 } 
}


function sel(roller){
  if (this.selected != roller) {
     if (this.selected!=null) this.selected.turn_off();
     this.selected = roller;
  }
}

function selected_item() {
  return this.selected;
}

function select(item) {
  this.selected=item; 
}

