var xmlhttp;
//******************************************************************************
function launch(filename){
	//window.event.ReturnValue = false;
	newWind1 = window.open(filename, "_edition", "toobar=no, menubar=no, statusbar=no, scrollbars=n0, resizable=no, width=800, height=600, top = 10, left=50 ");
	return false;
}
//******************************************************************************
function launch_map(filename){
	//window.event.ReturnValue = false;
	newWind1 = window.open(filename, "_edition", "toobar=no, menubar=no, statusbar=no, scrollbars=n0, resizable=no, width=695, height=390, top = 10, left=50 ");
	return false;
}

//******************************************************************************
function get_villa_prices_offers(villa_id){
// returns the prices and offers for a villa
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }

var url="../../php/get-villas-prices-offers.php";
url=url+"?id="+villa_id +"&sid="+Math.random();
xmlhttp.onreadystatechange=stateVillasChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateVillasChanged(){
if (xmlhttp.readyState==4){
document.getElementById("idPricesOffers").innerHTML=xmlhttp.responseText;
}}

//******************************************************************************
function get_all_villas_offers(){
// returns the prices and offers for all villas
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }

var url="php/get-all-villas-offers.php";
url=url+"?sid="+Math.random();
xmlhttp.onreadystatechange=stateAllVillasOffersChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateAllVillasOffersChanged(){
if (xmlhttp.readyState==4){
document.getElementById("idPricesOffers").innerHTML=xmlhttp.responseText;
}}
//******************************************************************************

function get_villa_comments(villa_id){
// returns the guests comments for a villa
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }

var url="../../php/get-villa-comments.php";
url=url+"?id="+villa_id +"&sid="+Math.random();
xmlhttp.onreadystatechange=stateVillasCommentsChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateVillasCommentsChanged(){
if (xmlhttp.readyState==4){
document.getElementById("idVillaComments").innerHTML=xmlhttp.responseText;
}}
//******************************************************************************


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}