var deltaX = 5;
var deltaT = 42;	
var imageWidth = 60;

$(document).ready (function ()
{
	$("#container4 img").click (changeViewportImage4);
	setTimeout("animate4()", deltaT); //start animation
});

function changeViewportImage4 ()
{
	$("#viewport4 img").remove ();
	$("#viewport4").append ($(this).clone ());
}

function animate4 ()
{
	var left = parseInt ($("#container4 img").css("left"));
	left -= deltaX;

	if (left <= -imageWidth) //if first image is no longer visible
	{
		left += imageWidth;
		$("#container4 img:first")
		    .remove ()
		    .insertAfter("#container4 img:last")
		    .click (changeViewportImage4);
	}

	$("#container4 img").css("left", left + "px");

	setTimeout ("animate4()", deltaT); //continue animation
}

