
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()
{

	if(document.getElementById("monedas").style.display=='')
	{
		document.getElementById("monedas").style.display="none";
		return;
	}
		
	Initialize();
	var precio= document.form1.hiddenprecio.value;
	var url="/monedas.aspx?precio="+precio;
	
	if(req!=null)
	{
		req.onreadystatechange = Process;
		req.open("GET", url, true);
        req.send(null);
        
	}
	
}


function Process()
{
	if (req.readyState == 4) 
        {
        // solo si fue "ok";
			if (req.status == 200) 
			{
				
				ShowDiv("monedas");
				document.getElementById("monedas").innerHTML =req.responseText;
			}
			else 
			{
				document.getElementById("monedas").innerHTML="La conversión no se pudo realizar";
			}
		}
}

function ShowDiv(divid) 
{
   if (document.layers) document.layers[divid].visibility="show";
   else {
		document.getElementById(divid).style.display='';	
		document.getElementById(divid).style.visibility="visible";
	}
}

//function showhide(el){

 // el=document.getElementById(el);  el.style.display=(el.style.display=="block")?"none":"block";

//}