
/* The function init(e) highlights the messages div after
   the page has loaded in the right column.
   It takes affect after a page load and is
   initiated when clicking Edit, Un/Publish or Delete a Post */
   
var settings = { // define hash called settings.
    messages 		    : 'messages', // define the ID of the element that holds the messages.
	messages_hide_delay : 1 // Delay setting used in function message_clear()
};

function init(e) { // function is run on page load.

    // check if the messages element exists and is visible,
    // and if so, apply the highlight effect to it
    var messages = $(settings.messages);
							 // explicitly check that #messages is visible 
							 // using prototype function isVisible()
    if (messages && messages.visible()) {
        new Effect.Highlight(messages);
    }
}

Event.observe(window, 'load', init);

/* Setting and Clearing Site Status Messages when clicking
   on a link in the left column under "Your Blog Archive".
   
   These functions show and hide a message in the right column
   that was initiated by BlogMonthlySummary.class.js */

function message_write(message) {

    var messages = $(settings.messages);
    if (!messages)
        return;

    if (message.length == 0) {
        messages.hide();
        return;
    }

    messages.update(message);
    messages.show();
    new Effect.Highlight(messages);
}

function message_clear() {

    setTimeout("message_write('')", settings.messages_hide_delay * 1000);
}
