
	$(function() {
		// Options for SuperBGImage
		$.fn.superbgimage.options = {
			randomtransition: 0, // 0-none, 1-use random transition (0-7)
			transition: 0,
			transitionout: 0, // 0-no transition for previous image, 1-transition for previous image
			slideshow: 1, // 0-none, 1-autostart slideshow
			slide_interval: 50000, // interval for the slideshow
			randomimage: 1, // 0-none, 1-random image
			speed: 2000, // animation speed / war 'slow'
			preload: 0,
			onShow: superbgimage_show
		};
		// initialize SuperBGImage
		$('#bgSlideshow').superbgimage().hide();
		
		function superbgimage_show(img)
		{
			$.fn.superbgimage.options = {
				transition: 1,
				onShow: null
			};
		}

	});
	
	my_slideshowActive = true;
	my_openPlayers = 0;

	// function callback wenn ein video eingeblendet wird
	function superbgimage_stop() {
		if (my_openPlayers > 0) {
			my_slideshowActive = false;
			$('#bgSlideshow').stopSlideShow();
		}
		else if (my_openPlayers == 0) {
			my_slideshowActive = true;
			$('#bgSlideshow').startSlideShow();
		}
	}
	
	
	jQuery(document).ready(function(){
		$('.showDetails').click(function() {
			if ($(this).parent().find('.player').css('display') == 'block') {
				
				$(this).parent().find('.player').empty();
				$(this).parent().find('.player').append('<div id="' + idPlayerReplace + '" class="noFlash"><a href="http://get.adobe.com/de/flashplayer/" target="_blank"><div class="getPlayer" style="display:none;"></div></a></div>');
				$(this).parent().find('.player').hide('slow');
				my_openPlayers = my_openPlayers - 1;
				superbgimage_stop();
			}
			
			$(this).next().toggle('slow');
			return false;
		}).next().hide();
	});

	jQuery(document).ready(function(){
		$('.showVideo').click(function() {
		
			// die Slideshow stoppen
			if ($(this).next().css('display') == 'none') {
				my_openPlayers = my_openPlayers + 1;
			}
			else {
				my_openPlayers = my_openPlayers - 1;			
			}
			superbgimage_stop();
			
			// die Details ausblenden
			$(this).parent().find('.details').hide('slow');
			
			// gibt die id des anzusprechenden player-containers zurück
			idPlayerContainer = $(this).next().attr('id');
			// gibt die id des anzutauschenden player-divs zurück
			idPlayerReplace = $(this).next().children(':first-child').attr('id');
			// gibt die Höhe des anzutauschenden player-divs zurück
			idPlayerHeight = $(this).next().css('height');
			// gibt den Pfad zum getPlayer-Button zurück
			getPlayerButton = $(this).next().children(':first-child').children('a').children(':first-child');
			
				if($(this).next().css('display') == 'none') {
					$(this).next().slideToggle('slow', function() {
						swfobject.embedSWF("flvs/" + idPlayerContainer + ".swf", idPlayerReplace, "570", idPlayerHeight, "10.0.0", false, flashvars, params, attributes);
						getPlayerButton.css('display', 'block');
					});
				}
				else {
					$(this).next().empty();
					$(this).next().append('<div id="' + idPlayerReplace + '" class="noFlash"><a href="http://get.adobe.com/de/flashplayer/" target="_blank"><div class="getPlayer" style="display:none;"></div></a></div>');
					$(this).next().slideToggle('slow', function() {
					});
				}
			      
			return false;
		}).next().hide();
	});

	
/*
	jQuery(window).load(function(){
		var secProjekte = $("#secProjekte");
		var posSecProjekte = secProjekte.position();
		$("#Projekte").css('top', posSecProjekte.top-110);
		$("#Projekte").css('left', 0);
		var secKontakt = $("#secKontakt");
		var posSecKontakt = secKontakt.position();
		$("#Kontakt").css('top', posSecKontakt.top-110);
		$("#Kontakt").css('left', 0);
		var secImpressum = $("#secImpressum");
		var posSecImpressum = secImpressum.position();
		$("#Impressum").css('top', posSecImpressum.top-110);
		$("#Impressum").css('left', 0);
	});
*/
	
	$('a').click(function() {
  		this.blur();
	});
	
	var flashvars = {};
	var attributes = {};
	var params = {
  		menu: "false",
  		allowScriptAccess: "sameDomain",
  		allowFullScreen: "false",
  		loop: "false",
  		quality: "high",
  		scale: "noscale",
  		salign: "lt",
  		bgcolor: "#000000"
	};
	
	$(document).ready(function() {
	$('a[href*=#]').bind("click", function(event) {
		event.preventDefault();
		var ziel = $(this).attr("href");

                if ($.browser.opera) {
                    var target = 'html';
                }else{
                    var target = 'html,body';
                }

		$(target).animate({
			scrollTop: $(ziel).offset().top
		}, 2000 , function (){location.hash = ziel;});
	});
	return false;
	});	
	
