﻿$(function () {
    var clickHandler = function () {
        // hide everything in the column
        var container = $(this).closest(".columncontent");
        container.find(".moreinfo").hide();

        // show the particular div targeted by the link.
        var target = $(this).attr("data-target");
        var div = $("#" + target);
        div.fadeIn();

        // removes active class from all links
        container.find(".active").removeClass("active");

        // applies active class to clicked link
        $(this).addClass("active");

        // Stop the browser following the link!
        return false;
    };

    $(".subnav a").click(clickHandler);
    $(".moreinfo").hide();
    $(".subnav li:first-child a").click();
});
