
/***************************************************************************/  
/************************************** Gestione Finestre ********************/
/***************************************************************************/   
  
  function openNew(url, param) {
  	var win_name="win"+Math.round(Math.random()*9999999); 
  	window.open(url, win_name, param);
  }
  
  function zoom(img, w, h, titolo, code) {   
    if ((typeof titolo) == "undefined") titolo="[zoom]";
    if ((typeof code) == "undefined") code=Math.round(Math.random()*999999999);            
    var w_zoom=open("", "zoom"+(code), "resizable=yes,scrollbars=no,menubar=no,directories=no,location=no,status=yes,toolbar=no,width="+w+",height="+h);
    if (w_zoom!=null) {  // controllo..
      w_zoom.document.writeln('<html><title>'+titolo+'</title><body marginwidth=0 marginheight=0 topmargin="0" rightmargin="0" leftmargin="0" bottommargin="0" bgcolor="#000000"><table width="'+w+'" height="'+h+'"><tr><td valign="middle" align="center"><font face="Arial, Helvetica, Sans-serif" color="#FFFFFF" size="1">loading...</font></td></tr></table><div id="zoom" style="position:absolute; width:1; height:1;  z-index:10; left: 0px;  top: 0px"><img src='+img+' width='+w+' height='+h+'></div></body></html>');
      w_zoom.document.close();
    }    
    return w_zoom;
  }
  
  
/***************************************************************************/  
/************************************** UTILITY Object ********************/
/***************************************************************************/  
  
  function Rnd(n) { // return an integer between 0 and n-1
     return Math.ceil(Math.random()*n)-1
  }
  

 
  
  function getFullYear(d) {
  	return (y=d.getYear()<1000?y+1900:y);
  }
  
  
  function data_odierna() {
  	giorni = new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedi","Venerdì","Sabato");
  	mesi   = new Array("gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre");
	oggi = new Date();
	data_curr=(oggi.getDate()<10?"0":"")+oggi.getDate()+" "+(mesi[oggi.getMonth()])+" "+oggi.getFullYear();
	document.writeln(giorni[(oggi.getDay()/1)]+", "+data_curr);
  }	
  
/***************************************************************************/  
/************************************** ROLLOVER Object ********************/
/***************************************************************************/

function Rollover (img_name, src_off, src_on) {
  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"; 
      
  }
}


function turn_on() { 
  img_obj = eval("window.document.images."+this.name);	
  if (img_obj)  img_obj.src = this.on.src;  
}

function turn_off() {   
     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; 
}