/*
  (C) Upgrade Multimediale Srl
      viale dell'Industria 24/D
      37135 Verona - ITALY
      Tel:  +39 045 8903199
      Fax:  +39 045 8231203  
      @: info@upgrade4.it
      W: http://www.upgrade4.it
         
   Content:  Menu and Rollover managing 
   Type:     Generic
*/

/************* Funzione di rollOver del sesso  *****************************/

 $(document).ready(function(){  	
	
	$(".sexLink div.bloccoSesso.noselected").mouseover(function (){
		img = $(".sexLink div.bloccoSesso.noselected > img").attr("src");
		img = img.replace("WHITE","BLACK");
		$(".sexLink div.bloccoSesso.noselected > img").attr("src", img)
		
	});
	
	$(".sexLink div.bloccoSesso.noselected").mouseout(function (){
		img = $(".sexLink div.bloccoSesso.noselected > img").attr("src");
		img = img.replace("BLACK","WHITE");
		$(".sexLink div.bloccoSesso.noselected > img").attr("src", img)
		
	});
	
 
 });  
 
 
 
/************************************** ROLLOVER Object ********************/

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; 
}
