function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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;
}

function MM_displayStatusMsg(msgStr) { //v1.0
	status=msgStr;
	document.MM_returnValue = true;
}

function swap(){
	var i,j=0,x,a=swap.arguments;document.sr=new Array; for(i=0;i<(a.length-1);i+=2)
	if ((x=find(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+1];}
}

function swaprest(){
	var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preload(){
	var d=document; if(d.images){ if(!d.p) d.p=new Array();
	var i,j=d.p.length,a=preload.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function find(n,d){
	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=find(n,d.layers[i].document); return x;
}

function send(n){
	var f=find(n); f.submit();
}

function popup(i,n,p){
	window.open(i,n,p);
}

function changebg(obj,color){
	obj.style.backgroundColor=color
}

function imgprint(img){
	var popup;
	popup=open('','popup','width=580,height=360,menubar=yes');
	with (popup.document){
	open("text/html", "replace");
	write('<html><head><title>Grafico programmi e consumi</title>\n');
	write('<link rel="stylesheet" href="/css/css.css" type="text/css"></head>\n');
	write('<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 onload="self.focus()">\n');
	write('<center><img src="'+img+'" alt="grafico"><br><br class="break">\n');
	write('<a style="" href="#" onClick="window.print();return false">Stampa</a></center>\n');
	write('</body></html>');
	close()}
}

function zoom(img,w,h,tit){
	var popup,dim='width='+w+',height='+h;
	popup=open('','popup',dim);
	if(!tit) tit='Zoom';
	with (popup.document){
	open("text/html", "replace");
	write('<html><head><title>'+tit+'</title></head>\n');
	write('<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onload="self.focus()">\n');
	write('<a href="javascript:self.close()" title="Click to close"><img src="'+img+'" width='+w+' height='+h+' border=0></a>\n');
	write('</body></html>');
	close()}
}

function mostraElemento(menuCorrente,displaytype) {
    if (document.getElementById) {
        questoMenu = document.getElementById(menuCorrente).style;
		if (questoMenu.display == displaytype) {
            questoMenu.display = "none";
		} else {
            questoMenu.display = displaytype;
		}
		return false;
    } else {
        return true;
    }
}

function advancedRandomImagesCURA() {
	// Advanced Random Images Start
	// Copyright 2001-2002 All rights reserved, by Paul Davis - www.kaosweaver.com
	var j,d="",l="",m="",p="",q="",z="",KW_ARI= new Array()
	KW_ARI[KW_ARI.length]='/img_custom/banner/01.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/02.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/03.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/04.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/05.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/06.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/07.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/08.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/09.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/10.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/11.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/12.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/13.jpg';
	KW_ARI[KW_ARI.length]='/img_custom/banner/14.jpg';
	j=parseInt(Math.random()*KW_ARI.length);
	j=(isNaN(j))?0:j;
	if (KW_ARI[j].indexOf('?')==-1) {
		document.write("<img src='"+KW_ARI[j]+"'>");
	} else {
		nvp=KW_ARI[j].substring(KW_ARI[j].indexOf('?')+2).split('&');
		for(var i=0;i<nvp.length;i++) {
			sub=nvp[i].split('=');
		  	switch(sub[0]) {
		  	case 'link':
			  l="<a href='"+unescape(sub[1])+"'>";
			  p="<\/a>";
		  	break;
		  	case 'target':
			  q=" target='"+unescape(sub[1])+"'";
		  	break;
		   	default:
			  m+=" "+sub[0]+"='"+unescape(sub[1])+"'";
		  	break;
		  	}
		}
		z=(l!="")?((q!="")?l.substring(0,l.length-1)+q+">":l):"";
		z+="<img src='"+KW_ARI[j].substring(0,KW_ARI[j].indexOf('?'))+"'"+m+">"+p;
		document.write(z);
	}
}

