// JavaScript Document
$move_bytwo = 560;
$frame_lefttwo = 0;
$frame_notwo = 1;




$(document).ready(function()
{
	
	$max_clickstwo = $("#image_containertwo").children().size(); 	
	
	/* Kudos to Rob MacKay [http://www.twitter.com/svgrob] for suggesting that we don't have to put a static style="width: 3960px" attribute in the div tag */
		$(".prevtwo").fadeOut();
	$(".prevtwo").click(function()
		{
   			/* Set the new position & frame number */
			$new_frame_notwo = (($frame_notwo/1)-1);

			$new_lefttwo = (($frame_lefttwo/1) + $move_bytwo);
			/* Check if we're moving too far over */
			if($new_frame_notwo == 1)

				{$(".prevtwo").fadeOut();			}
			else if($frame_notwo == $max_clickstwo )
				{$(".nexttwo").fadeIn();}
			
			if($new_frame_notwo <= 0)
				{
					/* Move the images all the way left, minus one frame */
					$new_lefttwo = -($move_bytwo*$max_clickstwo)+$move_bytwo;
					$new_frame_notwo = $max_clickstwo;
					   
				}
			$new_left_attrtwo = $new_lefttwo+"px";
			$("#image_containertwo").animate({left: $new_left_attrtwo}, 800 );
			$frame_lefttwo = $new_lefttwo;
			$frame_notwo = $new_frame_notwo;
			
		});
	$(".nexttwo").click(function()
		{
			/* Set the new position & frame number */
			$new_frame_notwo = (($frame_notwo/1)+1);
			$new_lefttwo = (($frame_lefttwo/1) - $move_bytwo);
			/* Check if we're moving too far over */
			
			if ($new_frame_notwo == $max_clickstwo)
				{$(".nexttwo").fadeOut();}
			else if ($frame_notwo == 1)
			{$(".prevtwo").fadeIn();}
			
			if($new_frame_notwo > $max_clickstwo)
				{		
						/* Move all the way right, to the beginning*/
					$new_lefttwo = 0;
					$new_frame_notwo = 1;
				
				}				
			$new_left_attrtwo = $new_lefttwo+"px";
			
			$("#image_containertwo").animate({left: $new_left_attrtwo}, 800 );
			$frame_lefttwo = $new_lefttwo;
			$frame_notwo = $new_frame_notwo;
		});	
});







