/** * (c) 2008, Wacko-Wacko! * @author daclip */function WSlideObject(objectPtr, defaultValue, speed) {	var __classptr = this;	var self = null;	var prevPosition = null;		/* slide timer vars */	var timer = null;	var currentShiftValue = 0;	var _timerSpeed = 1;	var scrollStep = speed;		/* useful stuff */	this.onComplete = function(position) { }	this.onStart = function() { }		this.getSelf = function() { return self; }		/* public */	this.slideRight = function(n) { this.processSlideRight(n);  }	this.slideLeft = function(n) { this.processSlideLeft(n); }	this.go = function(n) { processMovement(n); }			/* slide effect processing */	this.processSlideRight = function(n) {		var __backref = this;		if ((currentShiftValue+=scrollStep) >= n) {			clearTimeout(timer);			this.onComplete(currentShiftValue);			return false;		}		set_position(currentShiftValue);		timer = setTimeout(function() { __backref.processSlideRight(n); }, _timerSpeed);	}		this.processSlideLeft = function(n) {		var __backref = this;		if ((currentShiftValue-=scrollStep) <= n) {			clearTimeout(timer);			this.onComplete(currentShiftValue);			return false;		}		set_position(currentShiftValue);		timer = setTimeout(function() { __backref.processSlideLeft(n); }, _timerSpeed);	}		/* private */		var processMovement = function(position) {		__classptr.onStart();		if (position > prevPosition) {			__classptr.slideRight(position);			prevPosition = position;		}		if (position < prevPosition) {			__classptr.slideLeft(position);			prevPosition = position;		}	}		var set_position = function(value) {		self.style.marginLeft = value+"px";	}			var init = function() {		self = objectPtr;		if (defaultValue == null) defaultValue = 0;		set_position(defaultValue);		prevPosition = defaultValue;		currentShiftValue = defaultValue;	}	init();}