function arrivalDayCalculate()
{
  monatjahr = document.SuchForm.EingabeAnreiseMonat.value.split('-');
  datum = new Date(monatjahr[0], monatjahr[1]-1, document.SuchForm.EingabeAnreiseTag.value);  
  document.getElementById('ARRIVAL_WEEKDAY').innerHTML = Wochentage[datum.getDay()];
}

function departureDayCalculate()
{
  monatjahr = document.SuchForm.EingabeAbreiseMonat.value.split('-');
  datum = new Date(monatjahr[0], monatjahr[1]-1, document.SuchForm.EingabeAbreiseTag.value);  
  document.getElementById('DEPARTURE_WEEKDAY').innerHTML = Wochentage[datum.getDay()];
}

function setArrivalDay(adatum)
{
  document.SuchForm.EingabeAnreiseTag.selectedIndex = adatum.getDate()-1;
  if (adatum.getYear() < 2000)
  {
    year = adatum.getYear() + 1900;
  } else {
    year = adatum.getYear();
  }
  monat = adatum.getMonth()+1;
  if (monat < 10)
  {
    yearmonth = year+'-0'+monat;
  } else {
    yearmonth = year+'-'+monat;
  }

  for(var no=0;no<document.SuchForm.EingabeAnreiseMonat.options.length;no++)
  {
	if(document.SuchForm.EingabeAnreiseMonat.options[no].value==yearmonth)
	{
	  document.SuchForm.EingabeAnreiseMonat.selectedIndex=no;
	  break;
	}				
  }
}

function setDepartureDay(ddatum)
{
  document.SuchForm.EingabeAbreiseTag.selectedIndex = ddatum.getDate()-1;
  if (ddatum.getYear() < 2000)
  {
    year = ddatum.getYear() + 1900;
  } else {
    year = ddatum.getYear();
  }
  monat = ddatum.getMonth()+1;
  if (monat < 10)
  {
    yearmonth = year+'-0'+monat;
  } else {
    yearmonth = year+'-'+monat;
  }

  for(var no=0;no<document.SuchForm.EingabeAbreiseMonat.options.length;no++)
  {
	if(document.SuchForm.EingabeAbreiseMonat.options[no].value==yearmonth)
	{
	  document.SuchForm.EingabeAbreiseMonat.selectedIndex=no;
	  break;
	}				
  }

}

function arrivalDateCalculate()
{
  monatjahr = document.SuchForm.EingabeAnreiseMonat.value.split('-');
  adatum = new Date(monatjahr[0], monatjahr[1]-1, document.SuchForm.EingabeAnreiseTag.value);  
  monatjahr = document.SuchForm.EingabeAbreiseMonat.value.split('-');
  ddatum = new Date(monatjahr[0], monatjahr[1]-1, document.SuchForm.EingabeAbreiseTag.value);  
  
  if (adatum.getTime() >= ddatum.getTime())
  {
    ddatum = new Date(adatum.getTime()+86400000);
  }
  
  setArrivalDay(adatum);
  setDepartureDay(ddatum);
  
  arrivalDayCalculate();
  departureDayCalculate();
}

function bitteWarten()
{
  document.getElementById('Main').style.display='none';
  document.getElementById('AbsendenEbene').style.display='';
}

function bitteWartenAlternativ(satz1, satz2)
{
  document.getElementById('WartenSatz1').innerHTML = satz1;
  document.getElementById('WartenSatz2').innerHTML = satz2;
}

var senden = false;
var myform = false;
function finalsend() 
{
  myform.submit();
}

function absenden(formname)
{
  if (!senden) {
    myform = formname;
    bitteWarten();
    window.setTimeout("finalsend()", 100);
    return false;
  } else {
    return true;
  }
}

function openCloseChangeBox(opentext, closetext)
{
  if (document.getElementById('ChangeSearch').style.display=='none') {
    document.getElementById('ChangeSearch').style.display='';
	document.getElementById('EingabePreferred').style.display='none';
	document.getElementById('EingabeMainSortList').style.display='none';
	document.getElementById('buttonChangeSearch').value = closetext;
	clickTracker('SearchList_Change_Box');
} else {
    document.getElementById('ChangeSearch').style.display='none';
	document.getElementById('EingabePreferred').style.display='';
	document.getElementById('EingabeMainSortList').style.display='';
	document.getElementById('buttonChangeSearch').value = opentext;
  }
}

function scrollPhotoLeft()
{
  FotoFrame.scrollBy(-68,0);
}

function scrollPhotoRight()
{
  FotoFrame.scrollBy(68,0);
}

function HomepageLink(id, sessid)
{
  Drucken=window.open(systemappurl+'/hotellink.php?HotelID='+id+sessid, 'drucken', 'directories=no,scrollbars=no,status=no,resizable=no,toolbar=no,width=800,height=600,screenX=0,screenY=0');
}

function AnzahlZeichen(feld, max, anzeige)
{
  anzeige.innerHTML = max - feld.value.length;
}

function currencyCalc(value, currency, sessid, propcode)
{
  var w=420;
  var h=283;
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 104) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  parameter += ",menubar=no,location=no,toolbar=no,status=no";
  parameter += ",resizable=no,scrollbars=no";
  var Fenster = window.open('/currency.php?Value='+value+'&Currency='+currency+'&PropertyCode='+propcode+sessid, "calc", parameter);
  if (Fenster) Fenster.focus();
  return !Fenster;
}

/*
  Position eines Elementes ermitteln
*/
function getPosY(inputObj)
{
	
  var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
  return returnValue + calendar_offsetTop;
}

function getPosX(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue + calendar_offsetLeft;
}

function getSizeX() 
{   
  myWidth = 0;   
  if (typeof( window.innerWidth ) == 'number' ) {   
    //Non-IE   
    myWidth = window.innerWidth;   
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {   
    //IE 6+ in 'standards compliant mode'   
    myWidth = document.documentElement.clientWidth;   
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {   
    //IE 4 compatible   
    myWidth = document.body.clientWidth;   
  }   
  return myWidth;   
}

function getSizeY() 
{   
  myHeight = 0;   
  if (typeof( window.innerWidth ) == 'number' ) {   
    //Non-IE   
    myHeight = window.innerHeight;   
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {   
    //IE 6+ in 'standards compliant mode'   
    myHeight = document.documentElement.clientHeight;   
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {   
    //IE 4 compatible   
    myHeight = document.body.clientHeight;   
  }   
  return myHeight;   
}

function getScrollY()
{
  if (document.getElementById && !document.all) {
    return window.pageYOffset;
  } 
  else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
    return document.documentElement.scrollTop;
  } 
  else {
    return document.body.scrollTop;
  }
}

/*
  Favoriten-Funktionen
*/
var PreferredPreSelect = 0;

function addtofavorites(pc, id)
{
  with (new Ajax()) {
    url="/ajax/list_favorites.php";
    if (hotelsinliste[id][0]) {
	  params = "PropertyCode="+pc+"&Act=DEL"+systemsessionparammz;
	  PreferredCount--;
	} else {
	  params = "PropertyCode="+pc+"&Act=ADD"+systemsessionparammz;
	  PreferredCount++;
	}
	onSuccess=listSuccess;
	onError=listError;
	doRequest();
	clickTracker('SearchList_Select');
  }
}

function listSuccess(txt, xml)
{
  if (txt != "ERROR")
  {
    if (hotelsinliste[txt][0]) {
      document.getElementById("add"+txt).src='images/symbols/ecard_add.png';
      document.getElementById("hotelcheck"+txt).style.backgroundColor='#ffffff';
	  hotelsinliste[txt][0]=0;
	} else {
      document.getElementById("add"+txt).src='images/symbols/ecard_ok.png';
      document.getElementById("hotelcheck"+txt).style.backgroundColor='#90b3d9';
	  hotelsinliste[txt][0]=1;
	}
  }
}

function listError(msg)
{
  alert(msg);
}


function reloadPreferred(id, formname)
{
  if (id != 3) {
    bitteWarten(); 
	location.href='search_details.php?EingabePreferred='+formname.EingabePreferred.value+systemsessionparammz;
	clickTracker('SearchList_Select_'+id);
  } else {
    for (var pc in hotelsinliste) { 
	  if (hotelsinliste[pc][0]) {
	    with (new Ajax()) {
    	  url="/ajax/ecard_favorites.php";
    	  params = "PropertyCode="+hotelsinliste[pc][1]+"&Act=INS"+systemsessionparammz;
		  onSuccess=ecardSuccess;
		  onError=ecardError;
		  doRequest();
  		}
	  }
	}
    alert(translatewortefavecard);
	document.PreferredForm.EingabePreferred.selectedIndex = PreferredPreSelect;
	document.PreferredForm.EingabePreferred.blur();
	clickTracker('SearchList_Add_To_Fav');
  }
}

function reloadSort(id, formname)
{
  if ((id == 'PRICEASC') || (id == 'PRICEDESC') || 
      (id == 'KATASC') || (id == 'KATDESC') || 
      (id == 'NAMEASC') || (id == 'NAMEDESC') || 
      (id == 'DISTASC'))
  {
    bitteWarten(); 
	clickTracker('SearchList_Sort_'+id);
	location.href='search_details.php?NewSort=1&EingabePOI=0&EingabeSort='+id+systemsessionparammz;
  } else {
    bitteWarten(); 
	clickTracker('SearchList_Sort_POI');
	location.href='search_details.php?NewSort=1&EingabePOI='+id+'&EingabeSort=&EingabeOrtStrasse=&EingabeOrtPlz='+systemsessionparammz;
  }
}

function ecardSuccess(txt, xml)
{
  // Leer
}

function ecardError(msg)
{
  alert(msg);
}

function openMoreGteeRates()
{
  document.getElementById('OpenMoreGteeRates').style.display='none';
  document.getElementById('MoreGteeRates').style.display='';
}

function openMoreDepRates()
{
  document.getElementById('OpenMoreDepRates').style.display='none';
  document.getElementById('MoreDepRates').style.display='';
}

function hideMoreGteeRates()
{
  document.getElementById('MoreGteeRates').style.display='none';
  document.getElementById('OpenMoreGteeRates').style.display='';
}

function hideMoreDepRates()
{
  document.getElementById('MoreDepRates').style.display='none';
  document.getElementById('OpenMoreDepRates').style.display='';
}

function enableDisableHotels()
{
  if (!document.getElementById("EingabePreisOption1")) {
	return false;
  }
  
  var preisoption = 0;
  var amenityoption = 0;
  var auswahlvorhanden = 1;
  var hotelsimort = 0;
  var hotelsnichtimort = 0;
  var ipreisopt1 = document.getElementById("EingabePreisOption1");
  var ipreisopt2 = document.getElementById("EingabePreisOption2");
  var ipreisopt3 = document.getElementById("EingabePreisOption3");
  var ipreisopt4 = document.getElementById("EingabePreisOption4");
  var iausstparken = document.getElementById("EingabeAusstattungParkplatz");
  var iausstrest = document.getElementById("EingabeAusstattungRestaurant");
  var iausstklima = document.getElementById("EingabeAusstattungKlima");
  var iausstpool = document.getElementById("EingabeAusstattungPool");
  var iausstwell = document.getElementById("EingabeAusstattungWellness");
  var iausstrez = document.getElementById("EingabeAusstattungRezeption");
  var iausstaufzug = document.getElementById("EingabeAusstattungAufzug");
  var iausstbar = document.getElementById("EingabeAusstattungBar");
  var nochvorhanden = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  
  if (ipreisopt1.checked ||
	  ipreisopt2.checked ||
	  ipreisopt3.checked ||
	  ipreisopt4.checked) {
	preisoption = 1;
  }
  
  if (iausstparken.checked ||
	  iausstrest.checked ||
	  iausstklima.checked ||
	  iausstpool.checked ||
	  iausstwell.checked ||
	  iausstrez.checked ||
	  iausstaufzug.checked ||
	  iausstbar.checked) {
	amenityoption = 1;
  }
  
  for (var pc in hotelsinliste) { 
    if (amenityoption) {
	  hotelsinliste[pc][4] = 1;
	  if (iausstparken.checked && (hotelsinliste[pc][5] == 1)) {
	    hotelsinliste[pc][4] = 1;
	  } else if (iausstparken.checked && (hotelsinliste[pc][5] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstrest.checked && (hotelsinliste[pc][6] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstrest.checked && (hotelsinliste[pc][6] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstwell.checked && (hotelsinliste[pc][7] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstwell.checked && (hotelsinliste[pc][7] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstrez.checked && (hotelsinliste[pc][8] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstrez.checked && (hotelsinliste[pc][8] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstklima.checked && (hotelsinliste[pc][9] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstklima.checked && (hotelsinliste[pc][9] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstpool.checked && (hotelsinliste[pc][10] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstpool.checked && (hotelsinliste[pc][10] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstaufzug.checked && (hotelsinliste[pc][11] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstaufzug.checked && (hotelsinliste[pc][11] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  if (iausstbar.checked && (hotelsinliste[pc][12] == 1)) {
	    hotelsinliste[pc][4] = 1 && hotelsinliste[pc][4];
	  } else if (iausstbar.checked && (hotelsinliste[pc][12] == 0)) {
	    hotelsinliste[pc][4] = 0;
	  }
	  auswahlvorhanden = 1;
    } else {
      hotelsinliste[pc][4] = 1;
	  auswahlvorhanden = 0;
    }
	
	if (preisoption) {
	  hotelsinliste[pc][3] = 0;
	  if (ipreisopt1.checked && (hotelsinliste[pc][2] == 1)) {
	    hotelsinliste[pc][3] = 1;
	  }
	  if (ipreisopt2.checked && (hotelsinliste[pc][2] == 2)) {
	    hotelsinliste[pc][3] = 1;
	  }
	  if (ipreisopt3.checked && (hotelsinliste[pc][2] == 3)) {
	    hotelsinliste[pc][3] = 1;
	  }
	  if (ipreisopt4.checked && (hotelsinliste[pc][2] == 4)) {
	    hotelsinliste[pc][3] = 1;
	  }
	  auswahlvorhanden = auswahlvorhanden || 1;
    } else {
      hotelsinliste[pc][3] = 1;
	  auswahlvorhanden = auswahlvorhanden || 0;
	}
	  
	if (hotelsinliste[pc][4]) {
	  if (hotelsinliste[pc][2] == 1) {
		nochvorhanden[1]++
	  }
	  if (hotelsinliste[pc][2] == 2) {
		nochvorhanden[2]++
	  }
	  if (hotelsinliste[pc][2] == 3) {
		nochvorhanden[3]++
	  }
	  if (hotelsinliste[pc][2] == 4) {
		nochvorhanden[4]++
	  }
	}
	
	if (hotelsinliste[pc][3] && hotelsinliste[pc][4]) {
	  nochvorhanden[5] += hotelsinliste[pc][5];    // Parken
	  nochvorhanden[6] += hotelsinliste[pc][6];    // Restaurant
	  nochvorhanden[7] += hotelsinliste[pc][7];    // Wellness
	  nochvorhanden[8] += hotelsinliste[pc][8];    // 24h-Rezeption
	  nochvorhanden[9] += hotelsinliste[pc][9];    // Klimaanlage
	  nochvorhanden[10] += hotelsinliste[pc][10];  // Schwimmbad
	  nochvorhanden[11] += hotelsinliste[pc][11];  // Aufzug
	  nochvorhanden[12] += hotelsinliste[pc][12];  // Bar
	}
	
	hoteleintrag = document.getElementById("hotelaktiv"+pc);
	if (hoteleintrag) {
	  if (hotelsinliste[pc][3] && hotelsinliste[pc][4]) {
	    hoteleintrag.style.display='';
		if (hotelsinliste[pc][13] == 1) {
		  hotelsimort++;	
		} else {
		  hotelsnichtimort++;
		}
	  } else {
	    hoteleintrag.style.display='none';
	  }
	}
  }

  for (var hoption in nochvorhanden) { 
    if ((nochvorhanden[hoption]>0) && (hoption == 1)) {
	  ipreisopt1.disabled = false;
	  document.getElementById('LabelPreisOption1').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 1)) {
	  ipreisopt1.disabled = true;
	  ipreisopt1.checked = false;
	  document.getElementById('LabelPreisOption1').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 2)) {
	  ipreisopt2.disabled = false;
	  document.getElementById('LabelPreisOption2').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 2)) {
	  ipreisopt2.disabled = true;
	  ipreisopt2.checked = false;
	  document.getElementById('LabelPreisOption2').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 3)) {
	  ipreisopt3.disabled = false;
	  document.getElementById('LabelPreisOption3').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 3)) {
	  ipreisopt3.disabled = true;
	  ipreisopt3.checked = false;
	  document.getElementById('LabelPreisOption3').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 4)) {
	  ipreisopt4.disabled = false;
	  document.getElementById('LabelPreisOption4').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 4)) {
	  ipreisopt4.disabled = true;
	  ipreisopt4.checked = false;
	  document.getElementById('LabelPreisOption4').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 5)) {
	  iausstparken.disabled = false;
	  document.getElementById('LabelAusstattungParkplatz').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 5)) {
	  iausstparken.disabled = true;
	  iausstparken.checked = false;
	  document.getElementById('LabelAusstattungParkplatz').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 6)) {
	  iausstrest.disabled = false;
	  document.getElementById('LabelAusstattungRestaurant').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 6)) {
	  iausstrest.disabled = true;
	  iausstrest.checked = false;
	  document.getElementById('LabelAusstattungRestaurant').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 7)) {
	  iausstwell.disabled = false;
	  document.getElementById('LabelAusstattungWellness').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 7)) {
	  iausstwell.disabled = true;
	  iausstwell.checked = false;
	  document.getElementById('LabelAusstattungWellness').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 8)) {
	  iausstrez.disabled = false;
	  document.getElementById('LabelAusstattungRezeption').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 8)) {
	  iausstrez.disabled = true;
	  iausstrez.checked = false;
	  document.getElementById('LabelAusstattungRezeption').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 9)) {
	  iausstklima.disabled = false;
	  document.getElementById('LabelAusstattungKlima').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 9)) {
	  iausstklima.disabled = true;
	  iausstklima.checked = false;
	  document.getElementById('LabelAusstattungKlima').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 10)) {
	  iausstpool.disabled = false;
	  document.getElementById('LabelAusstattungPool').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 10)) {
	  iausstpool.disabled = true;
	  iausstpool.checked = false;
	  document.getElementById('LabelAusstattungPool').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 11)) {
	  iausstaufzug.disabled = false;
	  document.getElementById('LabelAusstattungAufzug').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 11)) {
	  iausstaufzug.disabled = true;
	  iausstaufzug.checked = false;
	  document.getElementById('LabelAusstattungAufzug').style.color='#bfbfbf';
	}
	
    if ((nochvorhanden[hoption]>0) && (hoption == 12)) {
	  iausstbar.disabled = false;
	  document.getElementById('LabelAusstattungBar').style.color='';
	} else if ((nochvorhanden[hoption] == 0) && (hoption == 12)) {
	  iausstbar.disabled = true;
	  iausstbar.checked = false;
	  document.getElementById('LabelAusstattungBar').style.color='#bfbfbf';
	}
  }
  
  if (auswahlvorhanden && !hotelsnichtimort && document.getElementById('AltOrteTrennerLinie')) {
    document.getElementById('AltOrteTrennerLinie').style.display = 'none';
    document.getElementById('AltOrteTrennerText').style.display = 'none';
  } else if (document.getElementById('AltOrteTrennerLinie')) {
    document.getElementById('AltOrteTrennerLinie').style.display = '';
    document.getElementById('AltOrteTrennerText').style.display = '';
  }
}

function clickPriceOption(po,val)
{
  enableDisableHotels();
  
  setTimeout("clickPriceAjax('"+po+"','"+val+"')", 10);
}

function clickPriceAjax(po,val)
{
  with (new Ajax()) {
    url="/ajax/list_price.php";
	params = "PriceOption="+po+"&Value="+val+systemsessionparammz;
	onSuccess=clickPriceSuccess;
	onError=clickPriceError;
	doRequest();
	clickTracker('SearchList_Price');
  } 
}

function clickPriceSuccess(txt, xml)
{
}

function clickPriceError(txt, xml)
{
}

function clickAmenityOption(po,val)
{
  enableDisableHotels();
  
  setTimeout("clickAmenityAjax('"+po+"','"+val+"')", 10);
}

function clickAmenityAjax(po,val)
{
  with (new Ajax()) {
    url="/ajax/list_amenity.php";
	params = "AmenityOption="+po+"&Value="+val+systemsessionparammz;
	onSuccess=clickAmenitySuccess;
	onError=clickAmenityError;
	doRequest();
	clickTracker('SearchList_Amenity');
  }
}

function clickAmenitySuccess(txt, xml)
{
}

function clickAmenityError(txt, xml)
{
}

function resetOptions()
{
  document.getElementById("EingabePreisOption1").checked = false;
  document.getElementById("EingabePreisOption2").checked = false;
  document.getElementById("EingabePreisOption3").checked = false;
  document.getElementById("EingabePreisOption4").checked = false;
  document.getElementById("EingabeAusstattungParkplatz").checked = false;
  document.getElementById("EingabeAusstattungRestaurant").checked = false;
  document.getElementById("EingabeAusstattungKlima").checked = false;
  document.getElementById("EingabeAusstattungPool").checked = false;
  document.getElementById("EingabeAusstattungWellness").checked = false;
  document.getElementById("EingabeAusstattungRezeption").checked = false;
  document.getElementById("EingabeAusstattungAufzug").checked = false;
  document.getElementById("EingabeAusstattungBar").checked = false;
  
  enableDisableHotels();
}

/*
   eTracker Klick-Tracker 
*/
var toSleep = true; 
function stopTimer()
{
  toSleep = false;
}

function clickTracker(LinkName)
{
  var secureID="T8K6pm";
  var redirectUrl="https://www.etracker.de/skin/de.def/img/1px.gif";
  etrackerSink=new Image(1,1);
  toSleep=true;
  etrackerSink.src="https://www.etracker.de/lnkcnt.php?et="+secureID+"&url="+
  redirectUrl+"&lnkname="+LinkName;
  etrackerSink.onload=stopTimer;
  if (toSleep == true)
  {
    maxDelay(500);
  }
  return true;
}

function maxDelay(gap)
{
  var then,now;
  then=new Date().getTime();
  now=then; 
  while( toSleep==true&&(now-then)<gap)
  {
    now=new Date().getTime();
  }
}

/*
   Map24-Funktionen
*/
function setHome(x, y, w) {
	// commands array
	var commands = new Array();
	// command to set the home view
	commands.push(
		new Map24.WebServices.XMLCommandWrapper({
  			SetHomeView: new Map24.WebServices.SetHomeView({
				Coordinates: [ 
							new Map24.WebServices.Coordinate({
								Longitude: x,
								Latitude: y
							})
				],
	            ClippingWidth: new Map24.WebServices.SetMapViewClippingWidth({
					// the ClippingWidth (ZoomLevel) you want to use
					MinimumWidth: w
	            })
		    })
	   })
	);
	// submit all commands
	Map24.MapApplication._LocalConnection.mapletRemoteControl(
		new Map24.WebServices.Message.mapletRemoteControlRequest({
			MapletRemoteControlRequest: new Map24.WebServices.MapletRemoteControlRequest({
				Map24MRC: new Map24.WebServices.Map24MRC({
					Commands: commands
				})
			})
		})
	);
}

function setHomeApplet(x, y, w) {
	// commands array
	var commands = new Array();
	// command to set the home view
	commands.push(
		new Map24.WebServices.XMLCommandWrapper({
  			SetHomeView: new Map24.WebServices.SetHomeView({
				Coordinates: [ 
							new Map24.WebServices.Coordinate({
								Longitude: x,
								Latitude: y
							})
				],
	            ClippingWidth: new Map24.WebServices.SetMapViewClippingWidth({
					// the ClippingWidth (ZoomLevel) you want to use
					MinimumWidth: w
	            })
		    })
	   })
	);
	// submit all commands
	Map24.MapApplication._RemoteConnection.mapletRemoteControl(
		new Map24.WebServices.Message.mapletRemoteControlRequest({
			MapletRemoteControlRequest: new Map24.WebServices.MapletRemoteControlRequest({
				Map24MRC: new Map24.WebServices.Map24MRC({
					Commands: commands
				})
			})
		})
	);
}

/*
  AJAX
*/
function Ajax() {
  //Eigenschaften deklarieren und initialisieren
  this.url="";
  this.params="";
  this.method="GET";
  this.onSuccess=null;
  this.onError=function (msg) {
    alert(msg)
  }
}

Ajax.prototype.doRequest=function() {
  //eberpruefen der Angaben
  if (!this.url) {
    this.onError("Es wurde kein URL angegeben. Der Request wird abgebrochen.");
    return false;
  }

  if (!this.method) {
    this.method="GET";
  } else {
    this.method=this.method.toUpperCase();
  }

  //Zugriff auf Klasse fr readyStateHandler ermglichen  
  var _this = this;
  
  //XMLHttpRequest-Objekt erstellen
  var xmlHttpRequest=getXMLHttpRequest();
  if (!xmlHttpRequest) {
    this.onError("Es konnte kein XMLHttpRequest-Objekt erstellt werden.");
    return false;
  }
  
  //Fallunterscheidung nach bertragungsmethode
  switch (this.method) {
    case "GET": xmlHttpRequest.open(this.method, this.url+"?"+this.params, true);
                xmlHttpRequest.onreadystatechange = readyStateHandler;
                xmlHttpRequest.send(null);
                break;
    case "POST": xmlHttpRequest.open(this.method, this.url, true);
                 xmlHttpRequest.onreadystatechange = readyStateHandler;
                 xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                 xmlHttpRequest.send(this.params);
                 break;
  }  

  //Private Methode zur Verarbeitung der erhaltenen Daten
  function readyStateHandler() {
    if (xmlHttpRequest.readyState < 4) {
      return false;
    }
    if (xmlHttpRequest.status == 200 || xmlHttpRequest.status==304) {
      if (_this.onSuccess) {
        _this.onSuccess(xmlHttpRequest.responseText, xmlHttpRequest.responseXML);
      }
    } else {
      if (_this.onError) {
        _this.onError("["+xmlHttpRequest.status+" "+xmlHttpRequest.statusText+"] Es trat ein Fehler bei der Datenbertragung auf.");
      }
    }
  }
}

//Gibt browserunabhngig ein XMLHttpRequest-Objekt zurck
function getXMLHttpRequest() 
{
  if (window.XMLHttpRequest) {
    //XMLHttpRequest fr Firefox, Opera, Safari, ...
    var obj = new XMLHttpRequest();
    return obj;
  } else 
  if (window.ActiveXObject) {
    try {   
      //XMLHTTP (neu) fr Internet Explorer 
      return new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
      try {        
        //XMLHTTP (alt) fr Internet Explorer
        return new ActiveXObject("Microsoft.XMLHTTP");  
      } catch (e) {
        return null;
      }
    }
  }
  return false;
}

/*
  Scripte Dreamweaver
*/
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
