
function Datei( Name )
{
	var Herunterladen = new Ajax.Request( '../intern/Statistik_AJAX.php' , { method:'post' , parameters:'dok=Datei_'+Name  } );
}

function EMail_Adresse( Name )
{
	var LLK_account="kreis";
	var Buch_account="buch";
	var Boek_account="boek";
	var Rainer_account="rainer";
	var domain="liebe-licht-kreis-jesu-christi";
	var maindomain="de";

	switch( Name )
	{
		case 'kreis':
			var EMail = LLK_account + "@" + domain + "." + maindomain;
		break;

		case 'Buch':
			var EMail = Buch_account + "@" + domain + "." + maindomain;
		break;

		case 'Boek':
			var EMail = Boek_account + "@" + domain + "." + maindomain;
		break;

		case 'rainer':
			var EMail = Rainer_account + "@" + domain + "." + maindomain;
		break;
	}
	
	return EMail;
}

function Preischeck()
{
	var VPreis = 0;

	if ( $('Freitagabend').checked == true ) VPreis = VPreis + 8;
	if ( $('Samstagfrueh').checked == true ) VPreis = VPreis + 6.50;
	if ( $('Samstagmittag').checked == true ) VPreis = VPreis + 8;
	if ( $('Samstagabend').checked == true ) VPreis = VPreis + 8;
	if ( $('Sonntagfrueh').checked == true ) VPreis = VPreis + 6.50;
	if ( $('Sonntagmittag').checked == true ) VPreis = VPreis + 8;

	if (VPreis > 0)
		$('Nullpension').checked = false;
	else
		$('Nullpension').checked = true;

	$('Verpflegungspreis').update( 'Preis: ' + VPreis + ' EUR' );
}

function Ein( ID )
{
	Effect.BlindDown( ID , { duration:0.3 } );
}

function Aus( ID )
{
	Effect.BlindUp( ID , { duration:0.3 } );
}

function AusEin( IDaus , IDein )
{
	Effect.Fade( IDaus , { duration:0.3 , queue:'front' } );
	Effect.Appear( IDein , { duration:0.3 , queue:'end' } );
}

function pruefen()
{
	var Meldung = '';

	Meldung = Meldung + Formularfeld('Vorname');

	Meldung = Meldung + Formularfeld('Name');

	Meldung = Meldung + Formularfeld('Anschrift');

	Meldung = Meldung + Formularfeld('Telefon');

	Meldung = Meldung + Formularfeld('EMail');

	Meldung = Meldung + Auswahlfeld('Unterbringung');

	Meldung = Meldung + Auswahlfeld('Uebernachtung');

	Meldung = Meldung + Auswahlfeld('Bettwaesche');

	Meldung = Meldung + Auswahlfeld('Verpflegung');

	if ( Meldung != '' )
	{
		alert('Die folgenden Informationen sind für die Anmeldung noch erforderlich:' + "\n\n" + Meldung + "\n" + 'Bitte fülle das Formular vollständig aus.' + "\n" + 'Vielen Dank.');

		return false;
	}
	else
		return true;
}

function Formularfeld( ID )
{
	var Meldung_tmp = '';

	if ( $( ID ).value == '' )
	{
		switch( ID )
		{
			case 'Vorname':
				Meldung_tmp = '+ Dein Vorname' + "\n";
			break;
	
			case 'Name':
				Meldung_tmp = '+ Dein Nachname' + "\n";
			break;
	
			case 'Anschrift':
				Meldung_tmp = '+ Deine Anschrift' + "\n";
			break;
	
			case 'Telefon':
				Meldung_tmp = '+ Deine Telefonnummer' + "\n";
			break;
	
			case 'EMail':
				Meldung_tmp = '+ Deine E-Mail-Adresse' + "\n";
			break;
		}

		$( ID ).style.backgroundColor='lightyellow';
	}
	else
		if ( ID == 'EMail' )
		{
			var rx = /^([^\s@,:"<>]+)@([^\s@,:"<>]+\.[^\s@,:"<>.\d]{2,}|(\d{1,3}\.){3}\d{1,3})$/;
			var part = $('EMail').value.match(rx);

			if ( ! part)
			{
				Meldung_tmp = '+ Deine E-Mail-Adresse ist fehlerhaft' + "\n";

				$( ID ).style.backgroundColor='lightyellow';
			}
			else
				$( ID ).style.backgroundColor='white';
		}
		else
			$( ID ).style.backgroundColor='white';

	return Meldung_tmp;
}


function Auswahlfeld( ID )
{
	var Meldung_tmp = '';

	if ( $( ID ).value == '' )
	{
		$( ID ).style.backgroundColor='lightyellow';
	}
	else
		$( ID ).style.backgroundColor='white';

	switch( ID )
	{
		case 'Verpflegung':
			if ( ( $('Vegetarisch').checked == false ) && ( $('Normal').checked == false ) )
				Meldung_tmp = '+ Dein Verpflegungstyp' + "\n";
		break;

		case 'Unterbringung':
			if ( ( $('UnterbringungL').checked == false ) && ( $('UnterbringungA').checked == false ) )
				Meldung_tmp = '+ Dein Unterbringungsort' + "\n";
		break;

		case 'Uebernachtung':
			if ( ( $('UnterbringungL').checked == true ) && ( $('UebernachtungFS').checked == false ) && ( $('UebernachtungSS').checked == false ) )
				Meldung_tmp = '+ Anzahl der Nächte' + "\n";
		break;

		case 'Bettwaesche':
			if ( ( $('UnterbringungL').checked == true ) && ( $('KeineBettwaesche').checked == false ) && ( $('BettwaescheLeihen').checked == false ) )
				Meldung_tmp = '+ Angabe zu Bettwäsche/Handtücher' + "\n";
		break;
	}

	return Meldung_tmp;
}

function Mahlzeiten( wieviele )
{
	switch( wieviele )
	{
		case 'alle':	$('Freitagabend').checked = true;
						$('Samstagfrueh').checked = true;
						$('Samstagmittag').checked = true;
						$('Samstagabend').checked = true;
						$('Sonntagfrueh').checked = true;
						$('Sonntagmittag').checked = true;
						$('Nullpension').checked = false;
		break;
		case 'keine':	$('Freitagabend').checked = false;
						$('Samstagfrueh').checked = false;
						$('Samstagmittag').checked = false;
						$('Samstagabend').checked = false;
						$('Sonntagfrueh').checked = false;
						$('Sonntagmittag').checked = false;
						$('Vollpension').checked = false;
		break;
	}
}

function Auswahl( Typ , Gruppe , dies )
{
	switch( Gruppe )
	{
		case 'Ort':
			if ( ( $('imLabenbachhof').style.display != 'none' ) && (Typ != 'imLabenbachhof') )
				Effect.BlindUp('imLabenbachhof',{duration:0.5});

			if ( ( $('ausserhalb').style.display != 'none' ) && (Typ != 'ausserhalb') )
				Effect.BlindUp('ausserhalb',{duration:0.5});
		break;
	}

	if ( $(Typ).style.display == 'none' ) Effect.BlindDown( Typ , { duration:0.5 } );
}


function Laden( Menuepunkt )
{
	if ( $('Info_'+Menuepunkt).innerHTML == '' )
	{
		var Neues = new Ajax.Request( 'Inhalt/duesterbeck/' + Menuepunkt + '.php' , { onSuccess:function(originalRequest) { $('Info_' + Menuepunkt ).innerHTML = originalRequest.responseText; } } );
	}
}

function Infoflaeche( Menuepunkt , Wo , lat , lon )
{
	Effect.toggle( 'Info_' + Menuepunkt , 'blind' , { duration:0.5 } );

	Hauptmenue_klein();

	if ( Wo == '')
		Infobereich_klein();
	else
		if ( Wo != 'x' )
			Pfeil_drehen( Wo , 'Info_'+Menuepunkt );

	if ( lat != null )
	{
		var zeigen = function() { initialize(lat , lon , '') };
		zeigen.delay(0.1);
	}
	
	var stat = function()
	{
		if ( $('Info_'+Menuepunkt).style.display != 'none' )
		{
			var pars = 'Titel=' + Menuepunkt;
			var Statistikum = new Ajax.Request( 'Code/Statistikdaten_sammeln.php' , { method:'post' , parameters:pars } );
		}
	};
	stat.delay(0.6);

	Details_klein( Menuepunkt , '' );
}

function Infothema( Menuepunkt , Dauer )
{
	Effect.toggle( 'Info_' + Menuepunkt , 'blind' , { duration:Dauer , queue:'end' } );

	Infothemen_klein();
}

function Details( Bereich , Menuepunkt , Dauer )
{
	Details_klein( Bereich , Menuepunkt );

	Effect.toggle( Bereich + '_' + Menuepunkt , 'blind' , { duration:Dauer } );
}

function Pfeil_drehen( Wo , zeige )
{
	var Pfeil_unten = 'Bilder/Icons/klein/down.png';
	var Pfeil_rechts = 'Bilder/Icons/klein/forward.png';

	if ( $( zeige ).style.display == 'none' )
	{
		var Pfeil = 'url(' + Pfeil_unten + ')';
	}
	else
		{
			var Pfeil = 'url(' + Pfeil_rechts + ')';
		}

	if ( Wo != '' )
		$(Wo).style.backgroundImage = Pfeil;
}

function Einblenden( Menuepunkt )
{
	Effect.Appear( 'Info_' + Menuepunkt , { duration:0.5 } );
}

function Hauptmenue_klein()
{
	if ( $('Info_Nutzen').style.display != 'none' )
	    Effect.BlindUp('Info_Nutzen' , { duration:0.5 , queue:'front' } )

	if ( $('Info_Angebot').style.display != 'none' )
	    Effect.BlindUp('Info_Angebot' , { duration:0.5 , queue:'end' } )

	if ( $('Info_Referenzen').style.display != 'none' )
	    Effect.BlindUp('Info_Referenzen' , { duration:0.5 , queue:'end' } )

	if ( $('Info_Fotografien').style.display != 'none' )
	    Effect.BlindUp('Info_Fotografien' , { duration:0.5 , queue:'end' } )
}

function Infobereich_klein()
{
	if ( $('Info_Kontakt').style.display != 'none' )
	    Effect.BlindUp('Info_Kontakt' , { duration:0.5 , queue:'front' } )

	if ( $('Info_Impressum').style.display != 'none' )
	    Effect.BlindUp('Info_Impressum' , { duration:0.5 , queue:'end' } )

	if ( $('Info_Info').style.display != 'none' )
	    Effect.BlindUp('Info_Info' , { duration:0.5 , queue:'end' } )
}

function Infothemen_klein()
{
	var iThemen = new Array( 'Person' , 'Kosten' , 'Rechte' );

	for (var nr = 0; nr < iThemen.length; ++nr)
	{
		if ( $('Info_' + iThemen[nr] ).style.display != 'none' )
			Effect.BlindUp('Info_'+iThemen[nr] , { duration:0.5 } );
	}
}

function Details_klein( Bereich , Auswahl )
{
	switch(Bereich)
	{
		case 'Nutzen':
			var iDetails = new Array( 'Auftritt' , 'NeueWebsite' , 'Optimierung' , 'Leistungen' , 'Einfluss' , 'Umsatz' , 'Image' );
		break;

		case 'Angebot':
			var iDetails = new Array( 'GrafikDesign' , 'WWW' , 'Vermarktung' , 'Freelancing' , 'Text' );
		break;
	}

	for (var nr = 0; nr < iDetails.length; ++nr)
	{
		if ( $( Bereich + '_' + iDetails[nr] ).style.display != 'none' )
			Effect.BlindUp(Bereich+'_'+iDetails[nr] , { duration:0.2 } );
	}
}

function Fotos_zeigen( Ordner )
{
	if ( Ordner != '' )
		var pars = 'nr='+Ordner;
	else
		var pars = '';

	var Neues = new Ajax.Request( 'Inhalt/duesterbeck/Fotografien.php' , 
	{ method:'post' , parameters:pars , onSuccess:function(originalRequest) { $('Info_Fotografien').innerHTML = originalRequest.responseText; }
	} );
}

function Marker_setzen(map, lat, lon, Fenstertext)
{
    var latlng = new GLatLng(lat, lon);
    var marker = new GMarker(latlng);

    GEvent.addListener(marker, "click", function() {  marker.openInfoWindowHtml(Fenstertext); } );

    map.addOverlay(marker);
}

function initialize(lat , lon , Markerinfo)
{
  if (GBrowserIsCompatible())
  {
    var map = new GMap2(document.getElementById("Karte"));
    var zoom = 12;
    map.setCenter(new GLatLng(lat , lon) , zoom);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    Marker_setzen(map, lat , lon , Markerinfo);
  }
}


