

$(document).ready(function() {
	
	// Carousel image hover
	$('.ImageHover').hover(function() {
		$(this).stop().fadeTo("fast", 0.5);
	}, function() {
		$(this).stop().fadeTo("fast", 1);
	});
	
	// Carousel init
	$("#Carousel").jcarousel({
		buttonNextHTML: null,
		buttonPrevHTML: null, 
		size: $('#Carousel ul:first li').length,
		scroll: 1,
		auto: 5,
		wrap: 'both',
		wrapPrev: 1, 
		animation: '100',
		initCallback: function(carousel) {
			$('a.Next').bind('click', function() {
				$(this).blur();
				carousel.startAuto(0);
				carousel.next();
				return false;
			});
		
			$('a.Previous').bind('click', function() {
				$(this).blur();
				carousel.startAuto(0);
				carousel.prev();
				return false;
			});
		
			// Disable autoscrolling if the user clicks the prev or next button.
			carousel.buttonNext.bind('click', function() {
				carousel.startAuto(0);
			});
			carousel.buttonPrev.bind('click', function() {
				carousel.startAuto(0);
			});
		
			// Pause autoscrolling if the user moves with the cursor over the clip.
			$('#Carousel').hover(function() {
				carousel.stopAuto();
			}, function() {
				carousel.startAuto();
			});
		}
	});
	
	// Church search button
	$('#Carousel button').click(function() {
		$(this).blur();
	});
	
});

