var isNav, isIE, nVer = parseInt(navigator.appVersion.charAt(0));if (nVer >= 4) {isNav = (navigator.appName == "Netscape") ? 1 : 0;isIE = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;}var last = '';
function popup(c,p,id){larghezza = 3 * document.images["att"+p+"_"+id].width+10;altezza = 3 * document.images["att"+p+"_"+id].height+14;if ((isNav) && (nVer < 5)) altezza = altezza + 10;if (isNav) {altezza = altezza + 10;larghezza = larghezza + 15;}if (isIE) {altezza = altezza + 12;larghezza = larghezza + 15;}window.open('/detail.asp?c=' + c + '&p='+ p +'&id='+ id,'zoom','scrollbars=no,resizable=no,width='+larghezza+',height='+altezza+',top='+(screen.availHeight-altezza)/2+',left='+(screen.availWidth-larghezza)/2+',status=no,location=no,toolbar=no');}
function transac(nome,tipo){switch (tipo){case 0:if (nome!=last)  eval('document.'+nome+'.src=off'+nome+'.src');break;case 1:eval('document.'+nome+'.src=on'+nome+'.src');break;case 2:if ((nome!=last)&&(last!='')) eval('document.'+last+'.src=off'+last+'.src');eval('document.'+nome+'.src=on'+nome+'.src');last=nome;break;case 3:eval('document.'+last+'.src=off'+last+'.src');last='';break;default:alert("Errore!");}}
function s(str){window.open('/core/print/default.asp?'+str,'Print','scrollbars=yes,resizable=no,width=630,height=300,top='+(screen.availHeight-300)/2+',left='+(screen.availWidth-630)/2+',status=no,location=no,toolbar=no');}
function i(str){window.open('/core/print/default.asp?'+str,'Send','scrollbars=yes,resizable=no,width=300,height=300,top='+(screen.availHeight-300)/2+',left='+(screen.availWidth-300)/2+',status=no,location=no,toolbar=no');}

var currIndex = 1;

function impostaVisibilita(id, visibilita)
   // "visible" ed "hidden" sono i valori validi da passare alla var visibilita
   {
   if (document.all) document.all['eventi'+id].style.visibility=visibilita;
     else if (document.layers) document.layers['eventi'+id].visibility=visibilita;
     else if (document.getElementById) document.getElementById('eventi'+id).style.visibility=visibilita;}
     
function looppa()
	{
	if (currIndex>0) {
		impostaVisibilita(currIndex, 'hidden');
		impostaVisibilita(currIndex+7, 'hidden');
		if (currIndex<3) currIndex++;
		else currIndex = 1;
		impostaVisibilita(currIndex, 'visible');
		impostaVisibilita(currIndex+7, 'visible');
		}
	else currIndex = 1;
	}
	


function setActiveStyleSheet(title) {
  var i, a, main;
  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;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(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").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;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);




function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}