﻿
//stayTopLeft('DivLoading');

//funcao para posicionar o updateProgress no centro da tela...
function stayTopLeft(idElemento) {
    //window.alert('entrou aqui');

    var elemento = document.getElementById(idElemento);

    if (elemento != null) {

        var horizontal = (document.body.clientWidth / 2) + document.body.scrollLeft - (elemento.style.width / 2);

        var vertical = (document.body.clientHeight / 2) + document.body.scrollTop - (elemento.style.height / 2);
        //var vertical = (document.body.clientHeight - 200) + document.body.scrollTop - (elemento.style.height / 2);

        elemento.style.position = "absolute";

        elemento.style.left = horizontal;

        elemento.style.top = vertical;
    }
    
    var funcao = "stayTopLeft('" + idElemento + "')";
    //window.alert("horizontal: "+horizontal +"\nvertical: "+vertical+"\n"+funcao);    
    window.setTimeout(funcao, 20);


}

function setButtonFocus(nomedobotao, e) {
    var keyCode;
    if (window.event)
        keyCode = window.event.keyCode;
    else
        keyCode = e.which;
    if (keyCode == 13) {
        var botao = document.getElementById(nomedobotao);
        if (botao != null)
            botao.focus();
    }
}

function scrolltoValidationSummaryScript() {
    //    alert("ValidationSummary registration on server code behind.");
    if (typeof (ValidatorOnSubmit) == "function") {
        var isValidated = ValidatorOnSubmit();
        if (!isValidated) {
            gotoActiveSummary();
            return false;
        }
        return true;
    }
}