function ArchivoTipoImagen (form, file) {
    extArray = new Array(".jpg", ".jpe", ".jpeg", ".swf");
    allowSubmit = false;

    if (!file) return;
    while (file.indexOf("\\") != -1)
    file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) {
        if (extArray[i] == ext) {
            allowSubmit = true;
            break;
        }
    }

    if (allowSubmit) {
        return (true);
    }
    else {
        return(false);
    }
//document.forms[0].reset();
//document.forms[0].uploadfile.focus();
}

function ArchivoTipoFlash (form, file) {
    extArray = new Array(".swf");
    allowSubmit = false;

    if (!file) return;
    while (file.indexOf("\\") != -1)
    file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) {
        if (extArray[i] == ext) {
            allowSubmit = true;
            break;
        }
    }

    if (allowSubmit) {
        return (true);
    }
    else {
        return(false);
    }
//document.forms[0].reset();
//document.forms[0].uploadfile.focus();
}


function DeshabilitaBoton(mensaje,id){
    if(id) {
        document.getElementById(id).disabled = true;
        document.getElementById(id).value=mensaje+'...';
        return(true);
    }
}

function VentanaPopup(pagina,valor,ancho,alto) {
    if (isNaN(ancho)) {
        ancho = 400;
    }
    if (isNaN(alto)) {
        alto = 500;
    }

    cadena      = "window.open('" + pagina + valor + "', 'hijo', 'width="+ ancho +",height="+ alto +",scrollbars=yes, titlebar=0')";
    window.name = "padre";
    manejador   = eval(cadena);
    manejador.focus();
}


function CentrarPopup(ancho, alto) {
//alert('Guatazo');
    var margen_x = 0;
    var margen_y = 0;
    var total_x = self.screen.width;
    var total_y = self.screen.height;

    window.moveTo( (total_x + ancho)/2 , (total_y + alto)/2);
}


function popupAccesoCliente(id) {
    cadena      = "window.open('acceso_cliente.php?IdC="+id+"', 'hijo', 'scrollbars=yes')";
    window.name = "padre";
    manejador   = eval(cadena);
    manejador.focus();
}
