// AjaxSearch 0.1
// Adding Ajax-like search into your blog easily
// By blewtooth, 2005
// http://www.start.com.my <--- there is a .my!! I'm no Microsoft!
//
// This is a free software that comes with absolutely no warranty. So please use at your own risk.

var req;

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 SendQuery(key)
{
    if (key == 'limpiar')
  {
    document.getElementById("autocomplete").innerHTML = "";
  }
  else
  {
    Initialize();
    
    var url="http://www.elaleph.com/ranking_pagos.cfm?hace="+key;

    if(req!=null)
    {

    if (key == '30')
  {
	document.getElementById('menu_ranking_pagos').innerHTML= '<table border="0" cellspacing="0" cellpadding="0"><tr align="center"><td>&nbsp;</td><td><small>v</small></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr align="center"><td><small>datos m&aacute;s recientes</small></td><td width="44"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3"></td><td width="44"><a href="##" onmouseover="SendQuery(\'365\')"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></a></td><td width="44"><a href="##" onmouseover="SendQuery(\'10000\')"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></a></td><td><small>datos m&aacute;s antiguos</small></td></tr></table>';
  }
    if (key == '365')
  {
	document.getElementById('menu_ranking_pagos').innerHTML= '<table border="0" cellspacing="0" cellpadding="0"><tr align="center"><td>&nbsp;</td><td>&nbsp;</td><td><small>v</small></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr align="center"><td><small>datos m&aacute;s recientes</small></td><td width="44"><a href="##" onmouseover="SendQuery(\'30\')"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></a></td><td width="44"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3"></td><td width="44"><a href="##" onmouseover="SendQuery(\'10000\')"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></a></td><td><small>datos m&aacute;s antiguos</small></td></tr></table>';
  }
    if (key == '10000')
  {
	document.getElementById('menu_ranking_pagos').innerHTML= '<table border="0" cellspacing="0" cellpadding="0"><tr align="center"><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td><small>v</small></td><td>&nbsp;</td></tr><tr align="center"><td><small>datos m&aacute;s recientes</small></td><td width="44"><a href="##" onmouseover="SendQuery(\'30\')"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></a></td><td width="44"><a href="##" onmouseover="SendQuery(\'365\')"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></a></td><td width="44"><img src="images/circulo_grande_b.gif" width="11" height="11" hspace="3" vspace="3" border="0"></td><td><small>datos m&aacute;s antiguos</small></td></tr></table>';
  }

	document.getElementById('noticia_ranking_pagos').innerHTML= '<tr><td><small>&nbsp;<br /><img src="http://www.elaleph.com/images/cargando.gif"><br />Cargando nuevo listado.<br />Espere unos segundos, por favor.</small></td></tr>';
	document.getElementById('lista_ranking_pagos').innerHTML= '';
        req.onreadystatechange = Process;
        req.open("GET", url, true);
        req.send(null);

    }
  }
}

function Process()
{
    if (req.readyState == 4)
    {
    // only if "OK"
        if (req.status == 200)
        {
            if(req.responseText=="")
                HideDiv("autocomplete");
            else
            {
		document.getElementById('noticia_ranking_pagos').innerHTML= '';
                document.getElementById("lista_ranking_pagos").innerHTML =req.responseText;
            }
        }
        else
        {
	    document.getElementById('noticia_ranking_pagos').innerHTML= '';
            document.getElementById("lista_ranking_pagos").innerHTML=
				"Se produjo un error:<br>"+req.statusText;
        }
    }
}
