function newAjax()
{
	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 pasar_parametro(value, attribute)
{
	ajax=newAjax();
	ajax.open("POST", "pasarparametro.php", true);
	ajax.onreadystatechange=function() {		
		if (ajax.readyState==4) 
		{	
			switch (attribute)
			{
			case 'tour_id':
				window.location.href = "tour_tematica.php";
				break;
			case 'tour_tematica_id':
				window.location.href = "tour_tematica.php";
				break;
			case 'pais_id':
				window.location.href = "portada_pais.php";
				break;
			case 'pais_tematica_id':
				window.location.href = "listado_tematica.php";
				break;
			}
		}				
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");		
	ajax.send("param=" + value + "&att=" + attribute);
}

function parametros_busqueda()
{
	var index = document.getElementById('country').selectedIndex;
	var country_id = document.getElementById('country')[index].value;

	var index = document.getElementById('topic').selectedIndex;
	var topic_id = document.getElementById('topic')[index].value;

	var text = document.getElementById('txt_busqueda').value;

	ajax=newAjax();
	ajax.open("POST", "parametros_busqueda.php", true);
	ajax.onreadystatechange=function() {		
		if (ajax.readyState==4) 
		{	
			window.location.href = "search_results.php";
		}				
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");		
	ajax.send("pais=" + country_id + "&tematica=" + topic_id + "&texto=" + text);
}
