var ModalPlayer = {
	open: function(movieid,time){
		MOOdalBox.open('/'+lang+'/movie_show/movie/'+movieid,{width:885, height:510});
		//var timecode = time;
		//window.addEvent('modalplayer_flashloaded',function(){ setTimeout(function(){if(jumpto) jumpto(timecode)},1000); });  
	}
};

var ModalPlayerMenu = {
	init: function(el){
		//console.log('Modalplayer menu init');
		
		this.scenes = $('movie-scenes');
		containerheight = this.scenes.getParent('#movie-page-modal').getSize().y+15;
		console.log(containerheight);
		
		
		this.container = new Element('div',{ id: 'modalplayer-scenemenu', styles:{height: containerheight} });
		this.scenes.setStyles({height: containerheight});
		this.container.wraps(this.scenes);
	
		this.fx = {
			container: new Fx.Morph(this.container),
			scenes: new Fx.Morph(this.scenes)
		};
		
		var hidethis = this.hide.bind(this);
		var showthis = this.show.bind(this);
		
		this.timer = setTimeout(this.hide.bind(this),3000);
		
		this.container.addEvent('mouseenter',function(){
			$clear(this.timer);
			//console.log('mouse entered menu');
			this.show();
		}.bind(this));
		
		this.container.addEvent('mouseleave',function(){
			//console.log('mouse left menu');
			$clear(this.timer);
			this.timer = setTimeout(this.hide.bind(this),2000);
		}.bind(this));
			
	},
	
	show: function(){
		//console.log('Showing modalplayer menu');
		this.container.setStyles({width:35});
		this.fx.container.start({width:150});
		this.fx.scenes.start({opacity:0.8});

		
	},
	
	hide: function(){
		//console.log('Hiding modalplayer menu');
		
		this.fx.container.addEvent('complete',function(){ this.container.setStyles({width:150}); }.bind(this));
		this.fx.container.start({ width:35 });
		this.fx.scenes.start({ opacity:0 });
	}
	
};