//Funciones XMLHttpRequest
var req;
function XMLHttp(){ 
	var xmlhttp=false; 
	try{ 
		// Creacion del objeto XMLHttp para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}catch(e){
		try{ 
			// Creacion del objet XMLHttp para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		}catch(E){ 
			xmlhttp=false; 
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
}

function Initialize(){
    try{
        req=new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            req=new ActiveXObject("Microsoft.XMLHTTP");
        }catch(oc){
            req=null;
        }
    }
    if(!req&&typeof XMLHttpRequest!="undefined"){
        req= new
    	XMLHttpRequest();
	}
} 

function SendToDiv(url,varstring,divid){
    if(req!=null){
        req.onreadystatechange = function(){
			if (req.readyState == 4){
	        	// only if "OK"			
				if (req.status == 200){
					//alert(req.responseText);
					document.getElementById(divid).innerHTML =req.responseText;
				}else{
				   document.getElementById(divid).innerHTML='Problem detected';
				}
        	}		
		}
		req.open("POST", url, true);
	    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=iso-8859-1');
		req.send(varstring);
    }
}

function Datos(id,section){
	Initialize(); 
	var url="XML/XMLDatos.php";
	var varstring="Id="+id+"&Section="+section;	
	SendToDiv(url,varstring,'Cuerpo');
}
