/*
 * Invocacin asicrnica al server (funcin de envo de publicidad). Adicionalmente muestra mensajes descriptivos.
 */
function ajaxRequestSend(url, params, method, idioma, functionRet)
{
	var ajax;
	//document.getElementById("msgBuscando").style.display = "block";
	
	
	ajax = nuevoAjax();
	if (method == "GET")
	{
		params = params + "&lang=" + idioma;
		
		nroRandom = Math.random();
		params = params + "&elimCache=" + nroRandom;
		ajax.open(method, url + '?' + params, true);

		ajax.onreadystatechange=function() 
		{
			if (ajax.readyState == 4) 
			{
				rta = ajax.responseText;
				//alert(rta);
				eval(functionRet+ '("' +rta+ '");'  );
			}
		}
		
		ajax.send(null);
	}
	else
	{
		alert("Metodo "+ method +" no implementado.")
	}
	
	
}

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 ver(iden){
	if(document.getElementById(iden).style.display == "none")
	{
		document.getElementById(iden).style.display = "";
	}
	else
	{
		document.getElementById(iden).style.display = "none";
	}
}


function selectedIndexForValue(objSel, valSel)
{
	for(var no = 0; no < objSel.options.length; no++)
	{
		if(objSel.options[no].value == valSel){
			objSel.selectedIndex=no;
			break;
		}				
	}	
}
