if(jQuery)
{
	$ = jQuery;
	var slider = '';
	var imgs = '';
	
	function show_specified(index_to_show, index_to_hide, image_set)
	{
		var img_to_hide = $(image_set.get(index_to_hide));
		var img_to_show = $(image_set.get(index_to_show));
		img_to_show.css('visibility', 'visible');
		img_to_hide.fadeTo(500, 0, 'linear', function()
		{
			img_to_hide.css('visibility', 'hidden');
			img_to_hide.css('zIndex', 1);
			
		});
		img_to_show.fadeTo(500, 100, function()
		{
			img_to_show.css('zIndex', 10);
			var t = setTimeout('advanceImages()', 6000);
		});
	}
	
	function advanceImages()
	{
		var position = 0;
		var next_position = 0;
		imgs.each(function(index, element)
		{
			if( $(element).css('visibility') != 'hidden')
			{
				position = index;
			}
		});
		if(position == (imgs.size() - 1))
		{
			next_position = 0;
		}else
		{
			next_position = position + 1;
		}
		show_specified(next_position, position, imgs);
	}
	
	$(document).ready(function()
	{
		slider = $('#img-slider');
		if(slider != null)
		{
			imgs = slider.children('a');
		
			imgs.first().css('visibility', 'visible');
			advanceImages();
		}
	});
}
