/* 
 * Schiavo Mazzonis
 *
 * @package		Schiavo Mazzonis
 * @author		Oskar Krawczyk (o.krawczyk@keepthinking.it)
 * @version		1.0
 * @dependecies	MooTools 1.2.1
 * @copyright	Copyright (c) 2008-2010, Oskar Krawczyk (Keepthinking Ltd.)		
 * @link		http://keepthinking.it
 * 
 ======================================================================= */

// e  - event
// el - element

// COMPRESS BEFORE DEPLOYING
// $ java -jar yuicompressor-2.3.4.jar --nomunge --type js -o output.js input.js 

var Showcase = new Class({
	
	Implements: Options,
	options: {},
	
	/* Initialize needed methods
	 ======================================================================= */
	initialize: function(options) {
		this.setOptions(options);
		this.slide = $$('.hri1 a', '.hri2 a');
		this.width = new Array();
		this.slide.getParent().getElement('strong').set('styles', {'opacity': 0.8});
		if(this.slide.length < 2) return;
		this.controls();
		this.start();
	},
	
	/* 
	 ======================================================================= */
	controls: function() {
		this.width[0] = this.slide[0].getSize().x.toInt();
		this.width[1] = this.slide[1].getSize().x.toInt();
		
		if(this.width[0] > 800) this.width[0] = 800
	},

	/* 
	 ======================================================================= */
	start: function() {		
		this.slide[1].set('styles', {
			left: (this.width[0])
		});

		this.slide.get('morph', {transition: 'cubic:out'});

		this.slide[1].addEvents({
			mouseover: function() {
				this.slide[1].morph({left: 50});
				this.slide[0].morph({opacity: 0.5});
			}.bind(this),
			mouseout: function() {
				this.slide[1].morph({left: this.width[0]});
				this.slide[0].morph({opacity: 1});
			}.bind(this)	
		});
	}
});