$(function()
{

    var config = {
        interval: 100,      // number = milliseconds delay before onMouseOver
        over: showSubMenu,  // function = onMouseOver callback (REQUIRED)
        timeout: 250,       // number = milliseconds delay before onMouseOut
        out: hideSubMenu    // function = onMouseOut callback (REQUIRED)
    };

    function showSubMenu() {
        if($(this).children('ul').size()) {
            $(this).children('ul').show();
            $('#splash-wrapper #shadow').fadeIn('slow');
        }
    }

    function hideSubMenu() {
        if($(this).children('ul').size()) {
            $(this).children('ul').hide();
            if(!$('ul#nav li:hover').children('ul').size()) {
                $('#splash-wrapper #shadow').fadeOut('slow');
            }
        }
    }

    $('ul#nav li').hoverIntent(config);

    $('form.default-text input[type="text"]').each(function()
	{
		var _this = $(this);
		_this.defaultText().parents('form').submit(function()
		{
			// Only allow the submit if the search box contains user-entered text (i.e. it's not using the "search" text).
			if (_this.actualVal() == '')
			{
				return false;
			}
		});
	});

    $('.cross-fade').crossFade({ itemDuration: 5000, fadeDuration: 1000, startItem: 0, type: 'fader' });

});

