jQuery(document).ready(function( $ ){

    /* Greetbox Autohide */

    var _greeting_box_vars = {

        init_timeout: 15000,

        timeout: 3000,

        block: '#greet_block',

        _timer: 0

    };



    jQuery.fn.fadeThenSlide = function() {

        return this.fadeTo(4500, 0).slideUp(500);

    };



    if (!$(_greeting_box_vars.block).css("display") !== "none") {

        _greeting_box_vars._timer = setTimeout("jQuery(function($){$('"+_greeting_box_vars.block+"').fadeThenSlide()});", _greeting_box_vars.init_timeout);

    }



    $(_greeting_box_vars.block).hover(

        function () {

            if ($(this).css("opacity") !== "0") {

                // It's not sliding yet, so give the user a chance to extend his period.

                clearTimeout(_greeting_box_vars._timer);

                $(_greeting_box_vars.block).stop().stop().fadeTo(300,1);

            }

        },

        function () {

            _greeting_box_vars._timer = setTimeout("jQuery(function($){$('"+_greeting_box_vars.block+"').fadeThenSlide()});", _greeting_box_vars.timeout);

        }

    );

});