/**
 * fsTabNavigator Object
 * Has the functionality to binding the tabs of the navigator
 */

var fsTabNavigator = {
	tb: null,
	btns: null,
	conts: null,
	
	init:function(idTab){
		this.tb = $("#"+idTab);
		this.btns = this.tb.find(".fsTabNav-buttonBar li");
		this.conts = this.tb.find(".fsTabNav-bodyContent");
		this.btns.each(function(i,e){
			$(e).bind("click",function(){
				var id = $(e).attr("id");
				fsTabNavigator.showContent(id);
				
				//Add Google Analytics trackPageview for the tabs
				var naviname = idTab.split("-")[1];
				var tabname = id.split("-tab")[0];
				var trackTabName = naviname+"_"+tabname;
				pageTracker._trackPageview("/products/fluid_social/"+trackTabName);
			});
		});
	},
	showContent:function(id){
		this.hideContent();
		$("#"+id).addClass("tabActive");
		var idBody = "#" + id.split("-")[0] + "-content";
		$(idBody).show();
	},
	hideContent:function(){
		this.btns.each(function(i,e){
			if($(e).hasClass("tabActive")) $(e).removeClass("tabActive")
		});
		this.conts.each(function(i,e){
			$(e).hide();
		});
	}
}
