// JavaScript Document

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function handleHttpResponse() { 

    if (http.readyState == 4) { 
       if (http.status == 200) { 
               document.getElementById("Resultado").innerHTML = http.responseText;
             enProceso = false;
          //}
       }
    }
}


function mOvr(src) 
{ 
document.getElementById(src).style.cursor = 'hand'; 
document.getElementById(src).bgColor = "#ffffff"; 
} 

function mOut(src)  
 { 
document.getElementById(src).style.cursor = 'default'; 
document.getElementById(src).bgColor = "#EBEBEB"; 
} 

function PosicionarCaja(obj,Buscar)
{
//style="position: absolute; top: 20px; left: 105px; "
    var y = findPosY(obj) + 35;
	var x = findPosX(obj);
	alert(document.captureEvents());
	document.getElementById("Resultado").style.top = y  + "px";
	document.getElementById("Resultado").style.left = x + "px";
	document.getElementById("Resultado").style.visibility = "";
	   var url = "Buscar.asp?xBuscar=" + Buscar;
       http.open("GET", url, true);
       http.onreadystatechange = handleHttpResponse;
       enProceso = true;
       http.send(null);
}

function Enviar(obj)
{
//document.getElementById(obj).value
//alert(document.getElementById(obj).value);
document.getElementById("xBuscar").value = document.getElementById(obj).value;
document.getElementById("Resultado").style.visibility = "hidden";

}
function ListarCuerpo(xQ) {
    if (!enProceso && http) {
	   
       var url = "DetalleAjax.asp?" + xQ; 
	   //alert(url);
	   
       http.open("GET", url, true);
       document.getElementById("Resultado").innerHTML = "<span class='Cargando' style='position: absolute; top: 200px; left: 450px;'>&nbsp;&nbsp;Cargando Informacion.. &nbsp;&nbsp;</span>"
       http.onreadystatechange = handleHttpResponse;
       enProceso = true;
       http.send(null);

    }
}




function getHTTPObject() {
var xmlhttp
try {
	xmlhttp = new XMLHttpRequest();
}
 	catch(e) 
{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
 	return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest
