var intervalHandler;
var images = [];
var curIndex = -1;

function next() 
{
	curIndex++;
	if (curIndex >= images.length) 
	{
		curIndex = 0;
	}
	show();
}

function show()
{
	$('p').src = images[curIndex].src;
}

function showImage(index)
{
	curIndex = index - 1;
	show()
}

function back() 
{
	curIndex--;
	if (curIndex == 0) 
	{
		curIndex = images.length - 1;
	}
	show();
}

function startSlideShow() 
{
	next();
	intervalHandler = setInterval("slideShow()", 4000);
}

function stopSlideShow()
{
	clearInterval(intervalHandler);
}

function slideShow()
{
	next();
}
