//	Last Modified:	Wednesday, September 9, 2009 10:09:18 AM
var currentImg = 0;
$(document).ready(function(){
	if( $('.gallery').length > 0 && $('.info').length > 0 )
	{
		createGallery();	
	}
});

function createGallery()
{
	// rip stuff out, stick it where it needs to go...
	$('#block').append('<div class="clear"></div>');
	$('.gallery').remove().prependTo('#block');
	$('.info').remove().prependTo('#block');
	$('#block').height(295).css({backgroundImage: 'none', paddingBottom: '10px'});
	$('.gallery').children('img:not(:first)').hide().css('z-index', '0');
	if($('.gallery').children('img').length > 1)
	{
		$('.gallery').children(':not(img)').remove();
		setInterval (function(){rotateImages('.gallery')}, 5500);
	}
}

function rotateImages(className)
{
	var prevImg = currentImg;
	currentImg++;
	currentImg %= $(className).children('img').length;
	$(className).children('img').eq(prevImg).css('z-index',0).show();
	$(className).children('img').eq(currentImg).hide().css('z-index','100').fadeIn('slow', function(){
		$(className).children('img').eq(prevImg).hide();
	});
	
	
}