//menu cubi
var a = new Array();
a.push("m1");
a.push("m2");
a.push("m3");
a.push("m4");
a.push("m5");
a.push("m6");

function mopen(d) {
for (i=0; i<a.length; i++) {
	var ogg = document.getElementById(a[i]);
	csty = ogg.style.display;
	if ( a[i] == d && csty != "inline"){ sl="inline";} else {sl="none";}
	ogg.style.display = sl;}
}
//fine menu cubi


//window open 4 download
function wd_old(fn,fd) {
window.open("download.php?fn="+fn+"&d="+fd,"Download","height=500,width=500,navigation=no");
}
//non apre popup, inizia direttamente download
function wd(fn,fd) {
window.open("downloadnow.php?fn="+fn+"&d="+fd,"Downloadnow","resizable=1,location=0,menubar=0,toolbar=0");
}

//apre popup predownload 
//function wd(fn,fd) {
//window.open("download.php?fn="+fn+"&d="+fd,"Download","resizable=1,location=0,menubar=0,toolbar=0");
//}
function wd_diretto(fn,fd) {
window.open("downloadnow.php?fn="+fn+"&d="+fd,"Downloadnow","resizable=1,location=0,menubar=0,toolbar=0");
}

function popup(url,f) {
	if (!f) f="height=500,width=500,navigation=no";
window.open(url,"PopUP",f);
}

function popupzoom(url,f,descrizione) {
	if (!f) f="height=500,width=500,navigation=no";
window.open("popupzoom.php?u="+url+"&d="+descrizione,"PopUP",f);
}

function popupzoomhr(url,f,descrizione) {
	if (!f) f="height=500,width=500,navigation=no";
window.open("popupzoomhr.php?u="+url+"&d="+descrizione,"PopUP",f);
}


function popupcenter(url,f) {
	if (!f) f="height=500,width=500,navigation=no";
window.open("popupcenter.php?u="+url,"PopUP",f);
}


// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//fonts enlargements
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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
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 rrdk() {
  var cookie = readCookie("act-fontsize");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}
function wwrdk() {
  var title = getActiveStyleSheet();
  createCookie("act-fontsize", title, 365);
}
var cookie = readCookie("act-fontsize");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

function alternateRowColors() {
	var className = 'hell';
	var rowcolor = '#eeeeee';
	var rowcolor1 = '#dedede'; 
	var rows, arow;
	var tables = document.getElementsByTagName("table");
	var rowCount = 0;
	for(var i=0;i<tables.length;i++) {
		//dump(tables.item(i).className + " " + tables.item(i).nodeName + "\n");
		if( tables.item(i).className != className) {
			atable = tables.item(i);
			rows = atable.getElementsByTagName("tr");
			for(var j=0;j<rows.length;j++) {
				arow = rows.item(j);
				if(arow.nodeName == "TR") {
					if(rowCount % 2) {
						arow.style.backgroundColor = rowcolor;
					} else {
						arow.style.backgroundColor = rowcolor1;
						// default case
					}
					rowCount++;
				}
			}
			rowCount = 0;
		}
	}
}

//scrolling left menu
/*
function makeStatic() {
yvar = 119;
wvar = 450;
msty = document.getElementById("menu_dep");
sctop = document.body.scrollTop;
eiw = document.body.offsetWidth/2; nnw = window.innerWidth/2;
eih = document.body.clientHeight; nnh = window.innerHeight;
mleft = msty.offsetLeft; mtop = msty.offsetTop ;topm = yvar;
version = navigator.userAgent.toLowerCase(); htab = wvar; 
if (version.indexOf("gecko")!=-1) {hwin = nnh; wwin = nnw}
else {hwin = eih; wwin = eiw}
if (sctop < topm) ttop = topm;
else { if (hwin > wvar) ttop = sctop;
else ttop = sctop + hwin - wvar - 12}
ydif = Math.sqrt(Math.abs(ttop - mtop));
if (ttop > mtop) yste = mtop + ydif;
else yste = mtop - ydif;
document.getElementById("menu_dep").style.top = yste;
if (htab > wwin) scwid = htab ;
tlef = wwin - htab ;
document.getElementById("menu_dep").style.left = tlef;
document.getElementById("livellone").style.left = tlef;
setTimeout("makeStatic()",0);
}
*/

