// Requires viewer.js
// Sliding movement in viewer

DynViewer.prototype.toLeft=function() {
	if (this.LeftPanel == 0) return false;
	  
	// moving
	if (this.canvas.getX() != this.nextAmt) return false;
	if (!this.nexta.getVisible())this.nexta.setVisible(true);
	
	if (this.LeftPanel == this.imagecount-this.imagesshowing) {
		this.nexta.setVisible(true);
	}
  
	this.VisiblePanel = this.LeftPanel;
	this.LeftPanel = this.LeftPanel-this.imagesshowing;
	if (this.LeftPanel < 0 ) {
		this.LeftPanel = 0;
		this.nextAmt = 0;
	} else 
		this.nextAmt = this.canvas.getX()+(this.imagewidth*this.imagesshowing+(this.imagesshowing*this.imgLpad));

	this.RightPanel = this.LeftPanel+this.imagesshowing;
	
	this.canvas.slideTo(this.nextAmt,0,this.animDelta,this.animSpeed);
	
	if (this.LeftPanel==0) this.preva.setVisible(false);
	return false;
}

DynViewer.prototype.toRight=function() {
	if (this.LeftPanel >= this.imagecount-this.imagesshowing) return false;
	
	// moving
	if (this.canvas.getX() != this.nextAmt) return false;
	if (this.LeftPanel == 0) this.preva.setVisible(true);

	this.VisiblePanel = this.LeftPanel;
	this.LeftPanel = this.LeftPanel+this.imagesshowing;
	this.RightPanel = this.LeftPanel+this.imagesshowing;

	if (this.RightPanel>(this.imagecount-1)) this.RightPanel = this.imagecount-1;

	this.nextAmt = this.canvas.getX()-((this.imagewidth*this.imagesshowing)+(this.imagesshowing*this.imgLpad));
	this.canvas.slideTo(this.nextAmt,0,this.animDelta,this.animSpeed)

	if (this.LeftPanel >= (this.imagecount-this.imagesshowing))
		this.nexta.setVisible(false); else if (!this.nexta.getVisible()) this.nexta.setVisible(true);

	return false;
}
