
function ba_cargaXML(url,desti,host) {
    var long_url = ""
    if (host != "" ) long_url = "&hostbuscador="+host;
    var xr = document.createElement('script'); 
    xr.setAttribute('charset', 'ISO-8859-1');
    xr.src = "/files/php/buscador3/buscador/funcions.php?busca=poblacions&zona="+escape(url)+long_url; 
    document.getElementById("ba_sc").appendChild(xr);    
}

function ba_executaBuscar(idi,ref,hos){   
    
    var busc = "?format=tbreaks";
    busc+="&diaini="+document.getElementById("fc_1173461602_d").value;
    busc+="&mesini="+document.getElementById("fc_1173461602_m").value;
    busc+="&anyini="+document.getElementById("fc_1173461602_y").value;
    busc+="&nits="+document.getElementById("ba_nits").value;
    busc+="&ch="+document.getElementById("ba_childs").value;
    busc+="&ad="+document.getElementById("ba_adults").value;
    busc+="&poblacio="+document.getElementById("ba_poblacio").value;
    busc+="&idioma="+idi;
    busc+="&referer="+ref;
    busc+="&pagina="+hos;

    llistaHotels(idi);
    sendPeticio(busc);           
}

function sendPeticio(busc) {			
	var peticion = false;
	try {
		peticion = new XMLHttpRequest();
	}catch (trymicrosoft){
		try {
		     	peticion = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (othermicrosoft){
			try {
				peticion = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (failed){
				peticion = false;
			}
		}
	}
	
	var element = document.getElementById('llistaHotels');
	peticion.open('GET', "files/php/buscador3/buscador/getHotels.php"+busc);
	peticion.onreadystatechange = function() {
		if (peticion.readyState == 4) {
			if (peticion.status == 200) {
				var t=peticion.responseText.replace("buscador/getHotels.php","/files/php/buscador3/buscador/getHotels.php");
				var t=t.replace("images/","/files/php/buscador3/images/");
				eval(t);
			}else element.innerHTML = 'AJAX error';
		}
	}
	peticion.send(null);
}


function llistaHotels(idi) {
    var text = "Buscando Hoteles";
    if (idi == "en") text = "Searching for Hotels";
    var s = "<DIV STYLE='color: #000000;' ID='llistaHotels'>";
    s+="<BR><FONT COLOR=#666666 SIZE=4>"+text+"</FONT><BR><BR><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width=350 height=240><param name='movie' value='http://www.holidaysinspain.com/files/php/buscador3/buscador/images/dosflores.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='http://www.holidaysinspain.com/files/php/buscador3/buscador/images/dosflores.swf' width=350 height=240 quality='high' pluginspage='https://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed></object>";
    s+="</DIV>";
    document.getElementById("content-main").innerHTML=s;
}


function canviar_tamany_imatge(id,ample,altura){
	var element = document.getElementById(id);	
	if (altura >= ample) element.style.height = "150px";	
	else element.style.width = "150px";
	element.style.visibility="visible";	
}

var ventana;
function ampliar_foto(cual){
	if (ventana!=null) { ventana.close(); }
	ventana=window.open('','ventana','resizable=yes,scrollbars=no');
	ventana.document.write('<html><head><title></title></head><body style="text-align: center;" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">');
	ventana.document.close();
}





