var timeout;
var currentShotNumber = 2;
var maxShotNumber = 8;
var speed = 4000;

function showNextScreenshot(){
	$("#iphone_screenshots").animate({ opacity: 0, marginLeft: "-30px", }, 300 )
	.animate({ marginLeft: "30px", }, 1 )
	.animate({ backgroundPosition: "0 -" + (currentShotNumber*282-282) + "px", }, 1 )
	.animate({ opacity: 1, marginLeft: "0px", }, 243 );

	timeout = setTimeout(function(){
		showNextScreenshot();
	}, speed);
	
	currentShotNumber += 1;
	
	if (currentShotNumber > maxShotNumber)
		currentShotNumber = 1;
}

$(document).ready(function(){
	timeout = setTimeout(function(){
		showNextScreenshot();
	}, speed);
});
