function nuevoAjax(){
	var xmlhttp=false;

	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}



        if(!xmlhttp) {
                try {
                        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        xmlhttp = false;
                }

        }

                if(!xmlhttp) {

                try {
                                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
;
                        } catch(E) {
                                xmlhttp = false;
                        }

        }


        return xmlhttp;
}




function consulta(num, URL, extra, target) {


                var nuevaURL = 'ajax/' + URL;
                _objetus = nuevoAjax();
		var  vari = '';

                if(_objetus) {
                _value_send="ok="+num;
                _URL_ = nuevaURL+"?";
                _objetus.open("POST",_URL_+"&"+_value_send + "&"+extra,true);
                _objetus.setRequestHeader('Content-type','application/x-www-form-urlencoded');
                _objetus.send('&'+_value_send);
                document.getElementById("load").style.visibility = "visible";

                _objetus.onreadystatechange=function() {

                        if (_objetus.readyState<4) {
                      //         document.getElementById("load").style.visibility = "hidden";
                        }


                        if(_objetus.readyState==4)
                        {
                                if(_objetus.status==200) {
                                document.getElementById("load").style.visibility = "hidden";

                               vari = _objetus.responseText;


                               document.getElementById(target).innerHTML=vari;
                                //     _objetus.send(null); 

                                }


                        }


                }


    }
 
}

