
function finestra(nomefile, larghezza, altezza) {
   sopra  = (screen.height/2)- (altezza/2); 
   sinistra = (screen.width/2) - (larghezza/2); 
   window.open(nomefile,'finestra','width=' + larghezza + ',height=' + altezza + ',scrollbars=yes, toolbar=no, status=no, left=' + sinistra + ',top=' + sopra) 
}

function centra(elemento,larg) /* Centra in orizzontale */
   {
   if (document.layers)
      {
      document.layers[elemento].width=larg;
      document.layers[elemento].pageX =(window.innerWidth/2)-(document.layers[elemento].width/2);
      }
   else
      if (document.all)
         {
         document.all[elemento].width=larg;
         document.all[elemento].style.posLeft=(document.body.clientWidth/2)-(document.all[elemento].width/2);
         }
      else
	     if (document.getElementById && (navigator.userAgent.toLowerCase.indexOf("gecko")!=-1))
            {
            document.getElementById(elemento).width=larg;
            document.getElementById(elemento).style.left =(window.innerWidth/2)-(document.getElementById(elemento).width/2);
            }
   }

function centratop(elemento,alt) /* Centra in verticale un oggetto in una finestra */
   {
   if (document.layers)
      {
      document.layers[elemento].height=alt;
      document.layers[elemento].pageY =(window.innerHeight/2)-(document.layers[elemento].height/2);
      }
   else
      if (document.all)
         {
         document.all[elemento].height=alt;
         document.all[elemento].style.posTop =(document.body.clientHeight/2)-(document.all[elemento].height/2);
         }
      else
         if (document.getElementById && (navigator.userAgent.toLowerCase.indexOf("gecko")==-1))
            {
            document.getElementById(elemento).height=alt;
            document.getElementById(elemento).style.top =(window.innerHeight/2)-(document.getElementById(elemento).height/2);
            }
   }

