/**
 * MooHover - Anchor and form input modification
 *
 * @version		1.0.1
 *
 * @license		MIT-style license
 * @author		Constantin Boiangiu <constantin [at] php-help.ro>
 * @copyright	Author
 */

var MooHover = new Class({
	Implements: [Options],
	options: {
		container: null,
		className: 'MooTrans',
		defaultClass: 'default',
		duration: 200,
		transition: Fx.Transitions.Sine.easeOut		
	},

	initialize: function(options) {
		this.setOptions(options);
		this.container = $(this.options.container) || document;
		this.start();		
	},
	
	start: function(){
		var buttons = this.container.getElements(
                '.'+this.options.className).filter(function(elem,i){
                    if(elem.rel!=='selected')
                        return elem;
                }.bind(this));
		
		buttons.each(function(element,i){

			var transEffect = new Fx.Morph(element, {
                            duration: this.options.duration,
                            transition: this.options.transition
                        });
			
			element.addEvents({
				'mouseover':function(){
					transEffect.cancel();
					transEffect.start({opacity:0.0001});
				},
				'mouseout':function(){
					transEffect.cancel();
					transEffect.start({opacity:1});
				}
			})			
		}.bind(this));
	}
});
