/*
	Marquee using mootools 
	Abdelkader Elkalidi contact[at]updel.com
	http://updel.com
*/
var marquee = new Class({
    initialize: function(options) {
		this.setOptions({
			marqueeIn	: 'marqueeIn',
			marqueeMe	: 'marqueeMe',
			speed		: 5,
			//direction	: 'left', Not yet
			hoverpause	: true
	    }, options);
	    this._construct();
	},
	_construct: function() {
		this.startFrom		=	$(this.options.marqueeMe).getStyle('width').toInt();
		this.restartLimit	=	$(this.options.marqueeIn).getStyle('width').toInt();
		this.elTomarquee	=	$(this.options.marqueeMe);
		this.elTomarquee.setStyle('right',-this.startFrom+'px');
		this.marquee(); //start marquee
		this.mouseEvents(); //start marquee
	},
	marquee: function() {
		var addPix = this.elTomarquee.getStyle('right').toInt();
		this.elTomarquee.setStyle('right',(addPix+2)+'px');
		if(addPix > this.restartLimit){
			this.elTomarquee.setStyle('right',-this.startFrom+'px');
		}
		this.timer = this.marquee.delay(this.options.speed, this);
	},
	mouseEvents : function(){
	    this.elTomarquee.addEvents({
	        'mouseover' : function(){
	            $clear(this.timer);
	        }.bind(this),
	        'mouseout' : function(){
	            this.timer = this.marquee.delay(this.options.speed, this);
	        }.bind(this)
	    });
	}
});
marquee.implement(new Options);

/*window.addEvent('domready', function(){
		if($defined($('marquee_relative_to_me')))							 
			new marquee({marqueeIn:'marquee_relative_to_me',marqueeMe:'marquee_me',speed:50});
	});*/


