/***********
 From http://css-tricks.com/2282-simple-jquery-dropdowns/
 ***********/

$(function(){
    $("ul.dropdown li").hover(function(){
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
    }, 
    function(){
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');    
    });
    
    // $("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
});

// Added to set the drop-down menu width according to the 
// maximum amount of text in its items.
// (Yes, I [Ben G.] think that CSS should be able to handle this by itself.)
$(document).ready(function () {
    $("ul.dropdown ul").each(function () {
        var max = 0;
        $(this).find("li a").each(function (i, elem) {
            var textLength = $(elem).text().length;
            if (textLength > max)
                max = textLength;
        });
        $(this).css('width', ((max * 8) + 20) + 'px');
        max = 0;
    });
});
