
var prevTab = "tab1";

/*$(document).ready(function() {

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li a").click(function() {
		
		//$("ul.tabs li").removeClass("active"); //Remove any "active" class
		//$(this).addClass("active"); //Add "active" class to selected tab
		//$(".tab_content").hide(); //Hide all tab content

		//var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		//$(activeTab).fadeIn(); //Fade in the active ID content
		
		 //alert($(this).attr('href'));
		 //$.address.value(activeTab.replace(/#/, ''));
		return $(this).attr('href').replace(/^#/, '');
		//return false;
	});

});


$.address.change(function(event) {
						  
	//$("ul.tabs li").removeClass("active"); //Remove any "active" class
	//$(this).addClass("active"); //Add "active" class to selected tab
	$(prevTab).hide(); //Hide all tab content
	
	if(event.value == ""){
		$(".tab_content:first").show(); //Show first tab content
	} else {
		$('#'+ event.value).fadeIn();
	}
	

}); 

*/
 // Event handlers
$.address.init(function(event) {
	$(".tab_content").hide(); //Hide all content
	
	$("ul.tabs li a").click(function() {
		return $(this).attr('href').replace(/^#/, '');
	});
}).change(function(event) {
	if(event.value != "") {
		
		$('#'+ prevTab).hide(); //Hide all tab content
		prevTab = event.value;
		
		$('#'+ event.value).show();
	} else {
		//if(event.value == "") {
			$('#'+ prevTab).hide(); //Hide all tab content
			$(".tab_content:first").show(); //Show first tab content
			prevTab = "tab1";
		//}
	}
	
	
	
});

