$(document).ready(function() {
	$('#banner #slider ul li').css('display', 'block');
	if (document.getElementById('body-home')) {
		$('#slider').jcarousel({

			wrap: 'both',
			initCallback: mycarousel_initCallback,
			scroll: 1,
			auto:10,
			itemVisibleInCallback: {
				onAfterAnimation: function(c, o, i, s) {
					--i;
					$('.jcarousel-control a').removeClass('selected');
					$('.jcarousel-control a:eq('+i+')').addClass('selected');
				}
			}
		});
	};
	try {
		Cufon.replace('h2.avenir');	
		Cufon.replace('h3.avenir');
	}
	catch(err) {}
	$('h2.avenir').fadeTo(300, 1); 
	$('h3.avenir').fadeTo(300, 1);
	
	if ($(document).width() <= 960) {
		$('body').css('overflow-x', 'scroll');	
	}
	
	$(function() {
		try {
			$('.launchLightbox a').lightBox();
		}
		catch(err) {}
	});
});
$(window).resize(function() {
	if ($(document).width() <= 960) {
		$('body').css('overflow-x', 'scroll');
	} else {
		$('body').css('overflow-x', 'hidden');	
	}

});	
	
// carousel thing
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();
	});
	
	jQuery('.jcarousel-control a').bind('click', function() {
		carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
		return false;
	});

};

