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();

	Icons_einstellen( Menuepunkt );

	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);
}

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

	Infothemen_klein();
}

function Icons_einstellen( Menuepunkt )
{
	var Umschlag = 'Gestaltung/duesterbeck/Bilder/2_Brief_geschlossen.png';
	var Infobutton = 'Bilder/Icons/22/info.png';

	if ( $('Info_' + Menuepunkt).style.display == 'none' )
	{
		switch( Menuepunkt )
		{
			case 'Kontakt':
				var Umschlag = 'Gestaltung/duesterbeck/Bilder/2_Brief.png';
			break;
		
			case 'Info':
				var Infobutton = 'Bilder/Icons/22/access.png';
			break;
		}
	}
	
	$('Icon_Kontakt').style.backgroundImage = 'url('+Umschlag+')';
	$('Icon_Info').style.backgroundImage = 'url('+Infobutton+')';
}

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 Info_Inhalt( Typ , aktion )
{
	Icons_einstellen( Typ );

	if ( aktion == 'ein' )
	{
		Hauptmenue_klein();

		Effect.BlindDown( 'Info_' + Typ , { duration:0.5 , queue:'end' } );
	}

	if ( aktion == 'aus' )
		Effect.BlindUp( 'Info_' + Typ , { duration:0.5 } );

/*
	if ( aktion == 'ein' )
	{
		Hauptmenue_klein();

		Effect.Appear( 'Info_' + Typ , { duration:0.5 , queue:'end' } );
	}

	if ( aktion == 'aus' )
		Effect.Fade( 'Info_' + Typ , { duration:0.5 } );
*/
}

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);
  }
}

