// JavaScript Document


Event.observe(window, "load", function() {
	hideAllTabs(); //hide all the tabs
	$$('ul.inpageTabs a').invoke('observe','click', swapTabs); //add listener to each tab
	setUpDefaultTab();
});

function swapTabs(e){
	var tab = Event.findElement(e, 'a').id; //get the id of the tab	
	var startPoint = tab.length - 3; 
	var whichTab = tab.substr(0, startPoint) + "Content"; 
	
	hideAllTabs(); //hide all the tabs
	resetHighlight();
	$(whichTab).show() //show the selected content
	$(tab).addClassName('selected-tab'); //highlight tab
	
	Event.stop(e);
	return true;
}

function hideAllTabs(){
	$$('div.inpageTabContent').invoke('hide'); //hide all the tabs	
}

function resetHighlight(){
	$$('ul.inpageTabs a').invoke('removeClassName','selected-tab');	
}

function setUpDefaultTab(){
	/*
	if($('exposureContent')){
		defaultTab = 'exposure';
	} else {
		defaultTab = 'keyfacts';
	}
	*/
	defaultTab = 'tab1';
	$(defaultTab+'Content').show() //show default content
	$(defaultTab+'Tab').addClassName('selected-tab'); // select default tab
}
