vanilla.namespace('wisy.humanReadableMessage');

wisy.humanReadableMessage =
{
    close : function(node, callback)
    {
	$(node).animate({opacity:0}).slideUp
	(
	    "normal", 
	    function()
	    {
		$(this).remove();

		if ( callback )
		{
		    callback();
		}
	    }
	);
    },

    closeFirstMessage : function(ul)
    {
	var nodes = $(ul).find("li");
	if ( nodes.length <= 0 )
	{
	    return;
	}

	this.close
	(
	    nodes.get(0),
	    function()
	    {
		wisy.humanReadableMessage.closeFirstMessage(ul);
	    }
	);
    }
};

$(document).ready
(
    function()
    {
	$(".humanReadableMessages.autoclose").each
	(
	    function()
	    {
		var ul = this;
		setTimeout
		(
		    function()
		    {
			wisy.humanReadableMessage.closeFirstMessage(ul);
		    }, 
		    3000
		);
	    }
	);
    }
);
