/*
* based on Skeleton V1.1 by Dave Gamache
* modified by James Tauber under MIT license
*/

$(function() {
    var tabs = $(".tabs");
    
    tabs.each(function(i) {
        
        // Get all tabs
        var tab = $(this).find("> a");
        tab.click(function(e) {
            
            // Get Location of tab's content
            var contentLocation = $(this).attr("href");
            
            // Let go if not a hashed one
            if (contentLocation.charAt(0) == "#") {
                
                e.preventDefault();
                
                // Make Tab Active
                tab.removeClass("active");
                $(this).addClass("active");
                
                // Show Tab Content & add active class
                $(contentLocation).show().addClass("active").siblings().hide().removeClass("active");
            }
        });
        tab.hover(function(e) {
            
            // Get Location of tab's content
            var contentLocation = $(this).attr("href");
            
            // Let go if not a hashed one
            if (contentLocation.charAt(0) == "#") {
                
                e.preventDefault();
                
                // Make Tab Active
                tab.removeClass("active");
                $(this).addClass("active");
                
                // Show Tab Content & add active class
                $(contentLocation).show().addClass("active").siblings().hide().removeClass("active");
            }
        });
    });
});
