//*********+*********+*********+*********+*********+*********+*********§





function apriCollegamento(dir,indirizzo) {
	if (indirizzo != "") document.location.href=dir+indirizzo;
}


//*********+*********+*********+*********+*********+*********+*********§



numimg=new Array(3);

numimg[0]=1 ;
numimg[1]=1 ;
numimg[2]=1 ;

//for (i=0; i <= 3; i++) { numimg[i]=1 };




var el,el1,el2,scrollY
var sumenu = false


var el3




var x_mouse = 0, y_mouse = 0;




function xy_mouse() {





if(event.x) {
	x_mouse = event.x;
	y_mouse = event.y;

} else if(event.pageX) {
x_mouse = event.pageX;
y_mouse = event.pageY; 
}



//window.defaultStatus = x_mouse + " " + y_mouse;

}	// FINE










//*********+*********+*********+*********+*********+*********+*********§





function ColoreMouseOver(id) {

    id_ = id
    while( id_.length >= 3 ) {         
	eval(id_).style.background = coloreSfondoCellaSelezionata;
	eval(id_).style.color= coloreTestoCellaSelezionata;
	id_ = id_.substring(0,id_.length-1);
	//alert(id_);

    }

	
}


//*********+*********+*********+*********+*********+*********+*********§


function ColoreMouseOut(id) {


    id_ = id
    while( id_.length >= 3 ) {         
	eval(id_).style.background = coloreSfondoCellaNonSelezionata;
	eval(id_).style.color= coloreTestoCellaNonSelezionata;
	id_ = id_.substring(0,id_.length-1);
	//alert(id_);

    }


/*
	eval(id).style.background = 
		coloreSfondoCellaNonSelezionata;
	eval(id).style.color= coloreTestoCellaNonSelezionata;
*/


}


//*********+*********+*********+*********+*********+*********+*********§



var ar_nome, i = new Array(), n_sub;


var xind = 6, yind = 4;
var cel_xx = 130;
var timerID;
var id_preced = "" , id_num_preced = "0";


rilevaBrowser();


function CreaTutteDiv() {

    for (j=1; j<=ar_menu.length; j++) {
	CreaDiv(ar_menu[j-1]);
    }

}



if (IE==1 || FIR==1) {
    
    CreaDivMenu();

    var ar_menu = new Array("1","13","14","15","16","131","132","133",
		"134","141","142","143","151","152","161","162")

    CreaTutteDiv();

}






//*********+*********+*********+*********+*********+*********+*********§


function NascondiTutto() {
//alert("j");
	for (j=0; j<ar_menu.length; j++) {
//alert(j);
		MosraSubMenu(ar_menu[j].toString(),"0");


ColoreMouseOut("ID1");


	nr = ar_menu[j];
	for (i[nr]=1; i[nr]<=eval(NomeBaseMenu + ar_menu[j].toString()).length/3; i[nr]++) {
		
		ColoreMouseOut("ID" + ar_menu[j].toString() + i[nr].toString())

		}




	}



}


//*********+*********+*********+*********+*********+*********+*********§


function fun_onmouseover( id_ , id_num_ , bo_num_cur) {

    ColoreMouseOver( id_ );
    clearTimeout( timerID );

    MosraSubMenu( id_num_  , '1' );

    if (bo_num_cur==0)  { 
	eval(id_).style.cursor="hand";
    } else {
	eval(id_).style.cursor="default";
    }

	//statusbar(id_preced.substring(0,id_preced.length-1));


    st_1 = id_preced.substring(0,id_preced.length-1);
    st_2 = id_.substring(0,id_.length-1);

    bo_ = ( st_1 == id_ ) || 
	  ( st_2 == id_preced );

    //statusbar(bo_);

    if (!bo_)  {









	 for (j=0; j<ar_menu.length; j++) {

		st_3 = ar_menu[j].toString();
		st_4 = st_3.substring(0,st_3.length-1);

		bo_2 = (st_3.length>id_num_.length) ||
			(st_3.length==id_num_.length && st_3!=id_num_)	;

//statusbar(ar_menu[j] + ": " + (st_3.length>id_num_.length));

		if (bo_2) { 
			MosraSubMenu(st_3,"0");
		}

	}






    }




}


//*********+*********+*********+*********+*********+*********+*********§



function fun_onmouseout( id_ , id_num_ ) {

	ColoreMouseOut( id_ );
	fuorimenu();
	id_preced = id_ ;
	id_num_preced = id_num_ ;

}


//*********+*********+*********+*********+*********+*********+*********§




function DisegnaDiv(ramo) {

    st_id = "ID" + ramo + i[nr].toString();
    st_num_id = ramo + i[nr].toString();




	/*alert( st_id + "\n" + st_num_id + "\n" + 
		 ar_nome[0+3*(i[nr]-1)] );
	*/





    restituisciDir();


indirizzo = ar_nome[1+3*(i[nr]-1)];

//if ( indirizzo.lastIndexOf("/") > 0 ) { dir = "../" }







//alert(document.URL + "\n" + indirizzo.substring( 0, indirizzo.lastIndexOf("/") )  );




st = '	<DIV CLASS=CELLA ID="' + st_id + '" ';
st += ' onClick="apriCollegamento(\''+dir+'\',\''+indirizzo+'\')" ';


st += ' onmouseover="fun_onmouseover(\'' + st_id + '\',\'' + 	
	st_num_id + '\',' + ar_nome[2+3*(i[nr]-1)] + ')"';


st += ' onmouseout="fun_onmouseout(\'' + st_id + '\',\'' + st_num_id + '\')"';




st += ' >	';

st += ar_nome[0+3*(i[nr]-1)];
st += '	</DIV> 	';


//alert(st);



	document.writeln(st);
	


eval(st_id).style.visibility= "hidden";   	// "visible";
eval(st_id).style.position= "absolute";
eval(st_id).style.left= left_("ID1") + width_("ID1")-xind + (cel_xx-xind)*(n_sub-1);

eval(st_id).style.width= cel_xx ;
eval(st_id).style.zIndex= 1000+ramo.length;




}


//*********+*********+*********+*********+*********+*********+*********§




/*

	alert( 	eval(st_id).offsetHeight + "\n" +
		eval(st_id).offsetWidth + "\n" +
		eval(st_id).offsetTop + "\n" +
		eval(st_id).offsetLeft 
		);
*/














//*********+*********+*********+*********+*********+*********+*********§


function SubMenuOver(id) {
	eval(id).length;
}




function SubMenuOut(id) {
	eval(id).style.background = 
		coloreSfondoCellaNonSelezionata;
	eval(id).style.color= coloreTestoCellaNonSelezionata;
}



//*********+*********+*********+*********+*********+*********+*********§


function Posiziona_Menu() {

getScrollY();
//alert(getScroll);
//statusbar(getScroll);
	el1 = document.getElementById("ID1");
	el2 = document.getElementById("MENU2");
	//el3 = document.getElementById("schermointero");
	//el4 = document.getElementById("schermonorm");





      	//el.style.left = 400;
      	el1.style.top  =  scroollY + 30;
	el2.style.top  =  scroollY + 200;
      	//el3.style.top  =  scroollY + 500;
	//el4.style.top  =  scroollY + 500;




      //carta.style.zIndex  = riga_fin ; 


}	// FINE 


function getScrollY() {

if(window.scrollY) {
	scroollY = window.scrollY;
	//alert("window.scrollY");

} else if(document.body.scrollTop) {
scroollY = document.body.scrollTop;
//alert("document.body.scrollTop"); 
} else  if(window.pageYOffset) {
scroollY = window.pageYOffset;
//alert("window.pageYOffset");

} else  if( document.documentElement && document.documentElement.scrollTop ) {
    scrollY = document.documentElement.scrollTop;

} else   {

scroollY = 0;
//alert("nes"); 

}

//statusbar(scroollY);

//return  scroollY;


}	



//*********+*********+*********+*********+*********+*********+*********§


function fuorimenu() {


	timerID=setTimeout('NascondiTutto()',600);


}


//*********+*********+*********+*********+*********+*********+*********§


function nascondiEl(el) {
	//alert(el+"\n5 seconds");
	el_ = document.getElementById(el);
	el_.style.visibility = "hidden"
	//sumenu = false;


}


function mostraEl(el) {
	//clearTimeout(timerID)
	sumenu = true
	el_ = document.getElementById(el);
	el_.style.visibility = "visible"

}


//*********+*********+*********+*********+*********+*********+*********§


function CambiaImg(nome,numero,estensione,quantita) { 
	numimg[numero]++;
	if (numimg[numero]<=quantita) { document.images[nome].src=nome+numimg[numero].toString()+estensione;
document.images[nome+"vista"].src="../gif/vista"+numimg[numero].toString()+estensione;

}	else { numimg[numero]=1;      document.images[nome].src=nome+numimg[numero].toString()+estensione
document.images[nome+"vista"].src="../gif/vista"+numimg[numero].toString()+estensione;}
       }


//*********+*********+*********+*********+*********+*********+*********§






function ColoraOver(id) {
	eval(id).style.background = 
		coloreSfondoCellaSelezionata;
	eval(id).style.color= coloreTestoCellaSelezionata;
}


function ColoraOut(id) {
	eval(id).style.background = 
		coloreSfondoCellaNonSelezionata;
	eval(id).style.color= coloreTestoCellaNonSelezionata;
}





function schermoIntero(nomefile) {


    st =  "<DIV 	CLASS=SCHERMOINTERO ";
    st += "ID=\"schermointero\" ";
    st += "onClick=\"finest1=window.open('" + nomefile +     	"','1',	'fullscreen=yes,titlebar=no,scrollbars=yes,menubar=no,status=no,resizable=no')\" ";  


//'height=" + window.screen.height 	+",width=" + window.screen.width + ",titlebar


    st += 'onmouseover="ColoraOver(\'schermointero\')" ';
    st += 'onmouseout="ColoraOut(\'schermointero\')"> ';
    st += 'Schermo<BR>Intero ';
    st += "</DIV>";

    st += "<DIV 	CLASS=SCHERMOINTERO ";
    st += "ID=\"schermonorm\" ";
    st += "onClick=\"top.close()\" ";
    st += 'onmouseover="ColoraOver(\'schermonorm\')" ';
    st += 'onmouseout="ColoraOut(\'schermonorm\')"> ';
    st += 'Schermo<BR>Normale ';
    st += "</DIV>";

    //alert(st);

    document.writeln(st);



//alert(document.body.offsetHeight + "\n" + window.screen.height+ "\n" + window.innerHeight);
    
   	if (document.body.offsetHeight==window.screen.height) {	
	    schermointero.style.visibility = "hidden";
	    schermonorm.style.visibility = "visible";
    	} else {
	    schermointero.style.visibility = "visible";
	    schermonorm.style.visibility = "hidden";
	}



}	// ++++++++++ FINE schermoIntero() ++++++++++




if (IE==1) {
	//schermoIntero(document.location)
}

//*********+*********+*********+*********+*********+*********+*********§









//*********+*********+*********+*********+*********+*********+*********§


function greca(unicode,simbolo) {

	if (OP5 !=1 && NN4 !=1) {
		document.write(unicode);
	} else {
		document.write("<SPAN CLASS=SIMBOL>"+simbolo+"</SPAN>");
	}
}


//*********+*********+*********+*********+*********+*********+*********§


function inserisciApplet(nomeApplet) {

if (window.name != "Destra") {st_frame="NO";} else {st_frame="SI";}

document.write('<APPLET CODE="' + nomeApplet +'.class" ');
document.write('WIDTH=' + (window.screen.width*((80-10)/100)) + ' ');
document.writeln('HEIGHT=' + (window.screen.height/1.5) + '> ');
document.write('<PARAM NAME=larghezzaSchermo ');
document.writeln('VALUE=' + (window.screen.width*((80-10)/100)) + '> ');
document.write('<PARAM NAME=altezzaSchermo ');
document.writeln('VALUE=' + (window.screen.height/1.5) + '> ');
document.write('<PARAM NAME=Frame ');
document.writeln('VALUE=' + st_frame + '> ');
document.write('<PARAM NAME=%Frame ');
document.writeln('VALUE=80> ');
document.writeln('</APPLET>')

}


//*********+*********+*********+*********+*********+*********+*********§


function inserisciApplet2(nomeApplet,urlApplet) {

if (window.name != "Destra") {st_frame="NO";} else {st_frame="SI";}

document.write('<APPLET CODE="' + nomeApplet +'.class" ');
document.write('CODEBASE="' + urlApplet + '" ');
document.write('WIDTH=' + (window.screen.width*((80-10)/100)) + ' ');
document.writeln('HEIGHT=' + (window.screen.height/1.5) + '> ');
document.write('<PARAM NAME=larghezzaSchermo ');
document.writeln('VALUE=' + (window.screen.width*((80-10)/100)) + '> ');
document.write('<PARAM NAME=altezzaSchermo ');
document.writeln('VALUE=' + (window.screen.height/1.5) + '> ');
document.write('<PARAM NAME=Frame ');
document.writeln('VALUE=' + st_frame + '> ');
document.write('<PARAM NAME=%Frame ');
document.writeln('VALUE=80> ');
document.writeln('</APPLET>')

}


//*********+*********+*********+*********+*********+*********+*********§


function allargaPagina() { 

	if (navigator.appName=="Netscape") { 

		if (parseInt(navigator.appVersion.substring(0,1),10)<5) {
			if (window.name=="Destra") {
				parent.moveTo(0,0)
				parent.resizeTo(window.screen.width-10,window.screen.availHeight-200)
			} else {
				window.moveTo(0,0)
				window.resizeTo(window.screen.width-10,window.screen.availHeight-200)
			}
		} else {	
			if (window.name=="Destra") {
				parent.moveTo(0,0)
				parent.resizeTo(window.screen.width,window.screen.availHeight)
			} else {
				window.moveTo(0,0)
				window.resizeTo(window.screen.width,window.screen.availHeight)
			}
		}

	} else {	

		if (window.name=="Destra") {
			parent.moveTo(0,0)
			parent.resizeTo(window.screen.width,window.screen.availHeight)
		} else {
			window.moveTo(0,0)
			window.resizeTo(window.screen.width,window.screen.availHeight)
		}
 
	}

}


//*********+*********+*********+*********+*********+*********+*********§



function bodyonscroll() {
	Posiziona_Menu();
	NascondiTutto();
}



//*********+*********+*********+*********+*********+*********+*********§
