var xmlHttp

function buscared(str)
{ 
	if (str == "")
		{
			alert('ingrese criterio de busqueda');
			document.location.href='index.php';
			return false;
		}
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="./Ajax/WS_redes.php"
	url=url+"?expression="+str
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged4 
	//xmlHttp.open("GET",url,true)
	xmlHttp.open("POST",url,true)
	xmlHttp.send(null)
	
	
}

function stateChanged4() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	//document.getElementById("txtHint").innerHTML="<div id='10'>"+xmlHttp.responseText +"</div>"
	document.getElementById("txtHint").innerHTML="<div id='10' style='background-color: #FFFFFF'><div id='wdrag' style='background-color: #FFFFFF'><table id='d' width=100% cellpadding=0 cellspacing=0 border=0><tr><td width='55%' bgcolor=#FFFFFF></td><td width='45%' align=right bgcolor='#FFFFFF'><span style='padding-right: 5px;'><a href=javascript:closeWidget('10') class='login'>Cerrar <b>X</b></a></span></td></tr><tr><td colspan='2'>" + xmlHttp.responseText + "</td></tr></table></div><div id='id1_content' style='padding: 5px; width: 100%'></div></div>";
	} 
	else
	{
	//document.getElementById("txtHint").innerHTML="Buscando...<img src='./Ajax/loading.gif' border='0'>";
	//document.getElementById("txtHint").innerHTML="<div align='center'>Buscando <img src='./Ajax/loading.gif' border='0'> en diversas Fuentes a través de corredores virtuales con: <br><br>CEPAL, NU-DESA, UNESCO, PNUD, UNICEF, OIT, FLACSO, BID, <b>Banco Mundial</b>(Nuevo) <br><br> y en Bibliotecas: <br>Biblioteca RISALC, Biblioteca CEPAL ... espere un momento...<br></div>";
	document.getElementById("txtHint").innerHTML="<div align='center'>Buscando <img src='./Ajax/loading.gif' border='0'><br><br>espere un momento...<br><br></div>";
	//document.getElementById("txtHint").innerHTML="<div id='10' class='widget' style='top: 130; left: 300; width: 250;'><div id='wdrag' style='cursor: move; width: 100%; height: 16; background-color: #CCCCFF; border-bottom: 1px solid #CACACA; '><table id='d' style='font-family: arial; font-size: 8pt;' width=100% cellpadding=0 cellspacing=0 border=0><tr><td ALIGN=left><span id='id1_title' style='padding-left: 5px;'>RESULTADOS</span></td><td align=right><span style='padding-right: 5px;'><a href=javascript:closeWidget('10') style='text-decoration: none;'><b>X</b></a></span></td></tr></table></div><div id='id1_content' style='padding: 5px; font-family: arial; font-size: 8pt; width: 100%'>Cargando...<img src='http://localhost:9090/pais/ajax/loading.gif' border='0'></div></div>";;
	}
} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
	objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}

return objXMLHttp

}

var counter=10;

function addWidget(){
	var ref=document.getElementById("widget1");		//find the place to add widget to
	var wid="id"+counter;		//create a unique ID for the widget
	//counter++;
	var wstr="<div id='"+wid+"' class='widget' style='top: 130; left: 300; width: 250;'><div id='wdrag' style='cursor: move; width: 100%; height: 16; background-color: #CCCCFF; border-bottom: 1px solid #CACACA; '><table id='d' style='font-family: arial; font-size: 8pt;' width=100% cellpadding=0 cellspacing=0 border=0><tr><td ALIGN=left><span id='id1_title' style='padding-left: 5px;'>Titulo</span></td><td align=right><span style='padding-right: 5px;'><a href=javascript:closeWidget('"+wid+"') style='text-decoration: none;'><b>X</b></a></span></td></tr></table></div><div id='id1_content' style='padding: 5px; font-family: arial; font-size: 8pt; width: 100%'>cuerpo de la capa</div></div>";
	ref.innerHTML+=wstr;	//place the widget on screen
}

function closeWidget(id){	
	var widget1=document.getElementById('txtHint');
	var node=document.getElementById(id);
	widget1.removeChild(node);
}
