$(document).ready(function() {
	if($('.scroll-pane').length != 0)
	{
		$('.scroll-pane').jScrollPane({
			verticalDragMinHeight: 24,
			verticalDragMaxHeight: 24
		});
	}
		
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	
	var tab = window.location.search.match(new RegExp("tab=(\\d+)", "i"));
	tab = (tab == null) ? null : parseInt(RegExp.$1);
	
	if(tab != null)
	{
		$("ul.tabs li:eq("+(tab-1)+")").addClass("InnerActive").show(); //Activate first tab
		$("#tab"+tab).show(); //Show first tab content
	}
	else
	{
		$("ul.tabs li:first").addClass("InnerActive").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
	}
	
	//On Click Event
	$("ul.tabs a").click(function() {
		
		$("ul.tabs li").removeClass("InnerActive"); //Remove any "active" class
		$(this).parent().addClass("InnerActive"); //Add "active" class to selected tab
		

		var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
		$('#pnlBrands.tab_container').height($(activeTab).outerHeight());
		$(".tab_content").hide(); //Hide all tab content
		$(activeTab).fadeIn(); //Fade in the active ID content	
		return false;
	});	
});
