/* [/web/js/locationEffects.js] */

var WindowMove = Class.create(Effect.Move, {
	update: function(position) {
		var x = - 2 * position * (position - 1);
		var pos = 2 * this.options.x * x + this.originalLeft;
		
		var w = this.options.initWidth * this.options.zoom; 
		var h = this.options.initHeight * this.options.zoom;
		
		var wWidth = this.element.getWidth();
		
		this.element.setStyle({ 
			'left' : pos.round() + "px" 
		});
		
		var left = (w - wWidth * this.options.zoom) * pos / (this.options.initWidth - wWidth);
		left = (left > 0) ? left : pos;
		
		if (this.options.source) {
			left = left - parseInt(this.options.source.getStyle('left'));
		}
		
		this.element.firstChild.setStyle({
			'left': -left.round() + 'px'
		});
	}
});
