/*This script is called in login.php, register.php, and in the comments area.
It subtly encourages users to comlete all form fields.
*/

try{ // always try standard first;
addEventListener('load', rolloverInit, false);
addEventListener('load', initForms, false);
addEventListener('load', initForm, false);
} catch(e){ // so far MSIE browser is the only one that doesn't use addEventListener;
attachEvent('onload', rolloverInit);
attachEvent('onload', initForms);
attachEvent('onload', initForm);
}


window.onload = initForm;

function initForm() {
    var allTags = document.getElementsByTagName("*");
    
    for (var i=0; i<allTags.length; i++) {
        if (allTags[i].className.indexOf("reqd") > -1) {
        allTags[i].onblur = fieldCheck;
        }
    }
}

function fieldCheck() {
    if (this.value == "") {
    this.className += " highlight";
    }
    else {
    this.className = "reqd";
    }
}