$(document).ready(function() {
    // Suckerfish Dropdowns
    $("#nav li").hover(
        function(){ $("ul", this).fadeIn("slow"); }, 
        function() { } 
    );

    if (document.all) {
        $("#nav li").hoverClass ("sfhover");
    }

    // Check whether a cookie indicates whether to hide or show the map
    switch($.cookie('show_map')) {
        case 'true':
            $('#show').hide();
            break;
        case 'false':
            $('div#map').hide();
            $('#hide').hide();
            break;
        default:
            $('#show').hide();
            break;
    }

    $('#hide').click(function() {
        $('div#map').slideUp('700');
        $('#hide').hide();
        $('#show').show();
        $.cookie('show_map', false); // set cookie
    });

    $('#show').click(function() {
        $('div#map').slideDown('700');
        $('#show').hide();
        $('#hide').show();
        $.cookie('show_map', true); // set cookie
    });

    jumpSelect('#showingA');
    jumpSelect('#showingB');
});

function jumpSelect(selector) {    
    $(selector).change(function() { 
         document.location.href = $(selector + " option[@selected]").val();
         return false; 
    }); 
 }

$.fn.hoverClass = function(c) {
    return this.each(function() {
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};   
