﻿//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  Funciones varias JS genéricas para el Caldero
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function NuevaVentana800x600(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=yes,resizable=yes,width=800,height=600");
    if (vntPop) vntPop.focus();
}
function NuevaVentana(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=yes,resizable=yes,width=640,height=520");
    if (vntPop) vntPop.focus();
}
function VentanaImprimir(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=yes,resizable=yes,width=750,height=480");
    if (vntPop) vntPop.focus();
}
function VentanaDocumento(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=yes,resizable=yes,width=460,height=540");
    if (vntPop) vntPop.focus();
}
function VentanaPeq(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=no,resizable=yes,width=350,height=280");
    if (vntPop) vntPop.focus();
}
function VentanaMed(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=no,resizable=yes,width=450,height=320");
    if (vntPop) vntPop.focus();
}
function VentanaEdicionDocumento(destino, nombre) {
    var vntPop = window.open(destino, nombre, "toolbar=no,scrollbars=yes,resizable=yes,width=640,height=640");
    if (vntPop) vntPop.focus();
}

function ValidaLongitud(_txt, longitud) {
    if (_txt.value.length >= longitud) {
        _txt.value = _txt.value.substring(0, longitud - 1);
        return false;
    } else {
        return true;
    }
}

function RefrescarPadre() {
    if ((parent) && (parent.window) && (parent.window.opener) && (!parent.window.opener.closed)) {
        parent.window.opener.location = parent.window.opener.location;
    }
    window.close();
}

