window.flash = new Object();
window.flash.myExtFunction= function(val){
		alert("javaCalls"+val)
}
function MM_findObj(n, d) 
{
	var p,i,x;

	// La ricorsione per la ricerca inizia a livello del documento
	if (!d) d=document; 
	
	if ((p=n.indexOf("?"))>0 && parent.frames.length) 
	{
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}
	
	if (!(x=d[n]) && d.all) 
		x = d.all[n]; 
		
	for (i=0; !x && i<d.forms.length;i++) 
		x=d.forms[i][n];
		
	// Ricorsione per tutti i layer. Ci si interrompe se si trova l'oggetto
	for (i=0; !x && d.layers && i < d.layers.length; i++)
			x = MM_findObj(n, d.layers[i].document);
		
	// Se infine non si è ancora trovato l'oggetto si usa il metodo GetElementById 
	if (!x && d.getElementById) 
		x = d.getElementById(n);
		
	return x;
}
/*function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}
function scrivi(val){
	MM_findObj("flashObject",null).javaCalls(val)
}*/	
function callExternalInterface() {
	if( MM_findObj("flash",null)!=undefined){
 		if(MM_findObj("flash",null).myExtFunction!=undefined){
		MM_findObj("flash",null).myExtFunction();}
  }
}

function mousemove(e) { 
	MousePosition=[]
   if(window.attachEvent || navigator.appName.indexOf("Explorer")!=-1) 
         { 
     MousePosition[0] = event.clientX; 
     MousePosition[1] = event.clientY; 
     } 
   else 
     { 
       MousePosition[0] = e.pageX; 
       MousePosition[1] = e.pageY; 
     } 
	left=Math.floor((document.body.clientWidth-(939+52))/2)+52;
	topmarg=36;
	bottommarg=380+topmarg;
	right=left+(939);
	// detecting mouse
	 if(MousePosition[0]<left || MousePosition[0]>right || MousePosition[1]<topmarg || MousePosition[1]>bottommarg ){ 
		callExternalInterface()
	}
} 
