// MT1.11 Compat
var $E = function(selector, filter){
        return ($(filter) || document).getElement(selector);
};

var $ES = function(selector, filter){
        return ($(filter) || document).getElements(selector);
};


var Timer = new Class({
	initialize: function (ms) {
		this.start_ms	=	0;
		this.ms			=	ms;
		this.is_started	=	false;
	},

	start: function () {
		d=new Date();
		this.start_ms	=	d.getTime();
		this.is_started	=	true;
		this.run.delay(50, this);
	},

	run: function () {
		if(!this.is_started) return;
		d=new Date();
		t=d.getTime();
		
		if((t - this.start_ms) >= this.ms) {
			this.end();
		} else {
			this.run.delay(50, this);
		}
	},

	reset: function () {
		d=new Date();
		this.start_ms = d.getTime();
	},
	
	stop: function () {
		this.initialize(this.ms, this.name);
	}
});
Timer.implement(new Events, new Options);