$(document).ready(function(){	

	if($('#map').length > 0)
		init_google("Buceriusstraße 2,20095 Hamburg, Deutschland");


	// Produktslider
	showStep = function(e){
		e.preventDefault();
		
		if($(".productsteaser .steps p:animated").length <= 0){
			
			var current = $('.productsteaser .steps p.active');					
			var target = 'p.' + $(this).attr('class').split(' ')[0] + '_text';

			if(!$(this).hasClass('active')){
				
				
				
			// aktuellen Button deaktiveren
			$('#productsStepNav a.active').removeClass('active');
			
			// neuen Button aktivieren
			$(this).addClass('active');
			
			
	

			// aktuellen Schritt ausblenden
			$(current).animate({
				top: '+=30px',
				opacity: 0
			}, 200, function(){
				
				$(this).removeClass('active');
				
				// nächsten Schritt einblenden
				$(target).css({
								'opacity': '0',
								'display': 'block',
								'top':'90px'
								}).addClass('active').animate({
																top: '-=30px',
																opacity: 1
																}, 200);
			
			});
			}
		}
				
		
		
	}

	// Produktslider aktivieren falls vorhanden
	if($('#productsStepNav').length > 0){
		$('#productsStepNav a').click(showStep);
	}


	function init_google(address) {
		var map;
		var geocoder	    = new google.maps.Geocoder();
		var latlng	    = new google.maps.LatLng(-34.397, 150.644);

		var myOptions = {
		    zoom:				17,
		    center:				latlng,
		    mapTypeId:				google.maps.MapTypeId.ROADMAP,
		    navigationControlOptions:		{style: google.maps.NavigationControlStyle.SMALL},
		    mapTypeControl:			false,
		    navigationControl:			true,
		    scaleControl:			true
		};

		map = new google.maps.Map(document.getElementById("map"), myOptions);


		if (geocoder) {
		    geocoder.geocode( { 'address': address}, function(results, status) {
		    if (status == google.maps.GeocoderStatus.OK) {
			map.setCenter(results[0].geometry.location);
			var marker = new google.maps.Marker({
			    map: map,
			    position: results[0].geometry.location
			});
		    } else {
			alert("Geocode was not successful for the following reason: " + status);
		    }
		    });
		}
	}
	
});

