/************************************************/
/*     	WEB LEANDRO -www.leandrosanchez.com    	*/
/*   Ultima actualización: 10 de abril de 2006 	*/
/************************************************/

var contenido;
function buscar(seccion, ID, cont)
{
	var url = '../' + seccion + '/' + seccion + '.asp?id=' + ID;
	contenido = cont;
	realizarPeticionAsync(url);
}

var oXML;
function crearObjetoAsync()
{
	var obj;
	if(window.XMLHttpRequest) 
	{ // no es IE
		obj = new XMLHttpRequest();
	} else 
	{ // Es IE o no tiene el objeto
		try 
		{
			obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) 
		{
			alert('El navegador utilizado no está soportado');
		}
	}
	return obj;
}

function realizarPeticionAsync(url) 
{
	// Creamos el objeto
	oXML = crearObjetoAsync();
	// Preparamos la petición
    var urlQuery = url;
	oXML.open("GET", urlQuery, true);
    // for ie compatability
    //oXML.setRequestHeader("Content-Type","text/html");
	// Preparamos la recepción
	oXML.onreadystatechange = obtenerPeticionAsync;
	// Realizamos la petición
	oXML.send("");
}

function obtenerPeticionAsync() 
{
	if (oXML.readyState == 4)
	{
		if (oXML.status == 200) 
		{
           
			if(oXML.responseText == "0") 
			{
				//window.document.getElementById('contenido').innerHTML=oXML.responseText;
			}
			else 
			{
				//alert(oXML.responseText);
				var divContenido = window.document.getElementById(contenido);
				if(divContenido)
					divContenido.innerHTML = oXML.responseText;
			}
        } else 
		{
            alert("Error recibiendo datos:\n" + oXML.statusText);
		}
	}
}

 

