Mvmn = new Class.create();
Mvmn.prototype = {
	
	initialize:function(mvmnId) {

		if (!$(mvmnId)) {
			return false;
		}
		
		this.mvmns = $(mvmnId);
		this.defaultX = this.getCurrentPositionX();
		this.currentX = this.defaultX;
		this.nowMoving = false;
	},
	
	mv: function(evt,dist) {
	
		if (evt) {
			//var el  = Event.element(evt);
			//el.href = "#";
		}
		dist = parseInt(dist);

		if (this.currentX == dist) {
			this.mv(evt,this.defaultX);
		}
		else {
			if (this.nowMoving) return false;
			var move = dist - this.currentX;
			new Effect.MoveBy(this.mvmns,0,move, {
				duration:0.3 , beforeStartInternal: function() {this.nowMoving = true}.bind(this), afterFinishInternal: function(effect) { this.nowMoving = false; this.currentX = this.getCurrentPositionX(); }.bind(this)
			});
		}
	
	},

	getCurrentPositionX: function() {

		var x;
		if (typeof this.mvmns.currentStyle == 'undefined') {
			x = this.mvmns.style.left || getComputedStyle(this.mvmns,"").left;
		} else {
			x = this.mvmns.style.left || this.mvmns.currentStyle.left;
		}
		x = parseInt(x);
		if (typeof x == 'undefined') {
			x = 0;
		}
		
		return x;
	}
};
