$(document).ready(function() {
	// Set up sliders.
	if(typeof $.jcarousel == 'function') {
		$('#slider-short .slides').addClass('jcarousel-skin-n4').jcarousel({
			scroll: 4,
			wrap: 'both'
		});
		$('#slider-tall .slides').addClass('jcarousel-skin-n4').jcarousel({
			scroll: 1,
			wrap: 'both'
		});
	}
	
	// Lightbox, go!
	if(typeof $.fancybox == 'function') {
		$("a.lb").fancybox({
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
			    return '<span id="fancybox-title-over">' + title + ' (Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ')</span>';
			}
		});
	}
	
	if(!($.browser.msie && parseInt($.browser.version) == 6)) {
		
	};

	
	// Sliders, sIFR and show/hide tabs were being troublesome so load everything and shove the hidden tabs way out of the viewport.
	$('#tab-content').children().not(':first-child').addClass('hidden-tab-content').fadeTo('fast', 0.01);
	
	// Clicking on tab links shows the new tab and hides the previous.
	$('#tab-links a').click(function(){
		$('#tab-links li').removeClass('active');
		$(this).parent().addClass('active');
		
		var $tab_content = $('#'+$(this).attr('id').replace('link-', ''));
		$tab_content.removeClass('hidden-tab-content').fadeTo('normal', 1);
		$tab_content.siblings().addClass('hidden-tab-content').fadeTo('fast', 0.01);
		
		return false;
	}).first().parent().addClass('active');
});