// JavaScript Document for tabs
(function($) {
    $(document).ready(function() {

        //On Click Event
        $("ul.tabs_strip li a").click(function() {

            $("ul.tabs_strip li").removeClass("active"); //Remove any "active" class
            $(this).parent().addClass("active"); //Add "active" class to selected tab
            var allTabs = $(".tab_content");

            if (allTabs.length > 0) {
                var visibleTab = allTabs.filter(':visible');
                var dummy = $('<div class="tab_content" style="position: absolute; top: ' + visibleTab.position().top + 'px; width: ' + visibleTab.width() + 'px; height: ' + visibleTab.height() + 'px; z-index: 999;"></div>');

                visibleTab.parent().append(dummy);
                visibleTab.css('visibility', 'hidden');
                dummy.css('z-index', '9'); //lower the z index so the new active tab will fade in above the dummy

                var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
                $(activeTab).fadeIn(); //Fade in the active ID content
                visibleTab.hide().css('visibility', 'visible');
                dummy.remove();
            }

            return false;
        });
    });
})(jQuery);
