function show_zoom(id){
var url_img = 'http://www.earthotel.com/images_hotel/big/' + id.substr(0,2) + '/' + id;
theStr ='<DIV id="foto_big" style="margin:2px;background-color: #FFFFFF;border: medium solid #000000;position:absolute; left:' + x + 'px; top:' + y + 'px; z-index:1; visibility:show;"><img hspace="2" vspace=2 src="' + url_img + '"></div>';
document.getElementById('foto_big').innerHTML=theStr;
}

function go(u) {
document.location.href=u;
}

function gonews(u){
	u=mycode(u);
	window.open(u);
}

function mycode(stringa) {
str_out = ""; num_out = stringa;
for(i = 0; i < num_out.length; i += 2) { num_in = parseInt(num_out.substr(i,[2])) + 23; num_in = unescape('%' + num_in.toString(16)); str_out += num_in; }
stringa = unescape(str_out);
while (stringa.indexOf('+') != -1) { stringa = stringa.replace('+', ' '); }     
return stringa;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}




function getById(id) { 
	return document.getElementById?document.getElementById(id):(document.all?document.all(id):null); 
	}

function hideDiv(id) { 
	getById(id).style.visibility = "hidden";        
	getById(id).style.display = "none"; 
	}
	


function showDiv(id) {
	getById(id).style.visibility = ""; 
	getById(id).style.display = ""; 
}

function showAndLoad(id,id_hotel,x,y){
	for (var i = 1; i <= 2; i++) {
          hideDiv(i + '_' + id_hotel);
     }
	showDiv('' + id + '_' + id_hotel + '');
	load('' + id + '_' + id_hotel + '',x,y);
}



function showThis(id,id_hotel){
    showDiv('content');
	var theStr='';
	
	var ID = document.getElementById('' + id + '_' + id_hotel + '');
    temp = ID.innerHTML;
	document.getElementById('content').innerHTML=temp;
}

function showThis_start(id,id_hotel){
	showDiv('' + id + '_' + id_hotel + '');
}



function showDisp_city(id_hotel,tmph,id_hotel_orig,lg){
ajaxpage('check_disp_all.php', '' + id_hotel + '');
}


function showDisp_scheda2(id,id_hotel,tmph,id_hotel_orig,lg){
hideDiv('map');
hideDiv('text');
hideDiv('content');
showDiv('content');
ajaxpage('check_disp_scheda.php?id_hotel=' + id_hotel + '&id_hotel_orig=' + id_hotel_orig + '&tmph=' + tmph + '&lg=' + lg + '', 'content');
}


function showDisp_scheda(id,id_hotel,tmph,id_hotel_orig,lg){
showDiv('book');
theStr ='<center><div id="book2" style="width:1002px; height:600px; border:1px solid #999999;"></div><center>';
document.getElementById('book').innerHTML=theStr;
ajaxpage('check_disp_scheda.php?id_hotel=' + id_hotel + '&id_hotel_orig=' + id_hotel_orig + '&tmph=' + tmph + '&lg=' + lg + '', 'book2');
}


function showThisDisp(id,id_hotel,start,end,tmph,id_hotel_orig,lg){
	for (var i = 1; i <= 2; i++) {
          hideDiv(i + '_' + id_hotel);
     }
showDiv('' + id + '_' + id_hotel + '');
theStr ='<img src="/images/loading.gif" width="103" height="103">';
document.getElementById('' + id + '_' + id_hotel + '').innerHTML=theStr;
ajaxpage('check_disp.php?start=' + start + '&end=' + end + '&lg=' + lg + '&tmph=' + tmph + '&id_hotel_orig=' + id_hotel_orig + '', '' + id + '_' + id_hotel + '');
}


function showThisDisp_all(){

window.setTimeout("ajaxpage('check_disp_results.php', 'main_listing')", 15000); // 1 second


theStr ='<div id="wait_b"></div><div id="wait_v"></div><div id="wait_h"></div><div id="wait_c"></div>';
document.getElementById('main_listing').innerHTML=theStr;
theStr ='<img src="/images/loading.gif" width="103" height="103">';


if (document.check_all_city.ids_b.value.length > 1){
document.getElementById('wait_b').innerHTML=theStr;
}

if (document.check_all_city.ids_v.value.length > 1){
document.getElementById('wait_v').innerHTML=theStr;
}
if (document.check_all_city.ids_h.value.length > 1){
document.getElementById('wait_h').innerHTML=theStr;
}
if (document.check_all_city.ids_b.value.length > 1){
document.getElementById('wait_c').innerHTML=theStr;
}
if (document.check_all_city.ids_b.value.length > 1){
ajaxpage('check_disp_all.php?start=' + document.check_all_city.start_all.value + '&end=' + document.check_all_city.end_all.value + '&tmph=b&id_hotel_orig=' + document.check_all_city.ids_b.value + '&lg=' + document.check_all_city.lg.value + '', 'wait_b');
}
if (document.check_all_city.ids_h.value.length > 1){
ajaxpage('check_disp_all.php?start=' + document.check_all_city.start_all.value + '&end=' + document.check_all_city.end_all.value + '&tmph=h&id_hotel_orig=' + document.check_all_city.ids_h.value + '&lg=' + document.check_all_city.lg.value + '', 'wait_h');
}
if (document.check_all_city.ids_v.value.length > 1){
ajaxpage('check_disp_all.php?start=' + document.check_all_city.start_all.value + '&end=' + document.check_all_city.end_all.value + '&tmph=v&id_hotel_orig=' + document.check_all_city.ids_v.value + '&lg=' + document.check_all_city.lg.value + '', 'wait_v');
}
if (document.check_all_city.ids_c.value.length > 1){
ajaxpage('check_disp_all.php?start=' + document.check_all_city.start_all.value + '&end=' + document.check_all_city.end_all.value + '&tmph=c&id_hotel_orig=' + document.check_all_city.ids_c.value + '&lg=' + document.check_all_city.lg.value + '', 'wait_c');
}

function nulla(){
theStr ='ok';
document.getElementById('wait_b').innerHTML=theStr;
document.getElementById('wait_h').innerHTML=theStr;
document.getElementById('wait_c').innerHTML=theStr;
document.getElementById('wait_v').innerHTML=theStr;
}




}



/***********************************************
* Dynamic Ajax Content
***********************************************/

var bustcachevar=0 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){


var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {

var testo=page_request.responseText;

try {
if(testo.length>0){
document.getElementById(containerid).innerHTML=testo;
} else {
hideDiv('TR' + containerid);
}
} catch (e) {}
}
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}



