var slideinter = false;
autostartslideshow = function()
{
	slideinter = setInterval('scrollDiv("auto")', 6000);
}

var ActiveScroll = false;
scrollDiv= function(direction)
{
	if (direction == 'auto')
	{
		var direction = 'fwd';
	}
	else if(slideinter)
	{
		clearInterval(slideinter);
	}
	if (ActiveScroll == false)
	{
		ActiveScroll = true;
		var current	= $$('.currentItem');
		var prevView	= current[0];
		var fwdCheck = 1;
		var backCheck = 0;
		var siblings		= prevView.siblings();
		var siblings		= $('slideshow').childElements();
		var totalLength		= siblings.length;
		
		if (direction == 'back') {
			var nextView	= prevView.previous();
			if (nextView == null)
			{
				nextView = siblings[totalLength-1];
			}
		}
		else if(direction == 'fwd') {
			var nextView	= prevView.next();
			if (nextView == null)
			{
				nextView = siblings[0];
			}
		}
		else {
			ActiveScroll	= false;
			return false;
		}
		if (nextView != null)
		{
			prevView.removeClassName('currentItem');
			nextView.addClassName('currentItem');
			new Effect.Fade(prevView, { afterFinish: 
			(
				function() {
					new Effect.Appear(nextView, { afterFinish: 
					(
						function() {
							ActiveScroll	= false;
						}
					)});
				}
			)});
		}
		ActiveScroll	= false;
	}
	return false;
}
