function centra(livello, dimensione) /* Centra in orizzontale */
   {
   if (document.layers)
      {
      document.layers[livello].width=dimensione;
      document.layers[livello].pageX =(window.innerWidth/2)-(document.layers[livello].width/2);
      }
   else
      if (document.all)
         {
		 delive = eval("document.all."+livello);
         delive.width=dimensione;
         delive.style.posLeft =(document.body.clientWidth/2)-(delive.width/2);
         }
      else
	     if (document.getElementById)// && (navigator.userAgent.toLowerCase.indexOf("gecko")!=-1)
            {
            document.getElementById(livello).width=dimensione;
            document.getElementById(livello).style.left =(window.innerWidth/2)-(document.getElementById(livello).width/2);
            }
   }

function centratop(livello) /* Centra in verticale */
   {
   if (document.layers)
      {
      document.layers[livello].height=40;
      document.layers[livello].pageY =(window.innerHeight/2)-(document.layers[livello].height/2);
      }
   else
      if (document.all)
         {
		 delive = eval("document.all."+livello);
         delive.height=40;
         delive.style.posTop =(document.body.clientHeight/2)-(delive.height/2);
         }
      else
         if (document.getElementById && (navigator.userAgent.toLowerCase.indexOf("gecko")==-1))
            {
            document.getElementById(livello).height=40;
            document.getElementById(livello).style.top =(window.innerHeight/2)-(document.getElementById(livello).height/2);
            }
   }
   
 function centratopvar(livello, quadro, ha) /* Centra in verticale, dentro un quadro, a partire da */ 
   {
   if (document.layers)
      {
      document.layers[livello].height=1;
      
			 if (window.innerHeight < quadro){document.layers[livello].pageY = ha}
			 else{document.layers[livello].pageY =((window.innerHeight-quadro)/2)+ha;}
	  
	  
      }
   else
      if (document.all)
         {
		 delive = eval("document.all."+livello);
         delive.height=4;
		 if (document.body.clientHeight < quadro){delive.style.posTop = ha}
		 else{delive.style.posTop =(document.body.clientHeight/2)-(quadro/2)+ha;}
         }
      else
	     if (document.getElementById)// && (navigator.userAgent.toLowerCase.indexOf("gecko")!=-1)
            {
            document.getElementById(livello).height=4;
            
			 if (window.innerHeight < quadro){document.getElementById(livello).style.top = ha}
			 else{document.getElementById(livello).style.top =((window.innerHeight-quadro)/2)+ha;}
			

            }
   }
