// JavaScript Document

$(document).ready(function () {
    /*
    var highestCol = Math.max($('#central-pane').height(), $('#right-pane').height());
    $('#central-pane').height(highestCol);
    $('#right-pane').height(highestCol);
    $('#content').height(highestCol);
    */
    $("#menu-aleces-link").data("submenu", "#submenu-aleces");
    $("#menu-services-link").data("submenu", "#submenu-services");
    $("#menu-brainspotting-link").data("submenu", "#submenu-brainspotting");
    $("#menu li").data("selected","false");
    $(function () {
        var path = location.pathname.substring(0);
        if (path) {
            $('#menu a[href$="' + path + '"]').parent().addClass('current-link');
            var sm = $('#menu a[href$="' + path + '"]').parent().data("submenu");
            var sm = $('#menu a[href$="' + path + '"]').parent().data("selected", "true");
            $(sm).slideDown(300);
        }
    });
    /*
    $("#menu li").find("a[href='" + window.location.href + "']").each(function () {
    $(this).addClass("current-link");
    //add your own logic here if needed
    })*/
    if ($.browser.msie) {
        var option = {
            x: 0,
            y: 0,
            radius: 3,
            color: "#ffffff"
        }
        $("#ftul a").hover(function () { $(this).textShadow(option); }, function () { $(this).textShadowRemove(); });
    }

    $("#menu-aleces-link").mouseenter(function (event) {
        $(this).css("font-weight", "bold");
        $('.submenu').not('#menu-aleces-link').hide();
        $('#menu li').not('#menu-aleces-link').css("font-weight", "normal");
        $("#submenu-aleces").slideDown(300);
    });

    $("#menu-services-link").mouseenter(function (event) {
        $(this).css("font-weight", "bold");
        $('.submenu').not('#menu-services-link').hide();
        $('#menu li').not('#menu-services-link').css("font-weight", "normal");
        $("#submenu-services").slideDown(300);
    });

    $("#menu-brainspotting-link").mouseenter(function (event) {
        $(this).css("font-weight", "bold");
        $('.submenu').not('#menu-brainspotting-link').hide();
        $('#menu li').not('#menu-brainspotting-link').css("font-weight", "normal");
        $("#submenu-brainspotting").slideDown(300);
    });

    $("#menu-space").mouseleave(function (event) {
        $(".submenu").each(function (index, element) {
            if ($(this).data("selected") == "false") {
                $(this).hide();
            }
        });
        //$(".submenu").hide('fast');
        $('#menu li').css("font-weight", "normal");
    });

});
