//var p_servername = "localhost/ahano";
var p_servername = "www.ahano.de";

function vorschau(id,id2,id3)
	{
	document.reisen_eingabe.kom.value = id2;
	document.reisen_eingabe.u_kom.value = id3;
	document.reisen_eingabe.admin.value = 2;
	document.reisen_eingabe.u_u_kom.value = id;
	document.reisen_eingabe.submit();
	}
	
function sendform_eingabe(id)
	{
	document.reisen_eingabe.kom.value = 16;
	document.reisen_eingabe.u_kom.value = 30;
	document.reisen_eingabe.u_u_kom.value = 0;
	document.reisen_eingabe.admin.value = 0;	
	document.reisen_eingabe.admin_id.value = 2;
	document.reisen_eingabe.daten_id.value = id;	
	document.reisen_eingabe.target = "_top";
	document.reisen_eingabe.submit();
	}



function check_email(emailadresse)
	{
	if ((emailadresse != '') && ((emailadresse.indexOf ('@') == -1) || (emailadresse.indexOf ('.') == -1)))
		{
		return false;
		}
	else
		{
		return true;
		}
	}

function ferienhaus_eintragen()
	{
	document.reisen_eingabe.kom.value = 16;
	document.reisen_eingabe.u_kom.value = 30;
	document.reisen_eingabe.u_u_kom.value = 0;	
	document.reisen_eingabe.admin.value = 0;
	document.reisen_eingabe.target = "_top";
	document.reisen_eingabe.submit();
	}		

function check_form_inhalte2()
	{
		if (document.Ansicht_Ausfuehrlich.name_email.value == '')
			{
			alert('Bitte geben Sie Ihren Namen an!')
			}
		else if (document.Ansicht_Ausfuehrlich.Email_email.value == '' && document.Ansicht_Ausfuehrlich.telefon_email.value == true)
			{
			alert('Bitte geben Sie Ihre Email-Adresse oder Ihre Telefonnummer an!')
			}
		else if (document.Ansicht_Ausfuehrlich.Email_email.value == '' && document.Ansicht_Ausfuehrlich.eigeneemail.checked == true)
			{
			alert('Falls Sie eine Kopie der Email wollen, müssen Sie Ihre Email-Adresse eingeben!')
			}
		else if (document.Ansicht_Ausfuehrlich.Email_email.value != '' && check_email(document.Ansicht_Ausfuehrlich.Email_email.value) != true)
			{
			alert('Ihre Emailadresse ist nicht gültig. Bitte korrigieren Sie Ihre Emailadresse!')
			}
		else
			{
			sendform_email_abschicken2()
			}
	}

function sendform_email_abschicken2()
	{
		document.Ansicht_Ausfuehrlich.email_senden_dienst.value=1;
		document.Ansicht_Ausfuehrlich.method = 'post';
		document.Ansicht_Ausfuehrlich.submit();
	}


function sendform_seite(seite)
	{
	document.form_seitennavi.seite.value = seite;
	document.form_seitennavi.submit();
	}

function email_freund()
	{
		document.Ansicht_Ausfuehrlich.email_senden_freund.value=1;
		document.Ansicht_Ausfuehrlich.method = 'post';		
		document.Ansicht_Ausfuehrlich.submit();
	}


function sendform_liste_form_post_feri_neu(id,id2,id3)
	{
	document.Ansicht_Ausfuehrlich.seite.value = id2;
	document.Ansicht_Ausfuehrlich.u_u_kom.value = "";
	document.Ansicht_Ausfuehrlich.action = 'http://'+id3+'/reisen/ferienunterkunft/ferienunterkunft-suche/#ank'+id;
	document.Ansicht_Ausfuehrlich.submit();
	}

function feri_treffer_seite(id,id2,id3,id4)
	{
	document.Ansicht_Ausfuehrlich.u_u_kom.value = id;
	document.Ansicht_Ausfuehrlich.seite.value = id2;
	document.Ansicht_Ausfuehrlich.register_id.value =1;
	document.Ansicht_Ausfuehrlich.action = 'http://'+id4+'/reisen/ferienunterkunft/'+id3;
	document.Ansicht_Ausfuehrlich.submit();
	}

function send_aktuelles_feri(id,id2,id3,id4)
	{
	document.Ansicht_Ausfuehrlich.u_u_kom.value = id;
	document.Ansicht_Ausfuehrlich.register_id.value =4;
	document.Ansicht_Ausfuehrlich.action = 'http://'+id4+'/reisen/ferienunterkunft/'+id3;
	document.Ansicht_Ausfuehrlich.submit();
	}

function feri_seiten_weiter(id,id2,id3,id4)
	{
	document.Ansicht_Ausfuehrlich.u_u_kom.value = id;
	document.Ansicht_Ausfuehrlich.seite.value = id2;
	document.Ansicht_Ausfuehrlich.register_id.value =1;
	document.Ansicht_Ausfuehrlich.action = 'http://'+id4+'/reisen/ferienunterkunft/'+id3;
	document.Ansicht_Ausfuehrlich.submit();
	}

function feri_neue_suche()
	{
	document.form_seitennavi.Filter_Ja_Nein.value = 2;
	document.form_seitennavi.submit();
	}	

function sendform_seite_ferienunterkunft(seite)
	{
	document.form_seitennavi.action = document.form_seitennavi.action+'ferienunterkunft-suche/#';		
	document.form_seitennavi.seite.value = seite;
	document.form_seitennavi.submit();
	}

var offne_detail_aus = 0;

function feri_oeffne_detail(id,id2)
	{
		if(offne_detail_aus  == 0)
			{
			offne_detail_aus = 1;
			document.form_liste.action = document.form_liste.action+id;
			document.form_liste.u_u_kom.value = id2;
			document.form_liste.submit();
			}
	}

bild_id_ak = 1;

function aktuell_register_div_1()
	{
		document.getElementById("register_detail_1").style.display = "none";
		document.getElementById("register_detail_3").style.display = "block";	
		document.getElementById("inaktiv_detail").style.color = "#ffffff";
		document.getElementById("aktiv_detail").style.color = "#73C12E";		
		document.getElementById("aktivfirst_reg_1_re").style.background = "url(http://www.ahano.de/images/reiseunterkunft/detail_inaktiv_rechts.gif) right top no-repeat";
		document.getElementById("aktivfirst_reg_1_li").style.background = "url(http://www.ahano.de/images/reiseunterkunft/detail_inaktiv_links_ab2.gif) left top no-repeat";
		document.getElementById("aktivfirst_reg_3_re").style.background = "url(http://www.ahano.de/images/reiseunterkunft/detail_aktiv_rechts.gif) right top no-repeat";
		document.getElementById("aktivfirst_reg_3_li").style.background = "url(http://www.ahano.de/images/reiseunterkunft/detail_aktiv_links_ab2.gif) left top no-repeat";
	}	

function send_auswahl_orte()
	{
		
		document.getElementById('fehler5').style.display = "none";	
		
		if (document.auswahl_orte.geo_id.value == '')
			{
				document.getElementById('fehler5').style.display = "block";
			}
		else
			{
				document.auswahl_orte.submit();
			}
	}

function send_register(reg)
	{
		document.Ansicht_Ausfuehrlich.register_id.value=reg;
		document.Ansicht_Ausfuehrlich.submit();
	}
	
function register_streichen(reg)
	{
		document.Ansicht_Ausfuehrlich.register_streichen.value=1;		
		document.Ansicht_Ausfuehrlich.register_streichen_id.value=reg;
		document.Ansicht_Ausfuehrlich.submit();
	}	
	
function galerie_bilder(id)
	{
		document.getElementById('galerie_'+bild_id_ak).style.display='none';
		document.getElementById('galerie_'+id).style.display='block';
		bild_id_ak = id;
	}
	

	
function email_freund_zurueck()
	{
		document.Ansicht_Ausfuehrlich.email_senden_freund.value=0;
		document.Ansicht_Ausfuehrlich.submit();
	}	
	
function detail_druck(http,domain)
{
	detail_druck_win=window.open( "http://"+domain+"/reisen/ferienunterkunft/detaildruck/"+http, 'detailpopup', 'height=650,width=654,left=10,top=20,scrollbars=1,resizable=0');
	detail_druck_win.focus();
}

function email_kontakt_zurueck()
	{
		document.Ansicht_Ausfuehrlich.email_senden_dienst.value=0;
		document.Ansicht_Ausfuehrlich.submit();
	}	


// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject() 
{	
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // if running Internet Explorer
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // if running Mozilla or other browsers
  else
  {
    try 
    {
      xmlHttp = new XMLHttpRequest();
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
 
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}


// stores the reference to the XMLHttpRequest object
var xmlHtt_MERK = createXmlHttpRequestObject();

function merkzettel_speichern()
{
  // proceed only if the xmlHttp object isn't busy
  if (xmlHtt_MERK.readyState == 4 || xmlHtt_MERK.readyState == 0)
  {
    // execute the quickstart.php page from the server
    xmlHtt_MERK.open("GET","http://"+p_servername+"/inc/reiseunterkunft/register_merken_interaktiv/register_speichern_interaktiv.inc.php", true);  
    // define the method to handle server responses
    xmlHtt_MERK.onreadystatechange = handleServerResponse_speichern;
    // make the server request
    xmlHtt_MERK.send(null);
  }
  else
    // if the connection is busy, try again after one second  
    setTimeout('merkzettel_speichern()', 1000);
}

// executed automatically when a message is received from the server
function handleServerResponse_speichern() 
{
  // move forward only if the transaction has completed
  if (xmlHtt_MERK.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHtt_MERK.status == 200) 
    {
      // extract the XML retrieved from the server
      xmlResponse = xmlHtt_MERK.responseText;
      // update the client display using the data received from the server

     	var id_tag = "merkzettel_gespeichert";			
    	document.getElementById(id_tag).firstChild.nodeValue = xmlResponse;

    } 
    // a HTTP status different than 200 signals an error
    else 
    {
      alert("There was a problem accessing the server: " + xmlHtt_MERK.statusText);
    }
  }
}


// stores the reference to the XMLHttpRequest object
var xmlHtt_feriMERK = createXmlHttpRequestObject();

// make asynchronous HTTP request using the XMLHttpRequest object 
function ferienunterkunft_merken(id)
{
  // proceed only if the xmlHttp object isn't busy
  if (xmlHtt_feriMERK.readyState == 4 || xmlHtt_feriMERK.readyState == 0)
  {
    // execute the quickstart.php page from the server
    xmlHtt_feriMERK.open("GET","http://"+p_servername+"/inc/reiseunterkunft/register_merken_interaktiv/register_merken_interaktiv.inc.php?wert=" + id, true);  
    // define the method to handle server responses
    xmlHtt_feriMERK.onreadystatechange = handleServerResponse_merken;
    // make the server request
    xmlHtt_feriMERK.send(null);
  }
  else
    // if the connection is busy, try again after one second  
    setTimeout('ferienunterkunft_merken()', 1000);
}

// make asynchronous HTTP request using the XMLHttpRequest object 
// für alle, die keine cookies zulassen
function ferienunterkunft_merken2(id,id2)
{
  // proceed only if the xmlHttp object isn't busy
  if (xmlHtt_feriMERK.readyState == 4 || xmlHtt_feriMERK.readyState == 0)
  {
    //alert("http://"+p_servername+"/inc/reiseunterkunft/register_merken_interaktiv/register_merken_interaktiv.inc.php?wert="+id+"&suchidaktiv="+id2);
    // execute the quickstart.php page from the server
    xmlHtt_feriMERK.open("GET","http://"+p_servername+"/inc/reiseunterkunft/register_merken_interaktiv/register_merken_interaktiv.inc.php?wert="+id+"&suchidaktiv="+id2, true);  
    // define the method to handle server responses
    xmlHtt_feriMERK.onreadystatechange = handleServerResponse_merken;
    // make the server request
    xmlHtt_feriMERK.send(null);
  }
  else
    // if the connection is busy, try again after one second  
    setTimeout('ferienunterkunft_merken()', 1000);
}


// executed automatically when a message is received from the server
function handleServerResponse_merken() 
{
  // move forward only if the transaction has completed
  if (xmlHtt_feriMERK.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHtt_feriMERK.status == 200) 
    {
      // extract the XML retrieved from the server
      xmlResponse = xmlHtt_feriMERK.responseText;
      // update the client display using the data received from the server

     	var id_tag = "merken_feri";			
    	document.getElementById(id_tag).firstChild.nodeValue = xmlResponse;

    } 
    // a HTTP status different than 200 signals an error
    else 
    {
      alert("There was a problem accessing the server: " + xmlHtt_feriMERK.statusText);
    }
  }
}












var bild_id_ak_laufen = 1;
var bild_laufen_hand = 0;


function start_aktuell(id)
	{
		if (bild_laufen_hand == 1)
			{
				bild_id_ak_laufen = 0;
				document.getElementById('bild'+bild_id_ak).style.display='none';
				document.getElementById('bild'+id).style.display='block';
				bild_id_ak = id;
			}
	}


function bildlaufen() 
	{
		if (bild_id_ak_laufen == 1)
		{
			document.getElementById('bild'+bild_id_ak).style.display='none';
			if (bild_id_ak == bild_id_ak_max)
			{
				bild_id_ak = 1;
			}
			else
			{
				bild_id_ak++;		
			}
			document.getElementById('bild'+bild_id_ak).style.display='block';

			setTimeout( "bildlaufen()", 6000 );
		}
	}	


function bildlaufen_minus() 
	{
		if (bild_laufen_hand == 1)
			{
				bild_id_ak_laufen = 0;

				document.getElementById('bild'+bild_id_ak).style.display='none';

				if (bild_id_ak == 1)
				{
					bild_id_ak = bild_id_ak_max;
				}
				else
				{
					bild_id_ak = bild_id_ak-1;
				}		
				document.getElementById('bild'+bild_id_ak).style.display='block';
			}
	}	


function bildlaufen_plus() 
	{
		if (bild_laufen_hand == 1)
			{
				bild_id_ak_laufen = 0;

				document.getElementById('bild'+bild_id_ak).style.display='none';

				if (bild_id_ak == bild_id_ak_max)
				{
					bild_id_ak = 1;
				}
				else
				{
					bild_id_ak = bild_id_ak+1;
				}		
				document.getElementById('bild'+bild_id_ak).style.display='block';
				bild_id_ak_laufen = 1;
			}
	}	

function bilder_starten()
	{
		setTimeout("bildlaufen()", 2000 );
		bild_laufen_hand = 1;
	}

function bilder_stoppen()
	{
		bild_id_ak_laufen = 0;	
	}	


function plz_nur_zahlen(plzpruefen)
{  
	fehler_plz = 0;
	zu_zei = "0123456789";
	var FehlerMeldung;
	for (var Pos = 0; Pos < 5; Pos++)
	{
		if (zu_zei.indexOf(plzpruefen.charAt(Pos)) == -1)
		{ 
			document.getElementById("fehler5").style.display = "block";
			fehler_plz = 1;
		}
	}
	return fehler_plz;	
}

function felder_gruen()
{
  document.getElementById("fehler4").style.display = "none";
  document.getElementById("fehler5").style.display = "none";
  document.getElementById("fehler6").style.display = "none";
  document.getElementById("fehler7").style.display = "none";  
  document.getElementById("sozio_land").style.backgroundColor="#ffffff";	
  document.getElementById("sozio_plz").style.backgroundColor="#ffffff";	  
  document.getElementById("sozio_stadt").style.backgroundColor="#ffffff";	  
}


var v_i = "";
var fehler_feld = "#C40042";
var j_f_sozio_land = "";
var j_f_sozio_plz = "";
var j_f_sozio_stadt = "";
var j_f_sozio_regio = "";
var j_f_sozio_object = "";
var j_f_sozio_umkreis = "";


function umkreis_pruefen()
{
 	felder_gruen();  
 
	if (document.getElementById("sozio_umkreis").value != j_f_sozio_umkreis)
	{
		document.getElementById("sozio_regio").value = 0;		
		change_form();
	}
}



function land_pruefen()
{
 	felder_gruen();  
  
  //wenn jemand das Land neu auswählt, dann wird Stadt, PLZ und Umkreis auf null gesetzt
	
	if (document.getElementById("sozio_land").value != j_f_sozio_land)
	{
		
		if (document.getElementById("sozio_land").value >= 0 && document.getElementById("sozio_land").value <= 5)
		{
			document.getElementById("sozio_umkreis").disabled=false;
		}
		else
		{
			document.getElementById("sozio_umkreis").disabled=true;		
		}
		
		document.getElementById("sozio_regio").value = 0;
		change_form();
	}
}





function stadt_pruefen()
{
 	felder_gruen();  
  
  //wenn jemand das Land neu auswählt, dann wird Stadt, PLZ und Umkreis auf null gesetzt
	
	if (document.getElementById("sozio_stadt").value != j_f_sozio_stadt)
	{
		change_form();
	}
}




function change_regio()
{
 	felder_gruen();  

	document.getElementById("sozio_plz").value = "";
	document.getElementById("sozio_umkreis").value = 0; 
	document.getElementById("sozio_land").value = 0;
	document.getElementById("sozio_stadt").value = "";
	
	if (document.getElementById("sozio_regio").value != j_f_sozio_regio)
	{
		change_form();
	}
}


function change_object()
{
 	felder_gruen();  
  
	if (document.getElementById("sozio_object").value != j_f_sozio_object)
	{
		change_form();
	}
}



function plz_pruefen()
{
	felder_gruen();
  fehler_zurueck = 0;

	if (document.getElementById("sozio_plz").value != j_f_sozio_plz) 
	{
		j_f_sozio_plz = document.getElementById("sozio_plz").value;

		document.getElementById("sozio_regio").value = 0;
		
		if (document.getElementById("sozio_land").value != 0) // bitte das Land eingeben
		{ 
			
			if (document.getElementById("sozio_land").value == 1) // wenn land Deutschland dann
			{
				if (document.getElementById("sozio_plz").value.length != 5 && document.getElementById("sozio_plz").value != "")
				{
					document.getElementById("fehler4").style.display = "block";
					document.getElementById("sozio_plz").style.backgroundColor=fehler_feld;
					fehler_zurueck = 1;
				}
				else if (plz_nur_zahlen(document.getElementById("sozio_plz").value) == 1)
				{
					document.getElementById("fehler5").style.display = "block";
					document.getElementById("sozio_plz").style.backgroundColor=fehler_feld;
					fehler_zurueck = 1;
				}
			}

			if (fehler_zurueck == 0) // wenn deutschland prüfung in Ordnung
			{

				change_form();
			}
		}
		else // bitte das Land eingeben
		{
			document.getElementById("fehler6").style.display = "block";			
			document.getElementById("sozio_land").style.backgroundColor=fehler_feld;
			//document.ausform.Sozio_1_Filter.focus();
		}
	}
}

// stores the reference to the XMLHttpRequest object
var xmlHtt_ferichange = createXmlHttpRequestObject();

// für die sucheingabe des Formulares 
function change_form()
{
  // proceed only if the xmlHttp object isn't busy
  if (xmlHtt_ferichange.readyState == 4 || xmlHtt_ferichange.readyState == 0)
  {

		j_f_sozio_land = document.getElementById("sozio_land").value;		
		j_f_sozio_plz = document.getElementById("sozio_plz").value;
		j_f_sozio_stadt = document.getElementById("sozio_stadt").value;
		j_f_sozio_umkreis = document.getElementById("sozio_umkreis").value; 
		j_f_sozio_regio = document.getElementById("sozio_regio").value;
		j_f_sozio_object = document.getElementById("sozio_object").value;
    
    //alert("http://"+p_servername+"/inc/reiseunterkunft/suche_aktiv/treffer_ausgeben_170309.inc.php?sozio_land="+j_f_sozio_land+"&sozio_plz="+j_f_sozio_plz+"&sozio_stadt="+j_f_sozio_stadt+"&sozio_umkreis="+j_f_sozio_umkreis+"&sozio_object="+j_f_sozio_object+"&sozio_regio="+j_f_sozio_regio);

    // execute the quickstart.php page from the server
    xmlHtt_ferichange.open("GET","http://"+p_servername+"/inc/reiseunterkunft/suche_aktiv/treffer_ausgeben_170309.inc.php?sozio_land="+j_f_sozio_land+"&sozio_plz="+j_f_sozio_plz+"&sozio_stadt="+j_f_sozio_stadt+"&sozio_umkreis="+j_f_sozio_umkreis+"&sozio_object="+j_f_sozio_object+"&sozio_regio="+j_f_sozio_regio, true);  
    // define the method to handle server responses
    xmlHtt_ferichange.onreadystatechange = change_form_ausgabe;
    // make the server request
    xmlHtt_ferichange.send(null);
  }
  else
    // if the connection is busy, try again after one second  
    setTimeout('change_form()', 1000);
}


// executed automatically when a message is received from the server
function change_form_ausgabe() 
{
  // move forward only if the transaction has completed
  if (xmlHtt_ferichange.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHtt_ferichange.status == 200) 
    {

      xmlResponse = parseInt(xmlHtt_ferichange.responseText);
     	var id_tag = "output_treffer";			
    	
    	if (xmlResponse == "-1")
    	{

    		document.ausform.Sozio_4_Filter.focus();    		
    		document.getElementById(id_tag).firstChild.nodeValue = 0;
    		document.getElementById("fehler7").style.display = "block";
    		document.getElementById("sozio_plz").style.backgroundColor=fehler_feld;

    	}
    	else
    	{
    		document.getElementById("output_treffer").firstChild.nodeValue = xmlResponse;
			}
    } 
    // a HTTP status different than 200 signals an error
    else 
    {
      //alert("There was a problem accessing the server: " + xmlHtt_ferichange.statusText);
    }
  }
}



