/* col2: photo gallery */
function scrollImage(dir) {	 
if(scrollImage != 0) {

	//move left
	if(dir != 0) {
		if(scrollImageCounter == 0) { $('scrollimgmoveright').style.left = scrollImageWidth }
		//reset the photo containers and the counter 
		if(scrollImageCounter == (scrollImageTotal-(scrollImageTotal*2))) { 
			$('scrollimgmoveleft').style.left = '0px'; 
			$('scrollimgmoveright').style.left = scrollImageWidth;
			scrollImageCounter = 0}	
				scrollImageCounter = scrollImageCounter -1;
				Effect.MoveBy( 'scrollimgmoveleft', 0, -80, { 
				beforeStart: function() { disablescrollimgBtns(0); }, afterFinish: function() { disablescrollimgBtns(1); }, duration:1} ); 
				Effect.MoveBy( 'scrollimgmoveright', 0, -80, {duration:1} );
							
		} else { 
		
		//move right
		if(scrollImageCounter == 0) { $('scrollimgmoveright').style.left = scrollImageWidthRight; }
		//reset the photo containers and the counter 
		if(scrollImageCounter == scrollImageTotal) { 
			$('scrollimgmoveleft').style.left = '0px'; 
			$('scrollimgmoveright').style.left = scrollImageWidthRight;
			scrollImageCounter = 0}
				scrollImageCounter = scrollImageCounter +1;
				Effect.MoveBy( 'scrollimgmoveleft', 0, 80, { 
				beforeStart: function() { disablescrollimgBtns(0); }, afterFinish: function() { disablescrollimgBtns(1); }, duration:1} ); 
				Effect.MoveBy( 'scrollimgmoveright', 0, 80, {duration:1} ); 
		}
	}
}	

//this function deactivates button while photo gallery is moving
function disablescrollimgBtns(active) {	
	if(active == 0) { 
		$('scrollimgcontainer').style.width = '640px';
		$('scrollimgcontainer').style.clip = 'rect(auto auto auto auto)';
		$('scrollimgbtnright').onclick =  null;
		$('scrollimgbtnleft').onclick =  null }
	if(active == 1) { 
		$('scrollimgcontainer').style.width = '640px';
		$('scrollimgcontainer').style.clip = 'rect(auto auto auto auto)';
		$('scrollimgbtnright').onclick =  scrollImage;
		$('scrollimgbtnleft').onclick =  new Function("scrollImage("+0+")");
		}
}

