function validaComentario() {

    _objForm = document.getElementById('frmComentario');
    _badFields = Array();
    
    if (vazio(_objForm.commentAuthorName.value)) {
        _badFields.push('Nome');
    } // end :: if
    
    if (vazio(_objForm.commentAuthorEmail.value)) {
        _badFields.push('E-mail');
    } // end :: if
    
    if (vazio(_objForm.commentText.value)) {
        _badFields.push('Comentário');
    } // end :: if
    
    if (_badFields.length > 0) {
        _msg = "Os seguintes campos necessitam ser preenchidos:\n\n";
        for (i=0;i<_badFields.length;i++) {
            _msg += _badFields[i]+"\n";
        } // end :: for
        alert(_msg);
        return false;
    } // end :: if
    
    return true;
}

function vazio(val) {
    if (val == null || val == "" || val.length == 0) {
        return true;
    } else {
        return false;
    } // end :: if
} // end :: vazio

function limitChars(elm, qtd) {
    if (elm.value.length >= qtd) {
        elm.value = elm.value.substring(0,qtd);
    } // end :: if
} // end :: limitChars

