$(document).ready(function()
{

	// $('#imprint').css({ display: 'none' });		// removed because its flickers ugly in IE7 ...
													// hides imprint only when Javascript ist acvtive
	$('a#imprint-link').click(function(event)
	{
		if ($('#contact').css('display') == 'block' && $('#map').css('display') == 'none')
		{
			event.preventDefault();
			
			$('#contact').animate({ opacity: 0, left: 190 }, 'slow', function() { 			// fade contact out..
						
				$(this).css({ display: 'none' }); 											// hide contact..
				$('#imprint').css({ left: 90, opacity: 0, display: 'block' }) 				// move imprint in the right position..
				.animate({ opacity: 1, left: 13 }, 'normal', function() {					// fade imprint in

					if(jQuery.browser.msie) 												// restore cleartype in IE7
						$(this).get(0).style.removeAttribute('filter');	
				});
			});
		}
	}); // end click
		
	$('a#back-link').click(function(event)
	{
		event.preventDefault();
			
		$('#imprint').animate({ opacity: 0, left: 190}, 'slow', function() {			// fade imprint out..

			$(this).css({ display: 'none' });											// hide imprint..
			$('#contact').css({ left: 90, opacity: 0, display: 'block' })				// move contact in the right position..
			.animate({ opacity: 1, left: 13 }, 'normal', function() {					// fade contact in

				if(jQuery.browser.msie)													// restore cleartype in IE7
					$(this).get(0).style.removeAttribute('filter');
			});
		});
	});

	$('a#map-link').click(function(event)
	{
		event.preventDefault();
	
		if ($('#image img').css('display') == 'block')
		{
			$('#image img').fadeOut('normal', function() {
			
				$('#map').fadeIn('slow');
				
					if (GBrowserIsCompatible())
					{
						var map = new GMap2($("#gm")[0]);
						var point = new GLatLng(50.938086, 6.945136);
						map.setCenter(point, 16);
						map.addControl(new GSmallMapControl());
						map.addOverlay(new GMarker(point));
					}
					
				$('a#map-link').text('// Zurück');	
			});
		}
		else
		{
			$('#map').fadeOut('normal', function() {
				
				GUnload()
				$('gm').remove();
				$('#image img').fadeIn('slow');
				$('a#map-link').text('// Anfahrts-Karte');	
			});
		}
	});


}); // ready