/// AUDIO SECTION SCRIPT

var current_tab = null;

$(document).ready(
	function() {
		initDivs();
		initTabs();
		
		
		var currentURL = window.location;
		if (currentURL.hash == "#mono") $('#tab2').click();
		if (currentURL.hash == "#inyo") $('#tab3').click();
	}
);

function initDivs() {
	$('.tab_wrapper').hide();
	current_tab = 1;
	showTab(current_tab);
}

function initTabs() {
	$('.tab').click(swapToTab);
}

function swapToTab(tab) {
	tab_num = this.id.substr('tab'.length);
	$('#tab'+current_tab).removeClass('active');
	hideTab(current_tab);
	showTab(tab_num);
	setTitle( $(this).attr('alt') );
	current_tab = tab_num;
	return false;
}

function showTab(tab_num) { // id= tab_<num> is the tab content div and id= tab<num> is the tab button
	$('#tab_wrapper_'+tab_num).show();
	$('#tab'+tab_num).addClass('active');
}

function hideTab(tab_num) {
	$('#tab_wrapper_'+tab_num).hide();
}

function setTitle(title)
{
	$('#main_date').html(title);
}

// JavaScript Document