$(function(){

    //hide all submenus
    $('#Navigation .secondaryNode, #Navigation .tertiaryNode').hide();

    //primary nav button event
    $('#Navigation .primaryNode').mouseover(function(){
        $(this).children('.title').addClass('hover');
        $(this).find('.secondaryNode').show();
    });

    $('#Navigation .primaryNode').mouseout(function(){
        $(this).children('.title').removeClass('hover');
        $(this).find('.secondaryNode').hide();
    });

    $('#Navigation .secondaryMenu').mouseover(function(evt){
        $(this).find('.tertiaryNode').show();
    });

    $('#Navigation .secondaryMenu').mouseout(function(evt){
        $(this).find('.tertiaryNode').hide();
        var reltar = evt.relatedTarget || evt.toElement;
        if ( $(reltar).parents('.secondaryMenu').length > 0 ) return false;
    });

});
