// funzione per la chiamata dell'oggetto XMLHttpRequest
function ajax(){
  var ajaxRequest;
  try{
    // controllo per i browser diversi da IE
    ajaxRequest = new XMLHttpRequest();
  }catch (e){
    // contorollo per IE
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      }catch (e){
        // controllo per i browser che non supportano l'XMLHttpRequest
        alert("Il browser non supporta questo ShoutBox");
        return false;
      }
    }
  }
  return ajaxRequest;
}





function funzioneajax(parametro) {

  htmlRequest = ajax();
  // controllo nel caso in cui non possa richiamato l'oggetto Xmlhttp
  if (htmlRequest==null){ 
    alert ("Il browser non supporta richieste HTTP");
    return;
  }
  
 document.getElementById("contenuto").innerHTML = '<div align="center"><img src="images/ajax_loader.gif" /></div>';
 
 htmlRequest.onreadystatechange = function(){
    // Restituisce lo stato della richiesta
    if(htmlRequest.readyState == 4){
      // Restituice il corpo della risposta come stringa
      document.getElementById("contenuto").innerHTML = htmlRequest.responseText;
    }
  }


// chiamata della pagina PHP che estrae i records 
htmlRequest.open("GET", 'filerichiamatodaajax.php?parametro='+parametro, true);
htmlRequest.send(null);

}

















function cambiopromo_ajax(parametro) {

  htmlRequest = ajax();
  // controllo nel caso in cui non possa richiamato l'oggetto Xmlhttp
  if (htmlRequest==null){ 
    alert ("Il browser non supporta richieste HTTP");
    return;
  }
  
 document.getElementById("promo").innerHTML = '<div align="center"><img src="images/ajax_loader.gif" /></div>';
 
 htmlRequest.onreadystatechange = function(){
    // Restituisce lo stato della richiesta
    if(htmlRequest.readyState == 4){
      // Restituice il corpo della risposta come stringa
      document.getElementById("promo").innerHTML = htmlRequest.responseText;
    }
  }


// chiamata della pagina PHP che estrae i records 
htmlRequest.open("GET", 'promo-slide-homepage.php?id='+parametro, true);
htmlRequest.send(null);
}


function cambiopromo_ajax_rand() {

  htmlRequest = ajax();
  // controllo nel caso in cui non possa richiamato l'oggetto Xmlhttp
  if (htmlRequest==null){ 
    alert ("Il browser non supporta richieste HTTP");
    return;
  }
  
 document.getElementById("promo").innerHTML = '<div align="center"><img src="images/ajax_loader.gif" /></div>';
 
 htmlRequest.onreadystatechange = function(){
    // Restituisce lo stato della richiesta
    if(htmlRequest.readyState == 4){
      // Restituice il corpo della risposta come stringa
      document.getElementById("promo").innerHTML = htmlRequest.responseText;
    }
  }


// chiamata della pagina PHP che estrae i records 
htmlRequest.open("GET", 'promo-slide-homepage.php?rand=1', true);
htmlRequest.send(null);
}




function gira_pagina_hotel(parametro) {

  htmlRequest = ajax();
  // controllo nel caso in cui non possa richiamato l'oggetto Xmlhttp
  if (htmlRequest==null){ 
    alert ("Il browser non supporta richieste HTTP");
    return;
  }
  
 document.getElementById("girapagina").innerHTML = '<div align="center"><img src="images/ajax_loader.gif" /></div>';
 
 htmlRequest.onreadystatechange = function(){
    // Restituisce lo stato della richiesta
    if(htmlRequest.readyState == 4){
      // Restituice il corpo della risposta come stringa
      document.getElementById("girapagina").innerHTML = htmlRequest.responseText;
    }
  }


// chiamata della pagina PHP che estrae i records 
htmlRequest.open("GET", 'girapagina.php?id='+parametro, true);
htmlRequest.send(null);
}














function cambia_dettagli_hotel(parametro) {

  htmlRequest = ajax();
  // controllo nel caso in cui non possa richiamato l'oggetto Xmlhttp
  if (htmlRequest==null){ 
    alert ("Il browser non supporta richieste HTTP");
    return;
  }
  
 document.getElementById("hotel_cambio").innerHTML = '<div align="center"><img src="images/ajax_loader.gif" /></div>';
 
 htmlRequest.onreadystatechange = function(){
    // Restituisce lo stato della richiesta
    if(htmlRequest.readyState == 4){
      // Restituice il corpo della risposta come stringa
      document.getElementById("hotel_cambio").innerHTML = htmlRequest.responseText;
    }
  }


// chiamata della pagina PHP che estrae i records 
htmlRequest.open("GET", 'switch-info-hotel.php?id_hotel='+parametro, true);
htmlRequest.send(null);
}



