var DMarquee = new Class({
	options: {
		height: 90,
		duration: 500,
		timeout: 5000,
		fps: 50
	},

	firstrun: 1,
	mousein: 0,

	initialize: function(el, options) {
		this.setOptions(options);
		this.element = el;

		this.scrollarray = this.element.getChildren();

		this.timer = this.start.delay(this.options.timeout, this);
	},

	start: function()
	{
		if(this.mousein == 0)
		{
			if(this.firstrun == 0)
			{
				this.scrollarray = this.element.getChildren();
				this.scrollarray[0].injectAfter(this.scrollarray.getLast());
				this.element.setStyle('marginTop', 0);
			}

			this.effect = new Fx.Tween(this.element, {'fps': this.options.fps, 'duration': this.options.duration, 'transition': Fx.Transitions.linear}).start('marginTop', this.options.height * -1);

			this.firstrun = 0;

			this.timer = this.start.delay(this.options.timeout, this);
		}
	},

	restart: function()
	{
		this.effect.resume();
		this.timer = this.start.delay(this.options.timeout, this);
	},

	pause: function()
	{
		this.effect.pause();
		$clear(this.timer);
	},

	mouseover: function()
	{
		this.pause();
		this.mousein = 1;
	},

	mouseout: function()
	{
		this.restart();
		this.mousein = 0;
	}
});
DMarquee.implement(new Options, new Events);