
///////////////////////////////////////////////////////////////////////////////////


var margine_x = (screen.availWidth - 750)/2; // 750 è la larghezza del livello container
var margine_y = 70                          //altezza del livello head a cui ho tolto la dimensione del link (80 - 10)
var width_liv = 340                          //è il width del livello

//// Da qui non modificare più nulla
var name_Livello ='';
var enabled = false ;
var Mouse_X = '' ;
var Mouse_Y = '' ;

function AW_mouse_pos(n_Liv, enab) {

name_Livello = n_Liv;
enabled = enab;

   if (document.layers) {
   
      window.captureEvents(Event.MOUSEMOVE);
      window.onmousemove=AW_assegna;
	  
   }  else {
      document.onmousemove=AW_assegna;
	  
   }
  
   
}


function AW_assegna(e) {

   if (document.all) {
      Mouse_X=window.event.clientX;
	  Mouse_Y=window.event.clientY;
   }else {
      Mouse_X=e.pageX;
	  Mouse_Y=e.pageY;
   }
   
AW_move();
}

function AW_move() {
 
 if(enabled) document.getElementById(name_Livello).style.display = '';  else document.getElementById(name_Livello).style.display = 'none';


   if (!document.all) {

       var posizione_x = Mouse_X - margine_x;
       if ((screen.availWidth/2) - posizione_x < width_liv) { posizione_x = posizione_x-width_liv} 
	   
       var posizione_y =Mouse_Y- margine_y;
	  
   } else {
   
       var posizione_x = window.event.clientX- margine_x;
       if ((screen.availWidth/2) - posizione_x < width_liv) { posizione_x = posizione_x-width_liv} 
       var posizione_y = window.event.clientY- margine_y;

   }
   
	  document.getElementById(name_Livello).style.left = posizione_x + 'px';
	  document.getElementById(name_Livello).style.top = posizione_y + 'px';
	  
}