/*
 * If this javascript is included in a page, any input with the class
 * 'default-value' will be gray and the default value, supplied by value=
 * will disappear on focus.
 * Written by Darren Oakley
 * http://hocuspokus.net
 */
var active_color = '#000'; // Colour of user provided text
var inactive_color = '#999'; // Colour of default text

Event.observe( window, 'load', function () {
    var default_values = new Array();

    $$("input.default-value").each( function (s) {
        $(s.id).setStyle({ color: inactive_color });
        $(s.id).observe( 'focus', function () {
            if (!default_values[s.id]) {
                default_values[s.id] = s.value;
            }
            if (s.value == default_values[s.id]) {
                s.value = '';
                $(s).setStyle({ color: active_color });
            }
            $(s).observe( 'blur', function () {
                if (s.value == '') {
                    $(s).setStyle({ color: inactive_color });
                    s.value = default_values[s.id];
                }
            });
        });
    });
});