//funcion encarga de crear el objeto
function ajaxInit(){
    var xmlhttp =false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
        // JScript gives us Conditional compilation, we can cope with old IE versions.
        // and security blocked creation of the objects.
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (E) {
	        xmlhttp = false;
	    }
	}
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined' ) {
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}

function ejecutar(_url, _values, _divName, _show, muestra){
    ajax = ajaxInit();
    ajax.open("GET",_url+"?&"+_values,true);
    ajax.onreadystatechange=function(){
		if (ajax.readyState==1){
			if(_show){
				if (document.getElementById(_divName).style.display==""){
					document.getElementById(_divName).style.display="none";
				}else{
					document.getElementById(_divName).style.display="";
				}
			}else{
				document.getElementById(_divName).style.display="";
			}
	        document.getElementById(_divName).innerHTML = "<div align='center'><img src='images/cargando.gif' alt='Cargando'/>&nbsp;Cargando</div>";
	    }else if (ajax.readyState==4){
		    if(ajax.status==200){
			document.getElementById(_divName).innerHTML=ajax.responseText;
		    }
		}
    }
    //alert(_url+"?&"+_values+" en "+_divName);
    if (muestra)
    	document.getElementById("body_div_alt").style.display="none";
    ajax.send(null);
    return;
}
 
function hideShow(D_LI){
    //_id_cap=document.getElementById(D_A);
    _id_master=document.getElementById(D_LI);
    _id_master.style.display = (_id_master.style.display == "")?"none":"";
    //_id_master.style.fontWeight = (_id_cap.style.display == "")?"bold":"normal";
}
