/* HOME JS */

$(document).ready(function(){
	
	$('#coda-slider-2').codaSlider({ dynamicArrows: true, dynamicTabs: true });
	
	/* Change the Profile Nav based on a click */
	$(".next_panel a.xtrig").click( function() {
		var caller = $(this).parent().parent().attr('class');
		if (caller == 'link-1') {
			$('.next_panel .link-1').hide();
			$('.next_panel .link-2').fadeIn('slow');
		} else {
			$('.next_panel .link-2').hide();
			$('.next_panel .link-1').fadeIn('slow');
		}
		
		return false;
	});
	
	// Mini-carousel for In Other News (ion);
	$(".ion_container .ion_panel").each(function() {
		$(this).hide();
	});
	$(".ion_container .ion_panel").eq(0).show();
	
	$("#other_news #tabs li").each(function() {
		var myIndex = $("#other_news li").index(this);
	
		$(this).click(function() {
		
			if ($(this).attr('class') == 'active') {
				// Do nothing, tab already selected;
			
			} else {
				// Show a new tab panel;
				$(".ion_container .ion_panel").each(function() {
					$(this).hide();
				});
			
				$(".ion_container .ion_panel").eq(myIndex).fadeIn("slow");
				$("#other_news li").each(function() {
					$(this).removeClass('active');
				});
				$(this).addClass('active');
			}
		});
	});
	
	
	// Get latest Twitter statii;
	// Done this way to decrease page load time;
	$.get('http://www.aaronyates.co.uk/wp-content/themes/airs2010/_includes/php/twitter.php', function(data) {
		$('ul.twitter_ion').html(data);
	});
});
