var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false
var ns6 = (document.getElementById && !document.all) ? true: false;
var coorX, coorY;

if (ns6) document.addEventListener("mousemove", mouseMove, true)
if (ns4) {document.captureEvents(Event.MOUSEMOVE); document.mousemove = mouseMove;}
            
document.body.onload = ini;

function nuevoAjax()
{
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function mouseMove(e)    
{
  if(ns4||ns6)    
  {
    coorX = e.pageX;
    coorY = e.pageY;
  }
  
  if(ie4)    
  {
    coorX = event.x;
    coorY = event.y;
  }
  
   coorX += document.body.scrollLeft;
   coorY += document.body.scrollTop;
   return true;
}
    
function ini()    
{
  if (ie4)    document.body.onmousemove = mouseMove;
}

function mostrar(ruta,id)    
{
  ajax = nuevoAjax();
  pars = "op=1&id=" + id + "&ruta=" + ruta;
  ajax.open("POST", ruta + "procesar.php",true);
  ajax.onreadystatechange=function() {
    if (ajax.readyState==4) {
      document.getElementById("ficha").innerHTML = ajax.responseText;
	  }
  }

	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  ajax.send(pars); 
				
	with(document.getElementById("ficha"))    
	{
    if (ie4)    
	  {
      style.top = coorY + 2; 
      style.left = coorX + 2;
    }
		else
		{
			style.top = coorY + 2 - document.body.scrollTop;
      style.left = coorX + 2 - document.body.scrollLeft;
		}
		style.visibility = "visible";					
  }
}

function ocultar()    
{
  document.getElementById("ficha").style.visibility = "hidden";
}

function mover()   
{
  with(document.getElementById("ficha"))    
  {
    if (ie4)    
		{
      style.top = coorY + 2; 
      style.left = coorX + 2;
    }
		else
		{
		  style.top = coorY + 2 - document.body.scrollTop;
      style.left = coorX + 2 - document.body.scrollLeft;
		}
  }
}

function clickar(ruta,id,id_web)    
{
	pars = "op=2&id=" + id + "&id_web=" + id_web + "&ruta=" + ruta;
	
  ajax=nuevoAjax();
  ajax.open("POST", ruta + "procesar.php",true);
  ajax.onreadystatechange=function() {
    if (ajax.readyState==4) {
      document.getElementById("ficha").innerHTML = ajax.responseText;
	}
  }	
  
  ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  ajax.send(pars);
}