var Slide = {
	pe : null,
	dest_x : 0,
	panel_x : 0,
	speed : 10,
	base_width : null,
	initialized : false,
	
	initialize : function() {
		if (!this.initialized) {
			this.pe = new PeriodicalExecuter(this.do_slide.bind(this), .02);
			this.base_width = Transcript.panel_wrapper.getWidth();
			this.initialized = true;
		}
	},
	
	do_slide : function() {
		Transcript.scroll_to_line();
		if (this.panel_x != this.dest_x) {
			var slideValue = (this.dest_x - this.panel_x) / this.speed;
			if (this.dest_x < 0) {
				if (slideValue > -.3) {
					slideValue = -.3;
				}
			} else {
				if (slideValue < .3) {
					slideValue = .3;
				}
			}
			this.panel_x += slideValue;
			if (Math.abs(this.panel_x - this.dest_x) < .3) {
				this.panel_x = this.dest_x;
			};
			Transcript.panel.setStyle({left: this.panel_x + 'px'});
			Transcript.panel_wrapper.setStyle({width: this.base_width + this.panel_x + 'px'})
		}
	},

	left : function() {
		this.dest_x = -208;
	},
	
	right: function() {
		this.dest_x = 0;
	}
}
