<!--

var moving = false;

$(function() {

	$("#move_right").click(function(){
		
		var left = $("#scrollGallery").css("left");	
		//var display = $("#move_up").css("display");
		var width = $('#scrollGallery').innerWidth();
		var containerWidth = $("#galleryContainer").css("width");
				
		left = left.replace("px","")
		containerWidth = containerWidth.replace("px","")
			
		left = parseInt(left)
		containerWidth = parseInt(containerWidth)
		
		var maxLeft = width - containerWidth;
			
		maxLeft = maxLeft - (maxLeft*2);
			
		var nextLeft = left - 642;
	
		if (nextLeft < maxLeft) {			
			nextLeft = maxLeft;
		}
		
		/*if (display == "none") {		
			$("#move_up").css("display","inline");
		}*/
		
		if (moving == false) {	
			
			if (width > containerWidth) {				
				moving = true;
				$("#scrollGallery").animate({"left": nextLeft}, 500,function(){
					 moving = false;
					 if (nextLeft == maxLeft) {
						//$("#move_down").css("display","none");
					}				 
				});
			}	
		}
	});	
	
	$("#move_left").mousehold(function(){
		var left = $("#scrollGallery").css("left");	
		//var display = $("#move_down").css("display");	
		left = left.replace("px","")	
		left = parseInt(left)
			
		maxLeft = 0;
		
		var nextLeft = left + 642;
		
		if (nextLeft > maxLeft) {		
			nextLeft = maxLeft;	
		}
		
		/*if (display == "none") {		
			$("#move_down").css("display","inline");
		}*/
		
		if ((left < 0) && (moving == false)) {
			moving = true;
			$("#scrollGallery").animate({"left": nextLeft}, 500,function(){
				 moving = false;
				 if (nextLeft == maxLeft) {
					//$("#move_up").css("display","none");
				}	
			});
		}
		
	
	});	
	
	
			 				   			
});
//-->
