function popitup(url,width,height)
{
	newwindow=window.open(url,'name','menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width='+width+', height='+height);
	if (window.focus) {newwindow.focus()}
}
function imgpopitup(url)
{
	newwindow=window.open(url,'name','height=280,width=270');
	if (window.focus) {newwindow.focus()}
}

function oggi()
{
	var  d  = new Date ();
	var gs  = d.getDay();
	var gg  = d.getDate();
	var mm  = d.getMonth()+1;
	var aa  = d.getFullYear();
	var hh  = d.getHours();
	var min = d.getMinutes();
	
	var giorni = new Array("Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato");
	var mesi = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto","Settembre",
						"Ottobre","Novembre","Dicembre");

	if (gg < 10)
		gg = "0"+gg;

	if (mm < 10)
		mm = "0"+mm;

	if (hh < 10)
		hh = "0"+hh;

	if (min < 10)
		min = "0"+min;

	document.write (giorni[gs]+ " " +gg+" "+mesi[mm-1]+" "+aa+"  " +hh+ ":" +min);
	


}
function saluto (){
 
             thisDate = new Date()
            ora = thisDate.getHours();
            
            if ( ora <= 12) { salve = "Buon Giorno!";}
            if ( ora > 12 && ora <= 16) { salve = "Buon Pomeriggio!";}
            if ( ora > 16) { salve = "Buona Sera!";}
            document.write(salve);
}
function getHeight(n, d)
{
	if (document.getElementById)
		{
			var h = d;
			var el = document.getElementById(n);
			var tb = el.getElementsByTagName("TABLE")
			if (el.offsetHeight)
				h = el.offsetHeight;
			if (tb.length>0 && tb[0].offsetHeight)
				h = Math.max(h, tb[0].offsetHeight);
			if (el.style.pixelHeight)
				h = Math.max(h, el.style.pixelHeight);
			return h;
		}
	else if (document.all)
		{
			return document.all[n].offsetHeight;
		}
	else if (document.layers)
		{
			return document.layers[n].clip.height;
		}
	else
		return d;
}

function getWidth(n, d)
{
	if (document.getElementById)
		{
			var w = d;
			var el = document.getElementById(n);
			var tb = el.getElementsByTagName("TABLE")
			if (el.offsetWidth)
				w = el.offsetWidth;
			if (tb.length>0 && tb[0].offsetWidth)
				w = Math.max(w, tb[0].offsetWidth);
			if (el.style.pixelWidth)
				w = Math.max(w, el.style.pixelWidth);
			return w;
		}
	else if (document.all)
		{
			return document.all[n].offsetWidth;
		}
	else if (document.layers)
		{
			return document.layers[n].clip.width;
		}
	else
		return d;
}

function setTopLeft(n, t, l)
{
	if (document.getElementById)
		{
			document.getElementById(n).style.left = l;
			document.getElementById(n).style.top = t;
		}
	else if (document.all)
		{
			document.all[n].style.left=l;
			document.all[n].style.top=t;
		}
	else if (document.layers)
		{
			document.layers[n].left = l;
			document.layers[n].top = t;
		}
}

function BW_reload()
{
	location.reload();
}

var glbTipoPagina;
function allineaSinistraPagina(tipoPagina)
{
	if (glbTipoPagina=='standard')
	{
		ht = getHeight('testata', 96);
		wn = getWidth('navigazione', 140);
		setTopLeft('testata', 1, 1);
		setTopLeft('navigazione', 1+ht+1, 1);
		setTopLeft('contenuto', 1+ht+1, 1+wn+1);
	}
	else if (glbTipoPagina=='senza_toolbar')
	{
		ht = getHeight('testata1', 96);
		hn = getHeight('navigazione1', 24);
		setTopLeft('testata1', 1, 1);
		setTopLeft('navigazione1', 1+ht+1, 1);
		setTopLeft('contenuto1', 1+ht+1+hn+1, 1);
	}
}

function centraPagina(tipoPagina)
{
	if (tipoPagina)
	{
		glbTipoPagina = tipoPagina;
	}
	onresize = BW_reload;
	onbeforeprint = allineaSinistraPagina;
	onafterprint = centraPagina;
	
	ww = (document.all)?document.body.clientWidth:window.innerWidth;

	if (glbTipoPagina=='standard')
	{
		wt = getWidth('testata', 620);
		ht = getHeight('testata', 96);
		wn = getWidth('navigazione', 140);
		wc = getWidth('contenuto', 460);
		l = Math.max(0, (ww - (wn+1+wc))/2);
		setTopLeft('testata', 10, l);
		setTopLeft('navigazione', 10+ht+1, l);
		setTopLeft('contenuto', 10+ht+1, l+wn+1);
	}
	else if (glbTipoPagina=='senza_toolbar')
	{
		wt = getWidth('testata1', 620);
		ht = getHeight('testata1', 96);
		wc = getWidth('contenuti1', 600);
		l = Math.max(0, (ww - wc)/2);
		setTopLeft('testata1', 10, l);
		setTopLeft('contenuti1', 10+ht+1, l);
	}
	else if (glbTipoPagina=='senza_toolbar_connavigazione')
	{
		wt = getWidth('testata1', 620);
		ht = getHeight('testata1', 96);
		wn = getWidth('navigazione1', 600);
		hn = getHeight('navigazione1', 24);
		wc = getWidth('contenuti1', 600);
		l = Math.max(0, (ww - Math.max(wn,wc))/2);
		setTopLeft('testata1', 10, l);
		setTopLeft('navigazione1', 10+ht+1, l);
		setTopLeft('contenuti1', 10+ht+1+hn+1, l);
	}
}

function r(c,b,d)
{
	i=c.indexOf(b);
	if(i!=-1)
	{
		s=i+d;
		e=c.indexOf(';',s);
		if(e==-1)
			e=c.length;
		return unescape(c.substring(s,e));
	}
	return '';
}

function MM_reloadPage(init)
{  //reloads the window if Nav4 resized
	if (init==true)
		with (navigator)
		{
			if ((appName=="Netscape")&&(parseInt(appVersion)==4))
			{
    		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
    	}
    }
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
  	location.reload();
}
function via()
{
	MM_reloadPage(true);
	t=r(document.cookie, 'stylesheet=', 11);
	if(t!='')
		document.write('<LINK rel="stylesheet" type="text/css" href="/stylesheet/'+t+'.css">');
}
originalColorArray = new Array();

function changeBg(tr) {
	if (isTrMarked(tr)) return;
	var children = tr.childNodes;
	tmpArray = new Array();
	for (var i=0;i < children.length; i++) {
		tmpArray[i] = tr.children[i].bgColor;
		tr.children[i].bgColor='e2e2e2';
	}
	originalColorArray[tr.rowIndex] = tmpArray;
}

function resetBg(tr) {
	if (isTrMarked(tr)) return;
	tmpArray = originalColorArray[tr.rowIndex];
	var children = tr.childNodes;
	for (var i=0;i < children.length; i++) {
		tr.children[i].bgColor=tmpArray[i];
	}	
}

function isTrMarked(tr) {
	if (tr.children[0].bgColor=='#437ca7') {
		return true;
	}
	return false;
}

function markTr(tr) {
	var children = tr.childNodes;
	var doStyle = true;
	if (isTrMarked(tr)) {
		unMarkTr(tr);
	} else {
		tmpArray = new Array();
		for (var i=0;i < children.length; i++) {
			tr.children[i].bgColor='437CA7';
			if (tr.children[i].style.color == "red") {
				tr.children[i].style.color="ffff00";
			} else {
				tr.children[i].style.color="ffffff";
			}
			if (tr.children[i].childNodes[0].nodeName == "A") {
				tr.children[i].childNodes[0].style.color="ffffff";
			}
		}
	}
}

function unMarkTr(tr) {
	var children = tr.childNodes;
	tmpArray = originalColorArray[tr.rowIndex];
	for (var i=0;i < children.length; i++) {
		tr.children[i].bgColor=tmpArray[i];
		if (tr.children[i].style.color == "#ffff00") {
			tr.children[i].style.color="red";
		} else {
			tr.children[i].style.color="000000";
		}
		if (tr.children[i].childNodes[0].nodeName == "A") {
			tr.children[i].childNodes[0].style.color="305E80";
		}		
	}
}




function doNothing() {}