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
	topmarg = 165;
	bottommarg = 259 + topmarg;
	left = Math.floor((document.body.clientWidth - 954) / 2);
	left = left + 543;
	right=left+(412);
	// 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("ok", 1);
    if (document.MainMovie) document.MainMovie.SetVariable("ok", 1);
}
function funzioneEsterna2() {
    if (window.MainMovie) window.document["MainMovie"].SetVariable("ok", 0);
    if (document.MainMovie) document.MainMovie.SetVariable("ok", 0);
}

