/*
 * --------------------------------------------------------------------
 * Simple Scroller
 * by Siddharth S, www.ssiddharth.com, hello@ssiddharth.com
 * Version: 1.0, 05.10.2009 	
 * --------------------------------------------------------------------
 Edited by Jenna Simmons
 */

$(document).ready(function() 
{	 
	var index = 0;
	var images = $("#gallery img");
	$(images).slice(0,3).clone().appendTo("#images");
	for (i=0; i<images.length; i++)
	{
		$(images[i]).addClass("image-"+i);
	}
	
	setInterval(sift, 8000);
	$("#next").click(sift);
	show(index);
	
	
	function sift()
	{
		if (index<(images.length-1)){index+=1 ; }
		else {index=0}
		show (index);
	}
	
	function show(num)
	{
		$(images).fadeOut(400);
		$(".image-"+num).stop().fadeIn(400);		
	}
});
