// -------------  sezione attivazione dello stile e ricarica pagina --------------------
function setActiveStyleSheet(title) {
  var i, a, main, exist;
  
  // dobbiamo prima prelevare il cookie per ricostruire lo stile ibrido 
  exist = document.cookie.indexOf("contrasto");
  
	    if  (exist != -1 && title == "alternativo")  
        { 
		 title = "ibrido";
		 }
	exist = document.cookie.indexOf("alternativo");
        if  (exist != -1 && title == "contrasto")  
        { 
		 title = "ibrido";
		 }
  
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }

setCookie('Molinari-syle', title, '1');  
}



// -------------  sezione memorizzazione stile visualizzazione --------------------
function setCookie(NameOfCookie, value, expiredays)
{
var ExpireDate = new Date();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

document.cookie = NameOfCookie + '=' + value + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());


if (navigator.appName == "Microsoft Internet Explorer")
	{ var brow = 0;}
else
	{ var brow = 1;}

}



// -------------  sezione controllo cookie esistente --------------------
function getCookie(NameOfCookie)
{ 
if (document.cookie.length > 0)
	{ 
	   var style = "stile";
	   exist = document.cookie.indexOf(style);
	   if  (exist != -1)  
	        { 
		 setActiveStyleSheet(style);
		}

	   var style = "alternativo";
	   exist = document.cookie.indexOf(style);
	   if  (exist != -1)  
	        { 
		 setActiveStyleSheet(style);
		}

	   var style = "contrasto";
	   exist = document.cookie.indexOf(style);
	   if  (exist != -1)  
	        { 
		 setActiveStyleSheet(style);
		}
		var style = "ibrido";
	   exist = document.cookie.indexOf(style);
	   if  (exist != -1)  
	        { 
		 setActiveStyleSheet(style);
		}
	}
else
	{return null;}
}



// -------------  sezione stampa data --------------------
function fun_data()
{
var DayOfWeek = new Array('Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato');
var MonthName = new Array('01','02','03','04','05','06','07','08','09','10','11','12');
var theDate = new Date();

var anno = theDate.getYear();

if (anno > 100 && anno < 2000)
	{anno = anno -100;}
if (anno > 2000 )
	{anno = anno +0;}
	
document.write(DayOfWeek[theDate.getDay()] + ' ' + theDate.getDate() + '/' + MonthName[theDate.getMonth()] +'/' + anno );
} 


// -------------  sezione stampa percorso --------------------
function print_path()  {
	document.write('<div class="sezione">');
	my_path = location.pathname;
	my_path = my_path.replace(".htm"," ");
	my_path = my_path.replace(".asp"," ");
	document.write('PERCORSO: ', my_path);
	document.write('</div>');
}         