/*
    Javascript for a page in the Parkside website.
*/


var focussed = null;
var animating = false;


$(function() {
    
    // Animate the secondary nav.
    $("ul#nav-secondary ul").hide();
    $("ul#nav-secondary > li").mouseover(function() {
        focus($(this));
    });
    var here = $("ul#nav-secondary > li > a.here").parent();
    focussed = here.attr("id");
    $("ul", here).show();
    
    // Animate the calendar.
    $("div.feed table td").hover(function() {
        $("div.event-list", $(this)).show();
    }, function() {
        $("div.event-list", $(this)).hide();
    });
});


function focus(element) {
    var elementId = element.attr("id");
    if (elementId != focussed & $("ul", element).length > 0 & !animating) {
        animating = true;
        $("ul#nav-secondary ul:visible").slideUp("normal");
        $("ul", element).slideDown("normal", function() {
            animating = false;
        });
        focussed = elementId;
    }
}
