var gHideLayer=null;
DynViewer.prototype.fadeIn=function (lFrom, lTo) {
	lFrom.setZIndex(-1);
	lTo.setOpacity(0);
	if (lTo.getX()!=0) lTo.setX(0);
	lTo.setZIndex(+1);
	gHideLayer=lFrom;
	lTo.onfadeend = function(){
		gHideLayer.setOpacity(0);
		gHideLayer.setZIndex(null);}
	lTo.fadeBy(100,40,40);
}

DynViewer.prototype.toLeft=function() {
	if (this.LeftPanel == 0) 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;
	}

	this.fadeIn( this.imageLayers[this.VisiblePanel], this.imageLayers[this.LeftPanel] );
	
	if (this.LeftPanel==0) this.preva.setVisible(false);
	return false;
}

DynViewer.prototype.toRight=function() {
	if (this.LeftPanel >= this.imagecount-this.imagesshowing) return false;
	
	if (this.LeftPanel == 0) this.preva.setVisible(true);

	this.VisiblePanel = this.LeftPanel;
	this.LeftPanel = this.LeftPanel+this.imagesshowing;

	this.fadeIn( this.imageLayers[this.VisiblePanel], this.imageLayers[this.LeftPanel] );

	if (this.LeftPanel >= (this.imagecount-this.imagesshowing))
		this.nexta.setVisible(false); else if (!this.nexta.getVisible()) this.nexta.setVisible(true);

	return false;
}
