var url ;
var llamada;

function lanza_request(funcion,iden,total_rooms,idhotel){
	url = 'roomsrates/ajaxrates.php';
	url = url + '?idseason='+iden+'&total_rooms='+total_rooms+'&idhotel='+idhotel;
  if (window.XMLHttpRequest) { // Si no IE
     llamada = new XMLHttpRequest();
     llamada.onreadystatechange = funcion;
     try {
       llamada.open("GET", url, true);
     }
     catch (e) {
       alert(e);
     }
     llamada.send(null);
  }
  else if (window.ActiveXObject) { // IE
     llamada = new ActiveXObject("Microsoft.XMLHTTP");
     if (llamada) {
       llamada.onreadystatechange = funcion;
       llamada.open("GET", url, true);
       llamada.send();
     }
   }
}
 
function recibir_datos(){
   if (llamada.readyState == 4) { // Completado
     if (llamada.status == 200) { // Respuesta OK
		if (llamada.responseText == ""){
		lanza_request(recibir_datos , document.form1.idseason.options[document.form1.idseason.selectedIndex].value, document.form1.total_rooms.value,document.form1.idhotel.value);
		return;
		}
		//alert (llamada.responseText);
		texto= unescape(llamada.responseText);//esto es para decodificar los caracteres especiales por compativilidad entre javascript y php (ajax problem)
		script = texto.replace(/\+/gi," ");
		//alert (script);
	    eval(script);
       //procesar_datos_TXT(llamada.responseText);
     }
	 else {
       alert('Se ha producido el error: '+llamada.status);
     }
   }
   
}

function updatepage(str,responsediv){
    document.getElementById(responsediv).innerHTML = str;
}

