jQuery(document).ready(function($){
	$("a.youtube").colorbox({iframe:true, innerWidth:560, innerHeight:345});
	$('#loopedCarousel a.colorbox').colorbox({rel:'footergal'});
	$('.clearOnFocus,input[type=text]').clearOnFocus();
	
	// Accordions
	$('.element').hide();
	$('.accordion').click(function(){
		var element = $(this).nextAll('.element');
		element.slideToggle().addClass('toggled');
		$('.element:not(.toggled)').slideUp();
		element.removeClass('toggled');
	});
	
	function mycarousel_initCallback(carousel)
	{
		// 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.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	};

	$('#mycarousel').jcarousel({
		auto: 2,
		wrap: 'circular',
		animation: 'slower',
		initCallback: mycarousel_initCallback
	});
	
	$("#loopedCarousel div a span img").css("opacity", "0.5");
	$("#loopedCarousel div a span").hover(function(){
		$(this).find("img").fadeTo(300, 1)
		}, function(){
		$(this).find("img").fadeTo(300, 0.3)
	});
	
});
