var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;

var posX = 0
var posY = 0

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    posX = event.clientX + document.body.scrollLeft
    posY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    posX = e.pageX
    posY = e.pageY
  }  
  // catch possible negative values in NS4
  if (posX < 0){posX = 0}
  if (posY < 0){posY = 0}
  // definisco la posizione del flash
	left=Math.floor((document.body.clientWidth-(800))/2);
	topmarg=0;
	bottommarg=493+topmarg;
	right=left+(800);
	// se fuori dal flash:
	if(posX<left || posX>right || posY<topmarg || posY>bottommarg ){ 
		funzioneEsterna();
	} else {
		funzioneEsterna2();
	}
  return true
}

function funzioneEsterna() {
		if(window.MainMovie) window.document["MainMovie"].SetVariable("vai", 1);
		if(document.MainMovie) document.MainMovie.SetVariable("vai", 1);
}
function funzioneEsterna2() {
		if(window.MainMovie) window.document["MainMovie"].SetVariable("vai", 0);
		if(document.MainMovie) document.MainMovie.SetVariable("vai", 0);
}
