<!--
var Openable = new Class({
	options: {
			width: 240,
			height: 240,
			direction: 'SO' //NE,NO,SE,SO
	},
 initialize: function(div, flash, options){
		this.setOptions(options);
		
		writeDoFSCommand(flash);
		
		this.flash = getFlashMovie(flash);
		var content = $(div);
		//content.bgiframe({opacity: false});
		
		this.options.width=this.flash.width.toInt();
		this.options.height=this.flash.height.toInt();
		var width=content.getStyle('width').toInt();
		var height=content.getStyle('height').toInt();
				
		var container=new Element('div', {
	 	'styles': {
						'position': 'relative',
						'width': width,
						'height':height
		 }
	 });
		content.setStyles({
   position: 'absolute',
   top: 0,
   left: 0	,
   width: width,
   height: height,
			zindex: 50
  });
  content.replaceWith(container).appendChild(content);
		
		this.fx = new Fx.Styles(content, {
		 duration: 400,
			wait: false,
			transition: Fx.Transitions.Cubic.easeInOut
		});
		
		this.inizio =  ({
			'width': width,
			'height': height,
			'top': 0,
			'left': 0
		});

		this.fineTop=function() {
			switch(this.options.direction) {
					case 'NO':
					case 'NE':
					 return this.inizio.height+this.inizio.top-this.options.height;
					case 'SO':
					case 'SE':
					 return this.inizio.top;
			};
		};
		
		this.fineLeft=function() {
			switch(this.options.direction) {
					case 'NO':
					case 'SO':
					 return this.inizio.width+this.inizio.left-this.options.width;
					case 'NE':
					case 'SE':
					 return this.inizio.left;
			};
		};		
		
		this.fine = ({
			'width': this.options.width,
			'height': this.options.height,
			'top': this.fineTop(),
			'left': this.fineLeft()
		});
		
		//this.flash.width='100%';
		//this.flash.height='100%';
		this.opening=false;
		this.closing=false;
		this.opened=false;
		this.closed=true;
		
		//content.addEvent('mouseover', this.open.bind(this));
		//content.addEvent('mouseout', this.close.bind(this))
 },
	open: function(){
			if (this.closed && !this.opening) {
				this.setFlash("opening");
				this.opening=true;
				this.closing=false;
				this.closed=false;
				this.fx.start(this.fine).chain(function(){
				 if (!this.closing) {
						this.setFlash("opened");
						this.opened=true;
						this.opening=false;
					}
				}.bind(this));
			}
	},
	close: function(){
			if (this.opened && !this.closing) {
				this.setFlash("closing");
			 this.closing=true;
				this.opening=false;
				this.opened=false;
				this.fx.start(this.inizio).chain(function(){
					if (!this.opening) {
						this.setFlash("closed")
						this.closed=true;
						this.closing=false;
					}
				}.bind(this));
			}
	},
	setFlash: function(value){
  if (this.flash) this.flash.SetVariable("watched", value);
	}
});
Openable.implement(new Options);

// This is a javascript handler for the player
function getFlashMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return (window[movieName]) ? window[movieName] : document[movieName];
	} else {
		if(document[movieName].length != undefined) return document[movieName][1];
		return document[movieName];
	}
};

function writeDoFSCommand(movie) {
 // Handle all the FSCommand messages in a Flash movie.
	document.write('<script type=\"text/javascript\"\>\n');
	document.write('function ' + movie + '_DoFSCommand(command, args) {\n');
	document.write('	eval("' + movie + '" + command);\n');
	document.write('}\n');
	document.write('</script\>\n');
	
	// Hook for Internet Explorer.
	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
		document.write('<script language=\"VBScript\"\>\n');
		document.write('On Error Resume Next\n');
		document.write('Sub ' + movie + '_FSCommand(ByVal command, ByVal args)\n');
		document.write('	Call ' + movie + '_DoFSCommand(command, args)\n');
		document.write('End Sub\n');
		document.write('</script\>\n');
	}
}

//-->
