$(document).ready(function() {
    //Default Tab Action
    $(".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 Tab 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 rel attribute value to identify the active tab + content
        var activeLink = activeTab.replace("#","DutySmith.com - ");
        $(document).attr("title", activeLink);
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });
    //example of binding an image click to loading of a tab
    $(".gotoproducts").click(function() {
        $("#products_tab").trigger("click");
    });
    
    //Sub for about tables
    $('#about_sub').pager('table', {
        navId: 'about_nav',
        navAttach: 'prepend',
        linkText: ['Innovation', 'Where to buy', 'FAQ', 'Contact']
    });
    //Sub products tables
    $('#products_sub').pager('table', {
        navId: 'product_nav',
        navAttach: 'prepend',
        linkText: ['Duty Belt', 'Radio', 'Baton', 'Cuff', 'Flash / OC', 'Glove & Key', 'Keepers']
    });
    
    //Sub Menu Product class triggers
    $(".gotoDutyBelt").click(function() {
        $("#products_tab").trigger("click");
        $("#DutyBelt").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Duty Belt");
    });
        $(".gotoRadio").click(function() {
        $("#products_tab").trigger("click");
        $("#Radio").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Radio Holster");
    });
        $(".gotoBaton").click(function() {
        $("#products_tab").trigger("click");
        $("#Baton").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Baton Holder");
    });
        $(".gotoCuff").click(function() {
        $("#products_tab").trigger("click");
        $("#Cuff").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Cuff Case");
    });
        $(".gotoFlashOC").click(function() {
        $("#products_tab").trigger("click");
        $("#FlashOC").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Flashlight / OC Holder");
    });
        $(".gotoGloveKey").click(function() {
        $("#products_tab").trigger("click");
        $("#GloveKey").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Glove &amp; Key Holder");
    });
        $(".gotoKeepers").click(function() {
        $("#products_tab").trigger("click");
        $("#Keepers").trigger("click");
        $(document).attr("title", "DutySmith.com > Products > SpeedSet Keepers");
    });
    
    ///fader function
    $(function () {
	    $('h1 a').css('background-position', 'bottom left');
	    $('h1 a').hover(function () {
		    $(this).find('strong').fadeOut('fast');
	    }, function () {
		    $(this).find('strong').fadeIn('fast');
	    });
    });
    
});

