﻿$(document).ready(function() {



    var primarySection = jQuery.url.segment(0);
    var primaryPage = jQuery.url.segment(1);


    var secondarySection = jQuery.url.segment(1);
    var secondaryPage = jQuery.url.segment(2);


    /** MAKE DIVS CLICKABLE **/



    $("#mnFind").click(function() {

        window.location = $(this).attr("url");

    }

    );

    $("#mnExperience").click(function() {

        window.location = $(this).attr("url");

    }

    );

    $("#mnEvents").click(function() {

        //window.location = $(this).attr("url");

    }

    );


    $("#mnInvesting").click(function() {

        window.location = $(this).attr("url");

    }

    );


    $("#mnLeasing").click(function() {

        window.location = $(this).attr("url");

    }

    );


    $("#mnMarketplace").click(function() {

        window.location = $(this).attr("url");

    }

    );

    $("#mnPartners").click(function() {

        window.location = $(this).attr("url");


    }

    );




    /** subnav divs clickable **/


    $(".secondary").click(function() {
        window.location = $(this).find("a").attr("href");
        return false;

    });



    /** ROLLOVERS **/



    if (primarySection == "experience") {
        $("#mnExperience").addClass("active");

    }

    if (primarySection == "find") {
        $("#mnFind").addClass("active");

    }

    if (primarySection == "leasing") {
        $("#mnLeasing").addClass("active");

    }

    if (primarySection == "giftsevents") {
        $("#mnEvents").addClass("active");
        
        var id = $.query.get("id");
        if (id != null) {

            if ($("div[name=" + id + "]")) {
                $("div[name=" + id + "]").addClass("selected");
                $("a[href$=giftsevents/style/stylist.aspx?id=" + id + "]").addClass("selected");
            }
            
            if ($("div[name=" + id + "]")) {
                $("div[name=" + id + "]").addClass("selected");
                $("a[href$=giftsevents/gift.aspx?id=" + id + "]").addClass("selected");
            }

        }
    }

    if (primarySection == "investing") {
        $("#mnInvesting").addClass("active");

    }

    if (primarySection == "development") {
        $("#mnMarketplace").addClass("active");

    }

    if (primarySection == "partners") {
        $("#mnPartners").addClass("active");

    }









    $("#overviewMenu").hover(function() {

        $("#overviewMenu").addClass("hover");
    },
        function() {
            $("#overviewMenu").removeClass("hover");
        });



    $("#peopleMenu").hover(function() {

        $("#peopleMenu").addClass("hover");
    },
        function() {
            $("#peopleMenu").removeClass("hover");
        });




    $("#newsMenu").hover(function() {

        $("#newsMenu").addClass("hover");
    },
        function() {
            $("#newsMenu").removeClass("hover");
        });



    $("#socialMenu").hover(function() {

        $("#socialMenu").addClass("hover");
    },
        function() {
            $("#socialMenu").removeClass("hover");
        });



    $("#tourismMenu").hover(function() {

        $("#tourismMenu").addClass("hover");
    },
        function() {
            $("#tourismMenu").removeClass("hover");
        });

    $("#boardMenu").hover(function() {

        $("#boardMenu").addClass("hover");
    },
        function() {
            $("#boardMenu").removeClass("hover");
        });


    $("#execMenu").hover(function() {

        $("#execMenu").addClass("hover");
    },
        function() {
            $("#execMenu").removeClass("hover");
        });



    $("#seniorMenu").hover(function() {

        $("#seniorMenu").addClass("hover");
    },
        function() {
            $("#seniorMenu").removeClass("hover");
        });


    $("#socialMenu").hover(function() {

        $("#socialMenu").addClass("hover");
    },
        function() {
            $("#socialMenu").removeClass("hover");
        });



});