// JavaScript Document
var sel=1;
var selFoto=1;
var selFotoArt=1;
var errorr=0;
var finalizado=0;

function objetus(file) {
    xmlhttp=false;
    this.AjaxFailedAlert = "Su navegador no soporta las funciónalidades de este sitio y podria experimentarlo de forma diferente a la que fue pensada. Por favor habilite javascript en su navegador para verlo normalmente.\n";
    this.requestFile = file;
    this.encodeURIString = true;
    this.execute = false;
    if (window.XMLHttpRequest) { 
        this.xmlhttp = new XMLHttpRequest();
        if (this.xmlhttp.overrideMimeType) {
            this.xmlhttp.overrideMimeType('text/xml');
        }
    } 
    else if (window.ActiveXObject) { // IE
        try {
            this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e) {
            try {
                this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                this.xmlhttp = null;
            }
        }
        if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
            this.xmlhttp = new XMLHttpRequest();
            if (!this.xmlhttp){
                this.failed = true; 
            }
        } 
    }
    return this.xmlhttp ;
}


function recibeid(_pagina,valorget,valorpost,capa,textoCarga){
    //alert(valorpost);
    ajax=objetus(_pagina);
    if(valorpost!=""){
        ajax.open("POST", _pagina+"?"+valorget,true);
    } else {
        ajax.open("GET", _pagina+"?"+valorget,true);
    }
    ajax.onreadystatechange=function() {
        if (ajax.readyState==1){
            //document.getElementById(capa).innerHTML = "<center><img src='imgs/loading.gif' align='center'></center>";
            document.getElementById('estado').innerHTML = textoCarga;
        }
        if (ajax.readyState==4) {
            if(ajax.status==200)
            {document.getElementById(capa).innerHTML = ajax.responseText;}
            else if(ajax.status==404)
            {
                capa.innerHTML = "Error al Obtener los Datos";
            }
            else
            {
                capa.innerHTML = "Error: ".ajax.status;
            }
            if(textoCarga==1&&!errorr) {
                document.getElementById('ventanita').style.visibility='hidden';
            }
            document.getElementById('estado').innerHTML = '';
        }
    }
    if(valorpost!=""){
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send(valorpost);
    } else {
        ajax.send(null);
    }
    return true;
}

function ir(url)
{
	location.href = url;
}

function alerta() {
    alert(5);
}

