	function apartmentSlideSwitch() {
	    var $active = $('#apartment_slideshow IMG.active');

	    if ( $active.length == 0 ) $active = $('#apartment_slideshow IMG:last');

	    var $next =  $active.next().length ? $active.next()
	        : $('#apartment_slideshow IMG:first');

	    $active.addClass('last-active');

	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate({opacity: 1.0}, 1000, function() {
	            $active.removeClass('active last-active');
	        });
	}

	function showGallery(){
		$('#apartment_slideshow').show();
		$('#floorplan').hide();
		$('#show_gallery').css("color", "#797a7c");
		$('#show_floorplan').css("color", "white");

		$('#show_gallery IMG').attr("src", "/fileadmin/templates/images/gallery_pfeil_aktiv.png");
		$('#show_floorplan IMG').attr("src", "/fileadmin/templates/images/gallery_pfeil.png");

		setInterval( "apartmentSlideSwitch()", 4000 );
	}


	function showFloorPlan(){
		$('#floorplan').show();
		$('#show_floorplan').css("color", "#797a7c");
		$('#show_gallery').css("color", "white");
		$('#apartment_slideshow').hide();

		$('#show_gallery IMG').attr("src", "/fileadmin/templates/images/gallery_pfeil.png");
		$('#show_floorplan IMG').attr("src", "/fileadmin/templates/images/gallery_pfeil_aktiv.png");

	}



	function createThumbGallery(){

				// Load first Image

				var first_image = $("a:first.gallery_thumb").attr('href');
				$("#show").html('<img src="'+first_image+'" />');

				// Add Click Event
				$("a.gallery_thumb").click(function(){
					var pic = $(this).attr('href');
					$("#show").html('<img src="'+pic+'" />');
					return false;
				});
	}
