//JQuery TABS
$(document).ready(function() {

	var cookieOptions = {expires: 7, path: '/'};
	var cookieIndexTabs = 'IndexTabs';
	
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	
	var tabsIndex = $.cookie(cookieIndexTabs);
	if (tabsIndex == null) {
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
	} else {
		$("ul.tabs li [href*="+tabsIndex+"]").parent().addClass("active"); //Activate first tab
		$("div [id="+tabsIndex+"]").fadeIn(); //Activate active div
		$(".tab_content [id="+tabsIndex+"]").show(); //Show first tab content
	}
	
	//On Click Event
	$("ul.tabs li").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
		
		var cookieVal = activeTab.replace("#", "");
		$.cookie(cookieIndexTabs, cookieVal, cookieOptions);
		return false;
	});
		
	// TABS - LEFT MENUS
		
	var cookieMenuTabs = 'MenuTabs';
	
	$(".menu_content").hide(); //Hide all content

	var MenuTabs = $.cookie(cookieMenuTabs);
	if (MenuTabs == null) {
		$("ul.menu_tabs li:first").addClass("left_active").show(); //Activate first tab
		$(".menu_content:first").show(); //Show first tab content
	} else {
		$("ul.menu_tabs li [href*="+MenuTabs+"]").parent().addClass(MenuTabs); //Activate first tab
		$("div [id="+MenuTabs+"]").show(); //Activate active div
		$(".menu_content [id="+MenuTabs+"]").show(); //Show first tab content
	}
	
		$("ul.menu_tabs li.left").click(function() {
		$("ul.menu_tabs li").removeClass("right_active"); //Remove any "active" class
		$(this).addClass("left_active"); //Add "active" class to selected tab
		$(".menu_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
		
		var cookieVal = activeTab.replace("#", "");
		$.cookie(cookieMenuTabs, cookieVal, cookieOptions);
		return false;
	});
		
		$("ul.menu_tabs li.right").click(function() {
		$("ul.menu_tabs li").removeClass("left_active"); //Remove any "active" class
		$(this).addClass("right_active"); //Add "active" class to selected tab
		$(".menu_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

		var cookieVal = activeTab.replace("#", "");
		$.cookie(cookieMenuTabs, cookieVal, cookieOptions);
		return false;
	});

});

//$(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
//	
//	$(".menu_content").hide(); //Hide all content
//	$("ul.left_menus li:first").addClass("left_active").show(); //Activate first tab
//	$(".menu_content:first").show(); //Show first tab content
//
//	//On Click Event
//	$("ul.tabs li").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
//		return false;
//	});
//	
//		// TESTING
//		
//		$("ul.left_menus li.left").click(function() {
//
//		$("ul.left_menus li").removeClass("right_active"); //Remove any "active" class
//		$(this).addClass("left_active"); //Add "active" class to selected tab
//		$(".menu_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
//		return false;
//	});
//		
//		$("ul.left_menus li.right").click(function() {
//
//		$("ul.left_menus li").removeClass("left_active"); //Remove any "active" class
//		$(this).addClass("right_active"); //Add "active" class to selected tab
//		$(".menu_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
//		return false;
//	});
//
//});
