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