﻿function validaComentario(seccion, usuarioID, estiloId) {
    var myComment = document.getElementById("comentario");
    document.getElementById("comentarioMsg").style.display = "block";
    document.getElementById("comentarioMsg").innerHTML = "Enviando comentario..."

    if (myComment.value != "") {
        Scribe.services.ComentarioService.guardaComentario(seccion, usuarioID, estiloId, myComment.value, OnCompleteCom, OnTimeOutCom, OnErrorCom);
    } else {
        document.getElementById("comentarioMsg").style.display = "block";
        document.getElementById("comentarioMsg").innerHTML = "Por favor propociona la información que se solicita"
    }
}

function OnCompleteCom(args) {
    var myComment = document.getElementById("comentario");
    myComment.value = "Tu comentario se ha enviado, Scribe revisará tu comentario para publicarlo más tarde";
    //window.location.reload();
}

function OnTimeOutCom(args) {
    document.getElementById("comentarioMsg").style.display = "block";
    document.getElementById("comentarioMsg").innerHTML = "Se agotó el tiempo, por favor inténtalo más tarde."
}

function OnErrorCom(args) {
    document.getElementById("comentarioMsg").style.display = "block";
    document.getElementById("comentarioMsg").innerHTML = "Ha ocurrido un error."
}
