			// SHOW KEY VISUAL (first, next, prev)
			function showIpadFlashGallery(direction)
			{
				
				$("#ipad_flash_gallery .info_text").hide();
				$("#ipad_flash_gallery_preloader").show();
				$("#ipad_flash_gallery_content").hide();
				
				
				//alert(direction);
				
				if (direction == "next")
				{
					var currentItem = parseInt($("#ipad_flash_gallery_content").attr("class").substr(5));
					var item = (currentItem + 1);
					if (currentItem == 9) var item = 1;
				}
				
				if (direction == "prev")
				{
					var currentItem = parseInt($("#ipad_flash_gallery_content").attr("class").substr(5));
					var item = (currentItem - 1);
					if (currentItem == 1) var item = 9;
				}
				
				if (direction == "1" || direction == "2" || direction == "3" || direction == "4" || direction == "5" || direction == "6" || direction == "7" || direction == "8" || direction == "9")
				{
					var item = parseInt(direction);
				}
				
				$('#ipad_flash_gallery_navi span').removeClass('active');
				$('#navi_' + item + '.gallery_item').addClass('active');
				
				$.get("startseiten_daten_xml.php", function(XMLArray){
  
					// suche bild mit id = item 
					var $bild = $(XMLArray).find('bild[id="' + item + '"]');

					var id = $bild.attr("id");
					var dateiname = $bild.find("dateiname").text();
					var header = $bild.find("header").text();
					var beschreibung = $bild.find("bezeichnung").text();
					var link = $bild.find("link").text();
					
					galleryImage = new Image();
					galleryImage.src = dateiname;
					
					stateImage = new Image();
					stateImage.src = header;
					
					var htmlOuput = '<div class="ipad_flash_gallery_item" id="ipad_flash_gallery_item_' + id + '"><img class="keyvisual" src="' + galleryImage.src + '" alt="' + beschreibung + '" /><div class="state_title"><img src="' + stateImage.src + '" alt="" /></div><div class="info_text"><div class="inner"><a href="' + link + '" title="mehr erfahren" class="more"><img src="images/more_link.png" alt="mehr erfahren"/></a>' + beschreibung + '</div></div></div>';
					
					$("#ipad_flash_gallery_content").html(htmlOuput);
					$("#ipad_flash_gallery_content").attr("class" , "item_" + item);
					
					$(".ipad_flash_gallery_item img.keyvisual").load(function() {
						$("#ipad_flash_gallery_preloader").hide();
						$("#ipad_flash_gallery_content").fadeIn(1500,function() {
							$("#ipad_flash_gallery_content_old").html($("#ipad_flash_gallery_content").html());
							$("#ipad_flash_gallery_content_old").show();
							$("#ipad_flash_gallery_content").hide();
							
							//automatic play
							$("#ipad_flash_gallery_content_old").animate({opacity: 1.0}, 20000,function(){
								$("#ipad_flash_gallery").trigger("click");
							});
							
						});
					}); 
					
				});
			
			}
			
			$(document).ready(function() {
			
			
				showIpadFlashGallery("1");
				
				$("#ipad_flash_gallery").click(function() {
					
					showIpadFlashGallery("next");
				
				});
			});
