function initOverLabels() {
    if (!document.getElementById) {
        return false;
    };
    var labels = document.getElementsByTagName('label');
    for (var i = 0; i < labels.length; i += 1) {
        if (labels[i].className == 'overlabel') {
            var id = labels[i].htmlFor || labels[i].getAttribute('for');
            if (id) {
                var field = document.getElementById(id);
                if (field) {
                    if (field.value !== '') {
                        hideLabel(field.getAttribute('id'), true);
                    };
                    field.onfocus = function () {
                        hideLabel(this.getAttribute('id'), true);
                    };
                    field.onblur = function () {
                        if (this.value === '') {
                            hideLabel(this.getAttribute('id'), false);
                        };
                    };
                    labels[i].onclick = function () {
                        var id = this.getAttribute('for');
                        if (id) {
                            var field = document.getElementById(id);
                            if (field) {
                                field.focus();
                            };
                        };
                    };
                };
            };
        };
    };
};
toggleFade = function (el) {
    el = $(el);
    if (el.style.display == 'none') {
        new Effect.Appear(el, arguments[1] || {  });
    } else {
        new Effect.Fade(el, arguments[1] || {  });
    };
};
function hideLabel(fieldId, hide) {
    var labels = document.getElementsByTagName('label');
    for (var i = 0; i < labels.length; i += 1) {
        var fieldFor = labels[i].htmlFor || labels[i].getAttribute('for');
        if (fieldFor == fieldId) {
            if (hide) {
                new Effect.Fade($(labels[i]), { duration : 0.4 });
            } else {
                new Effect.Appear($(labels[i]), { duration : 1.2 });
            };
            return true;
        };
    };
};
window.onload = function () {
    setTimeout(initOverLabels, 50);
};