var TweenGallery	=	null;	
var clicks			=	1;
var productGroup1	=	null;

//global vars for the gallery
var numPages		=	5;
var maxDistance		=	-2700;
				
function MoveGallery(MoveLeft)
{
	var distance	=	0;
	var modifier	=	900;
	
	//calculate the distance to move the object
	distance		=	(!MoveLeft) ? parseInt(productGroup1.style.left) - modifier : parseInt(productGroup1.style.left) + modifier;		
	
	//set the function to use
	TweenGallery.func	=	eval(Tween.backEaseOut);	
	
	//only update if the tween has completed
	if(!TweenGallery.isPlaying)
	{
		//update the user clicks
		if(!MoveLeft)
			clicks++;
		else 
			clicks--;
		
		//reset
		if(clicks == numPages && !MoveLeft)
		{
		     clicks = 1;
		     distance = 0;		     
	 	}	
		else if(clicks == 0 && MoveLeft)
		{
		     clicks = numPages-1;
		     distance = maxDistance;		     
		}

		//move the object
		TweenGallery.continueTo(distance, 1);
	}
}
