/* i = company id */

var loadingImage = '/_images/si_loading.gif';		
var closeButton = '/_images/si_close.gif';	

//TGal = Class.create();
function TGal(i) {	
		this.id = i;

		this.drc = 0;
		this.tmr = 0;
		this.galdiv = document.getElementById('galFloatHld' + this.id );
		this.hw =0;
		this.dw = null;
		this.mL = document.getElementById( "galML" + this.id );
		this.mR = document.getElementById( "galMR" + this.id );

		//this.galTbl = document.getElementById('galTable' + this.id);
		//if( galTbl ) {
		//	this.dw = galTbl.offsetWidth<galTbl.offsetWidth ? galTbl.offsetWidth : galTbl.offsetWidth;
		//}
		var galPH = document.getElementById('galPrevHld' + this.id);
		if( galPH ) {
			this.hw = galPH.offsetWidth;
		}

		this.galdiv.style.left='0px';

		this.mL.firstChild.style.display='none';
		//if (this.dw > this.hw){
			this.mR.firstChild.style.display='';
		//} 	
}

TGal.prototype.scrlLeft = function() {
		this.dw = (this.dw==null? document.getElementById('galTable' + this.id).offsetWidth: this.dw);
		this.drc=0;
		this.doTmr();		
	}

TGal.prototype.scrlRight = function() {
		this.dw = (this.dw==null? document.getElementById('galTable' + this.id).offsetWidth: this.dw);
		this.drc=1;
		this.doTmr();
	}

TGal.prototype.doTmr = function() {
		if( this.galdiv ) {
			var pLeft = parseInt( this.galdiv.style.left );
			var doSrcl = false;

			if( this.drc ) {
				pLeft -= 5;
				if( pLeft >= ( this.hw - this.dw )-4 ) {
					doSrcl = true;
					this.mL.firstChild.style.display = '';
				} else {
					this.mR.firstChild.style.display = 'none';
				}
			} else {
				pLeft += 5;
				if( pLeft <= 0 ) {
					doSrcl = true;
					this.mR.firstChild.style.display = '';
				} else {
					this.mL.firstChild.style.display = 'none';
				}
			}

			if( doSrcl ) {
				this.galdiv.style.left= pLeft+'px';
				this.tmr = setTimeout( 'gal'+this.id+'.doTmr()', 5 );
			}
		}
	}

TGal.prototype.stopScrl = function() {
		if( this.tmr ) {
			clearTimeout( this.tmr );
		}
	}

function openPic( image ) {	
	win = window.open( '/showImage'+image, 'w', 'scrollbars=yes' );
return false;
}