// JavaScript Document
function hidemenu() {
	var maxi=4;
	if(document.getElementById) {
		for (i=1; i<=maxi; i++) {
			temp=document.getElementById("sub" + i);
			temp.style.display="none";
		}
	}
}
function togglemenu(arg) {
	if(document.getElementById) {
		target=document.getElementById(arg);
		if(target.style.display=="none") {
			hidemenu();
			target.style.display="block";
		} else {
			target.style.display="none";
		}
	}
}
function toggle(arg) {
	if(document.getElementById) {
		target=document.getElementById(arg);
		if(target.style.display=="none") {
			target.style.display="block";
		} else {
			target.style.display="none";
		}
	}
}
function show(arg) {
	if(document.getElementById) {
		target=document.getElementById(arg);
		target.style.display="block";
	}
}
function hide(arg) {
	if(document.getElementById) {
		target=document.getElementById(arg);
		target.style.display="none";
	}
}
function turnon(arg, color, bgcolor) {
	if(document.getElementById) {
		target=document.getElementById(arg);
		target.style.color=color;
		target.style.backgroundColor=bgcolor;
	}
}
function turnoff(arg) {
	if(document.getElementById) {
		target=document.getElementById(arg);
		target.style.color="";
		target.style.backgroundColor="";
	}
}
// switch styles 
// Thank's a lot for this awesome functions to:
// Paul Snowden :: idontsmoke.co.uk/
// Jeffrey Zeldman :: www.alistapart.com | www.zeldman.com
// Eric Meyer :: www.meyerweb.com

// This script based on Paul Snowden's work described on A List Apart
// http://www.alistapart.com/stories/alternate/

// switch styles

function setActiveStyleSheet(title) {
  var i, a, main;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title") &&
        !a.disabled
        ) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("rel").indexOf("alt") == -1 &&
        a.getAttribute("title")
        ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
function restore() {
  var cookie = screen //readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}
window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  if(title!="print") {
  	createCookie("style", title, 365);
  }
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

//////////////

/*var success=0; cRef=""; cRefType=""; cPage="";
var L10qstr,L10pc,L10ref,L10a,L10pg; L10pg=document.URL.toString(); L10ref=document.referrer;
if(top.document.location==document.referrer || (document.referrer == "" && top.document.location != "")) {L10ref=top.document.referrer;}
L10qStr = "pg="+escape(L10pg)+"&ref="+escape(L10ref)+"&os="+escape(navigator.userAgent)+"&nn="+escape(navigator.appName)+"&nv="+escape(navigator.appVersion)+"&nl="+escape(navigator.language)+"&sl="+escape(navigator.systemLanguage)+"&sa="+success+"&cR="+escape(cRef)+"&cRT="+escape(cRefType)+"&cPg="+escape(cPage);
if(navigator.appVersion.substring(0,1) > "3") {
	L10d = new Date(); L10qStr = L10qStr+"&cd="+screen.colorDepth+"&sx="+screen.width+"&sy="+screen.height+"&tz="+L10d.getTimezoneOffset();
}
if((location.href.substr(0,6)=="https:") || (location.href.substr(0,6)=="HTTPS:")) { 
	L10pc="https"; 
} else { 
	L10pc="http"; 
}*/

//Inizio funzioni per ingrandire il carattere
ok = (document.styleSheets) ? 1 : 0;

IE = ((ind1 = navigator.appVersion.indexOf("MSIE")) > -1) ? 1 : 0;
IE4 = (IE && document.all) ? 1:0;

NN = (navigator.appName.indexOf("Netscape")>-1) ? 1 : 0;
NN4 = (NN && document.layers) ? 1 : 0;
NN6 = (NN && document.getElementById) ? 1:0;

if(ok) {
  if(IE4) stile = document.styleSheets[0].rules
  if(NN6) stile = document.styleSheets[0].cssRules 
}

function aumenta() {
	if(ok) {
	var size = stile[0].style.fontSize.substring(0,31)
	var dimFont = parseInt(size,10)
	dimFont += 2;
	{
		if (dimFont > 16) dimFont = 16;
	}
  	stile[0].style.fontSize = dimFont + 'px';	
	}
	
	else
  alert("l'oggetto styleSheets\nNON\nč supportato")
}
function diminuisci() {
	if(ok) {
	var size = stile[0].style.fontSize.substring(0,2)
	var dimFont = parseInt(size,10)
	dimFont -= 2;
	{
		if (dimFont < 8) dimFont = 8;
	}
  	stile[0].style.fontSize = dimFont + 'px';	
	}
	
	else
  alert("l'oggetto styleSheets\nNON\nč supportato")
}
//fine funzioni per ingrandire il carattere
