function setFlashLoaded() {
	variables["flashReady"] = "yes";
}

var entratoTech = false;
var entratoGodin = false;
var entratoNasdaq =false; 
myJavascriptObject="";
var flashReady = 0;

var $j= jQuery.noConflict();
var App = new Class({
	HotSpot: function(show, over, out) {
		if(show == undefined)
			show = function(){};
		if(over == undefined)
			over = function(){};
		if(out == undefined)
			out = function(){};
		this._show = function() { /* workaround for losing flash focus in firefox 3 when interrupting clicks */ setTimeout(show, 1); };
		this._over = over;
		this._out = out;
// DEBUG
//this._show = function() { show(); $j('#debug').append('_show() '); };
//this._over = function() { over(); $j('#debug').append('_over() '); };
//this._out = function() { out(); $j('#debug').append('_out() '); };
	},
	
	chiude_carta: {
		_close: function() {
			//$j('#carta').fadeOut();
			
			for(var i in Blacktrend.tooltip.tooltips) {
				//Blacktrend.tooltip.tooltips[i].over();
				Blacktrend.tooltip.tooltips[i].out();
			}
			
			$j('#carta').hide();
			//$j('#flashmovieTwo').hide();
			//$j('#flashmovieTwo').fadeIn();
		} //XXX
		// TODO focus to swf
	},

	registerHotspot: function(id, hotspot) {
		this[id] = hotspot;
	},
	
    initialize: function(){
		this._animation = false;
		this.movieId = "flashMovie";
		this.secondMovieId="flashHome";
		// event registration
	/*	$('talk').onclick = function(event){
			var e = new Event(event);
			this.talkToFlash();
			e.stop();
		}.bind(this);
	
	$('check').onclick = function(event){
			alert(flashReady);
		}.bind(this);*/
    }, // end constructor initialize
	
	getFlashMovieById: function(id){
		var browserString= navigator.userAgent;
		var isIE =false;
		if(browserString.indexOf("MSIE") !=-1  )
		{
			//alert("Is IE!");
			isIE =true;
		}
		//var isIE = navigator.appName.indexOf("Microsoft") != -1;
        var flashMovie = (isIE) ? window[id] : document[id];
		//var flashMovie = (isIE) ? document.getElementById(id) : document[id];
		return flashMovie;
    }, // end function getFlashMovieById

	respond: function(data){
		this.talk(this.answers[data]);
		document.getElementById("footer").style.display = "none";
    }, // end function talkToJavascript
     
	talkToFlash: function() {
		//alert(this.movieId);
		this.getFlashMovieById(this.movieId).respond();
		//	document.getElementById("led").style.display = "none";
    }, // end function talkToFlash
	spegniSuono: function() {
		this.getFlashMovieById(this.movieId).spegni_suono();
	//	document.getElementById("led").style.display = "none";
    }, // end function talkToFlash
	accendiSuono: function() {
		this.getFlashMovieById(this.movieId).accendi_suono();
	//	document.getElementById("led").style.display = "none";
    },
	bipSelecta: function(data){
		try {
			this.getFlashMovieById(this.movieId).bip_selecta();
		} catch(ex) {
		}
    }, // end function talkToJavascript
	
	talkToMac: function() {
		//this.getFlashMovieById(this.movieId).flash_ready();
	//	alert('GGGGG ');
    }, // end function talkToFlash
	
	talkToFondo: function() {
		try{
			this.getFlashMovieById(this.movieId).inizia_suono_fondo();
		}
		catch(e)
		{
			err=e;
		}
    }, // end function talkToFlash
	
	accensione: function() {
		try{
			this.getFlashMovieById(this.movieId).accensione();
		}
		catch(e)
		{
			err=e;
		}
    }, // end function talkToFlash
	
	trans: function() {
		try{
			this.getFlashMovieById(this.movieId).trans();
		}
		catch(e)
		{
			err=e;
		}
		
    }, // end function talkToFlash
	
	mac_on: function() {
		this.getFlashMovieById(this.movieId).mac_on();
    }, // end function talkToFlash
    beep: function() {
		this.getFlashMovieById(this.movieId).beep();
    }, // end function talkToFlash
	
	spray_on: function() {
		this.getFlashMovieById(this.movieId).spray_on();
    }, // end function talkToFlash
	
	spray_off: function() {
		this.getFlashMovieById(this.movieId).spray_off();
    }, // end function talkToFlash
	
	start_home: function() {
	//	this.getFlashMovieById(this.secondMovieId).start_home();
    }, // end function talkToFlash
	kookoo: function() {
		try {
			this.getFlashMovieById(this.secondMovieId).kookoo();
		} catch(err) {
		}
    },
	////////////////////////////////////////////////////////////////////////////////////////
	
	talk: function (theTalk) {
		var margin = 10;
		$('bubble').setStyle("opacity",0);
		$('bubble').innerHTML = theTalk;
		if ( navigator.appName.indexOf("Microsoft") != -1) {
			$('bubble').setStyle("background-color",'#fff');
			new Fx.Styles( $('bubble') , {duration: 1000, transition:Fx.Transitions.Quint.easeInOut, onComplete: function() { $('bubble').setStyle("background-color",'transparent'); } }).start({'opacity':[0,1], 'margin-top':[margin,0]});
		} else {
			new Fx.Styles( $('bubble') , {duration: 1000, transition:Fx.Transitions.Quint.easeInOut }).start({'opacity':[0,1], 'margin-top':[margin,0]});
		} 
	} // end function talk
    
});


//window.addEvent('domready', function() {
	myJavascriptObject = new App();
//});

