// Insanelly easy and light jQuery tabs by Bruno Cassol <brunocassol@gmail.com>
// Use this with html_tabs.php to generate html markup for it

$(document).ready(function(){
	$('.tabs div.tabs_content').hide();			// Hide all content divs

	// for each tab
	$('.tabs').each(function () {
		$('div.tabs_content:first', this).show();	// Show the first content div
		$('ul li:first', this).addClass('active'); 	// Activate first tab
	
		// when a tab is clicked
		var tab = this;
		$('ul li a', this).click(function(){ 	// When link is clicked
			$('ul li', tab).removeClass('active');	// Set all tabs to inactive
			$(this).parent().addClass('active'); 	// Set clicked tab to active
			var contentTab = $(this).attr('href');	// Find what content div to show
			$('div.tabs_content', tab).hide();		// Hide all divs
			$(contentTab).show(); 					// Show div with id equal to variable currentTab
			return false;
		});
	
		// when a tab is hovered
		$('ul li a', this).hover(
			function () {
				$(this).parent().addClass('hover'); 	// Add class to make it like hover
			}, 
			function () {
				$(this).parent().removeClass('hover'); 	//Set parent of clicked link class to active
			}
		);
	});
});