//acceso = "t_presentazione";

	function apri_finestra_nobar(url, nomeWindow, lunghezza, altezza) {
		nome = nomeWindow;
		// ------------------------------------------
		// Altezza della finestra [numero]
		if (altezza == null) {
			altezza = 600;
		}
		// ------------------------------------------
		// Lunghezza della finestra [numero]
		if (lunghezza == null) {
			lunghezza = 800;
		}	
		// ------------------------------------------
		// Posiziona finestra al centro [true|false]
		centra = true;
		// ------------------------------------------
		// Distanza dal margine sinistro [numero]
		posX = 100;
		// ------------------------------------------
		// Distanza dal margine destro [numero]
		posY = 100;
		// ------------------------------------------
		// Visualizza a pieno schermo - solo IE4
		fullscreen='no';
		// ------------------------------------------
		// Ridimensionabile [yes|no]
		resizable='yes';
		// ------------------------------------------
		// Visualizza barra del menu [yes|no]
		menuB='no';
		// ------------------------------------------
		// Visualizza barre di scorrimento [yes|no]
		scrollB='yes';	
		// ------------------------------------------
		// Visualizza barra di stato [yes|no]
		statusB='no';	
		// ------------------------------------------
	
		if (centra) {
			posX = Math.round((screen.width - lunghezza)/2);
			posY = Math.round((screen.height - altezza)/2);		
		}
	
		caratteristiche = "menubar=" + menuB;
		caratteristiche += ",scrollbars=" + scrollB;
		caratteristiche += ",statusbar=" + statusB;		//Netscape
		caratteristiche += ",status=" + statusB;		//IE4
		caratteristiche += ",height=" + altezza;
		caratteristiche += ",width=" + lunghezza;
		caratteristiche += ",screenX=" + posX;			//Netscape
		caratteristiche += ",left=" + posX;			//IE4
		caratteristiche += ",screenY=" + posY;			//Netscape
		caratteristiche += ",top=" + posY;			//IE4
		caratteristiche += ",fullscreen=" + fullscreen; 	//solo IE4
		caratteristiche += ",resizable=" + resizable;
	
		popupWindow = window.open(url, nome, caratteristiche);
		popupWindow.opener = self;
	
	}
	
// rollover
	//acceso = null	
	
	function rollover_in(nome) {
		//alert(nome);		
		if (acceso != nome) {
			document.images[nome].src = "./img/"+nome+"_h.jpg";
		}		
	}
	
	function rollover_out(nome) {
		//alert(nome);
		if (acceso != nome) {
			document.images[nome].src = "./img/"+nome+".jpg";
		}
	}
	
	function seleziona(nome) {
		//alert(document.images[nome].onmouseout);		
		var fine_menu = 10
		acceso = nome;
		//document.images[nome].onmouseout = ""
		//document.images.length
		for (var i=1; i<=fine_menu; i++) {
			//&& i != fine_menu
			if (document.getElementById(i).name != nome) {				
				//document.getElementById(i).name.onmouseout = rollover_out("'"+document.getElementById(i).name+"'");
				//alert(document.getElementById(i).name.onmouseout);
				document.getElementById(i).src = "./img/"+document.getElementById(i).name+".jpg";
			}
		}		
		document.images[nome].src = "./img/"+nome+"_h.jpg";
		nome_pag = nome.replace("t_","")+".html"
		document.dx.location.href = nome_pag
	}

// fine rollover

// inizio calendario
var mese;
 var anno;

 
function fill_table(m,month_length,y,m1)
{ 
  var myc = ""
  var myc1  
  day = 1
//**********************************************************************//
// per variare i colori del calendario agire sulle seguenti variabili 
  
  var c1 = "Blue"      // colore del nome dei giorni della settimana; 
  var c2 = "Red"       // colore del nome del giorno "dom";
  var c4 = "#993300"   // colore dell'intestazione (nome mese e anno);
  var c5 = "#009900"   // colore del giorno corrente;

//**********************************************************************//
  
  var data_oggi = new Date()
  var gg_oggi = data_oggi.getDate()
  var mm_oggi = data_oggi.getMonth()
  var aa_oggi = data_oggi.getFullYear()
  //today = data_oggi.getDay()
  
  //var hours = data_oggi.getHours()
  //var minutes = data_oggi.getMinutes()
  //var seconds = data_oggi.getSeconds()
  
  //if (minutes <= 9)
  //  minutes = "0" + minutes;

  //if (seconds <= 9)
  //   seconds = "0" + seconds;
  
  //if (start_day == 0)
  //   start_day = 1;
  
  myc = myc + ("<table class='calendario'>")
  //" ore "+hours+":"+minutes+":"+seconds+
  myc = myc + ("<TR><TD COLSPAN=7 ALIGN=center class='tit_calendario'>"+m+"   "+y+"</TR><TR>")

  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Lun</TD>")
  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Mar</TD>")
  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Mer</TD>")
  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Gio</TD>")
  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Ven</TD>")
  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Sab</TD>")
  myc = myc + ("<TD class='calendario' ALIGN=center WIDTH=28>Dom</TD>")
      
  myc = myc + ("</TR><TR>")
  for (var i=1;i<start_day;i++){
       myc = myc + ("<td></td>")
  }
  
  for (var i=start_day;i<8;i++){
	   	      
	   if ((day == gg_oggi) && (m1 == mm_oggi) && (y == aa_oggi)) {
	       myc1 = ("<TD class='oggi' ALIGN=center>"+day+"</TD>") }   
	   else {
	       myc1 = ("<TD class='oggi_no' ALIGN=center>"+day+"</TD>")
		}
		   
	   myc = myc + myc1
       day++
  }
  myc = myc + ("</TR><TR>")

  
  while (day <= month_length) {

     for (var i=1;i<=7 && day<=month_length;i++){
	       
		  if ((day == gg_oggi) && (m1 == mm_oggi) && (y == aa_oggi)) {
	           myc1 = ("<TD class='oggi' ALIGN=center>"+day+"</TD>") }   
	      else {
	           myc1 = ("<TD class='oggi_no' ALIGN=center>"+day+"</TD>")
		  }

	      myc = myc + myc1
          day++

     }
	 
     myc = myc + ("</TR><TR>")

  }
  myc = myc + ("</TR></TABLE><BR>")
  
  if (document.layers){
      document.layers.bc.document.write(myc)
	  document.layers.bc.document.close()
   }
  else if (document.all)
      bc.innerHTML=myc
	  setTimeout("carica_mese(0)",1000);
  
}

 
function carica_mese(n)
{
 
 if (!document.layers&&!document.all)
 return
 
 var mydate = new Date()
 var year = mydate.getFullYear()
 var month = mydate.getMonth()
  
 if (month == 0) {
   today= new Date("January 1, "+year)
   start_day = today.getDay()
   fill_table("Gennaio",31,year,month) }

 if (month == 1) {
   today= new Date("February 1, "+year)
   start_day = today.getDay()
   fill_table("Febbraio",28,year,month) }
   
 if (month == 2) {
   today= new Date("March 1, "+year)
   start_day = today.getDay()
   fill_table("Marzo",31,year,month) }
 
 if (month == 3) {
   today= new Date("April 1, "+year)
   start_day = today.getDay()
   fill_table("Aprile",30,year,month) } 
   
 if (month == 4) {
   today= new Date("May 1, "+year)
   start_day = today.getDay()
   fill_table("Maggio",31,year,month) }      
 
 if (month == 5) {
   today= new Date("June 1, "+year)
   start_day = today.getDay()
   fill_table("Giugno",30,year,month) }
 
 if (month == 6) {
   today= new Date("July 1, "+year)
   start_day = today.getDay()
   fill_table("Luglio",31,year,month) }

 if (month == 7) {
   today= new Date("August 1, "+year)
   start_day = today.getDay()
   fill_table("Agosto",31,year,month) }
 
 if (month == 8) {
   today= new Date("September 1, "+year)
   start_day = today.getDay()
   fill_table("Settembre",30,year,month) }
 
 if (month == 9) {
   today= new Date("October 1, "+year)
   start_day = today.getDay()
   fill_table("Ottobre",31,year,month) }
 
 if (month == 10) {
   today= new Date("November 1, "+year)
   start_day = today.getDay()
   fill_table("Novembre",30,year,month) }
 
 if (month == 11) {
   today= new Date("December 1, "+year)
   start_day = today.getDay()
   fill_table("Dicembre",31,year,month) }
        
 mese = month;	 
 
}

//fine calendario


function cambia_colore(id){			
	
	document.getElementById("f1").style.background="#334477";
	document.getElementById("f2").style.background="#334477";
	document.getElementById("f3").style.background="#334477";
	document.getElementById("f4").style.background="#334477";
	document.getElementById("f5").style.background="#334477";
	document.getElementById("f6").style.background="#334477";
	//document.getElementById("f7").style.background="#334477";
	//document.getElementById("f8").style.background="#334477";
	//document.getElementById("f9").style.background="#334477";
	
	document.getElementById(id).style.background="#FFE457";//#CDF6D0";			

	
	//spazio_dx.location.href=pag
}

function dimensione_schermo() {
	/*
	window.resizeTo(800,600);
	
	document.getElementById("tab-principale").width=770;
	document.getElementById("principale").width=770;
	document.getElementById("sinistra").width=130;
	document.getElementById("centro").width=400;
	document.getElementById("destra").width=130;
	document.getElementById("menu1").width=60;
	document.getElementById("menu2").width=60;
	document.getElementById("menu3").width=60;
	document.getElementById("menu4").width=100;
	document.getElementById("menu5").width=60;
	document.getElementById("menu6").width=60;
	document.getElementById("banner_top").src="./img/800/banner_top.jpg";
	document.getElementById("banner_left").src="./img/800/banner_left.jpg";
	document.getElementById("banner_right").src="./img/800/banner_right.jpg";		
	*/
	
	/*
	//OK
	dim_sch = screen.width
	if (dim_sch == 800) {
		document.getElementById("tab-principale").width=770;
		document.getElementById("principale").width=770;
		document.getElementById("sinistra").width=130;
		document.getElementById("centro").width=400;
		document.getElementById("destra").width=130;
		document.getElementById("menu1").width=60;
		document.getElementById("menu2").width=60;
		document.getElementById("menu3").width=60;
		document.getElementById("menu4").width=100;
		document.getElementById("menu5").width=60;
		document.getElementById("menu6").width=60;
		document.getElementById("banner_top").src="./img/800/banner_top.jpg";
		document.getElementById("banner_left").src="./img/800/banner_left.jpg";
		document.getElementById("banner_right").src="./img/800/banner_right.jpg";		
	} else {
		document.getElementById("tab-principale").width=1000;
		document.getElementById("principale").width=1000;
		document.getElementById("sinistra").width=150;
		document.getElementById("centro").width=700;
		document.getElementById("destra").width=150;
		document.getElementById("menu1").width=120;
		document.getElementById("menu2").width=120;
		document.getElementById("menu3").width=110;
		document.getElementById("menu4").width=130;
		document.getElementById("menu5").width=110;
		document.getElementById("menu6").width=110;
		document.getElementById("banner_top").src="./img/1024/banner_top.jpg";
		document.getElementById("banner_left").src="./img/1024/banner_left.jpg";
		document.getElementById("banner_right").src="./img/1024/banner_right.jpg";
	}
	*/
	
	
	/* Corretto sostituire 100 con 800 */
	
	dim_sch = screen.width
	if (dim_sch == 100) {
		document.getElementById("tab-principale").width=770;
		document.getElementById("principale").width=770;
		document.getElementById("sinistra").width=130;
		document.getElementById("centro").width=400;
		document.getElementById("destra").width=130;		
		document.getElementById("banner_top").src="./img/800/banner_top.jpg";
	} else {
		document.getElementById("tab-principale").width=1000;
		document.getElementById("principale").width=1000;
		document.getElementById("sinistra").width=150;
		document.getElementById("centro").width=700;
		document.getElementById("destra").width=150;
		document.getElementById("banner_top").src="./img/1024/banner_top.jpg";
	}
	
}

function dimensione_homepage() {
	/*
	window.resizeTo(800,600);
	document.getElementById("home").src="./img/800/home.jpg";
	*/
	
	/* Corretto sostituire 100 con 800 */
	
	
	dim_sch = screen.width
	if (dim_sch == 100) {
		document.getElementById("home").src="./img/800/home.jpg";		
	} else {		
		document.getElementById("home").src="./img/1024/home.jpg";
	}
	
	//CROCIERA POPUP
	//apri_finestra_nobar("home_popup.html", "pubbl", 630, 570);
}

function invia_form(pag,nome_form) {
	//alert(pag);
	str = "document."+nome_form+".action='"+pag+"';"
	str2 = "document."+nome_form+".submit()"+";"
	eval(str);
	eval(str2);
}

function controllo_sintassi_cf(stringa, pattern)
{
	var reg = new RegExp(pattern);
	var result = reg.test(stringa);
	return result;
}

function scelta_mess(messaggio,pag) {
	pass = confirm(messaggio)
	if (pass == 1 && pag.length != 0) {		
		//alert(pag);
		invia_form(pag,"form1");
	}
}

function scelta_mess2(messaggio,pag) {
	pass = confirm(messaggio)
	if (pass == 1 && pag.length != 0) {		
		//alert(pag);
		self.location.href=pag;
	}
}
