<!-- aprisito(theURL,larghezza,altezza); aprilinkesterno(theURL); aprischeda(theURL); -->
<!-- aprischedascroll(theURL); initArray(); -->
<!-- MM_preloadImages(); MM_swapImgRestore(); MM_findObj(n, d); MM_swapImage(); -->
<!-- MM_reloadPage(init); MM_showHideLayers(); MM_callJS(jsStr); MM_goToURL(); -->
<!-- conversione(data); conversioneinvio(data); controllamouse(); MM_displayStatusMsg(msgStr); -->


<!-- apertura di una finestra "centrata" rispetto allo schermo -->
function aprisito(theURL,larghezza,altezza) { //v2.0

	winName="window";
	winName+=Math.floor(Math.random()*100000)+1; //crea un nome univoco per ogni finestra
	features="";
	features+=",top=";
	features+=screen.height/2-altezza/2;
	features+=",left=";
	features+=screen.width/2-larghezza/2;
	features+=",width="+larghezza+",height="+altezza+",toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable=no";
	window.open(theURL,winName,features);

}


<!-- apertura di un link esterno in finestra "in basso a destra" rispetto a un sito 800x600 -->
function aprilinkesterno(theURL) { //v2.0

	winName="window";
	winName+=Math.floor(Math.random()*100000)+1; //crea un nome univoco per ogni finestra
	features="";
	features+=",top=";
	features+=screen.height/2-440/2+65;
	features+=",left=";
	features+=screen.width/2-660/2+65;
	features+=",width=660,height=440,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes";
	window.open(theURL,winName,features);

}

function aprischedaresize(theURL) 
{
	winName="window";
	winName+=Math.floor(Math.random()*100000)+1;
	features="";
	features+=",top=";
	features+=screen.height/2-850/2+100;
	features+=",left=";
	features+=screen.width/2-790/2+100;
	features+=",width=580,height=580,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
	window.open(theURL,winName,features);
}

<!-- apertura di una scheda in finestra 590x370 "centrata" rispetto allo schermo -->
function aprischeda(theURL) { //v2.0

	winName="window";
	winName+=Math.floor(Math.random()*100000)+1;
	features="";
	features+=",top=";
	features+=screen.height/2-370/2;
	features+=",left=";
	features+=screen.width/2-590/2;
	features+=",width=590,height=370,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no";
	window.open(theURL,winName,features);

}


<!-- apertura di una scheda SCROLLABILE in finestra 590x370 "centrata" rispetto allo schermo -->
function aprischedascroll(theURL) { //v2.0

	winName="window";
	winName+=Math.floor(Math.random()*100000)+1;
	features="";
	features+=",top=";
	features+=screen.height/2-370/2;
	features+=",left=";
	features+=screen.width/2-590/2;
	features+=",width=590,height=370,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no";
	window.open(theURL,winName,features);

}


<!-- inizializzazione degli array -->
function initArray() {
	this.length = initArray.arguments.length
	for (var i = 0; i < this.length; i++)
	this[i+1] = initArray.arguments[i]
	}


<!-- pre-caricamento immagini -->
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];}}

}


<!-- ripristino immagini scambiate -->
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;

}


<!-- funzione di appoggio per altre funzioni -->
function MM_findObj(n, d) { //v4.0

  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 && document.getElementById) x=document.getElementById(n); return x;

}


<!-- scambio immagini -->
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];}

}


<!-- ricarica pagina on-resize per netscape -->
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();

}

MM_reloadPage(true);


<!-- funzione per mostrare o nascondere i layer -->
function MM_showHideLayers() { //v3.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
	
}


function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

<!-- redirect ad un altro url -->
function MM_goToURL() { //v3.0

	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}


<!-- conversione del formato data da echo PHP in gg/mm/aaaa con scrittura nell'HTML-->
function conversione(datax) {

gdata=datax.substring(8,10);
mdata=datax.substring(5,7);
adata=datax.substring(0,4);
document.write(gdata+"/"+mdata+"/"+adata);

}


<!-- conversione del formato data da echo PHP in gg/mm/aaaa -->
function conversioneinvio(datax) {

gdata=datax.substring(0,2);
mdata=datax.substring(3,5);
adata=datax.substring(6,10);
return adata+mdata+gdata;

}


<!-- funzione di supporto per controllamouse() -->
function des(e) {

if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("Tasto destro non operativo!");
return false;
}
return true;

} 


<!-- controllo del tasto destro del mouse [vedi des(e);] -->
<!-- ATTENZIONE: LA FUNZIONE VA INSERITA onLoad NEL body DELLA PAGINA! -->
function controllamouse() {

document.onmousedown=des;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=des;

}


<!-- scritta sulla status bar -->
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_openBrWindow4(theURL,winName,features) { //v2.0
	features+=",top="
	features+=screen.height/2-200/2
	features+=",left="
	features+=screen.width/2-200/2

 	window.open(theURL,winName,features);
}

