$(function(){$('#teaser img:gt(0)').hide();setInterval(function(){$('#teaser :first-child').fadeOut(1000).next('img').fadeIn(1000).end().appendTo('#teaser');},4000);});$(function(){$('#nav ul').hide();$("#nav li ul a").each(function(){$cache_this=$(this);$link=$cache_this.attr('href');geturl=document.location.toString().split('/');url=geturl[geturl.length-1];if($link==url){$cache_this.closest('ul').show();$cache_this.parents().filter('li.sub').addClass('parent-activated');$cache_this.addClass('activated');}});});$(function(){$('#nav li a').click(function(){$(this).next().slideToggle('400');});});$(document).ready(function(){$('a[href^=#wrapper]').click(function(){var duration=600;var easing='swing';var newHash=this.hash;var target=$(this.hash).offset().top;var oldLocation=window.location.href.replace(window.location.hash,'');var newLocation=this;if(oldLocation+newHash==newLocation)
{$('html:not(:animated),body:not(:animated)').animate({scrollTop:target},duration,easing,function(){window.location.href=newLocation;});return false;}});});$(window).scroll(function(){$('a.back-to-top').animate({opacity:'0.7',marginLeft:'488px'},600);});

// Besitzt Fenster den folgenden Namen, wenn nicht wird Code ausgeführt

if (window.name != "visited") {

$(document).ready(function() { 
							   
	var popup = $('#popup');
		
	// Popup wird unsichtbar + in die obere linke Ecke positioniert
	popup.css({opacity: '0', top: '20px', left: '-1000px'});
		
	// Popup wird sichtbar + neu positioniert
	popup.animate({top: '20px', left: '100px', opacity: '1'}, 1000);
		
	// Popup wird unsichtbar
	$('.close').click(function() {
		popup.animate({top: '20px', left: '-1000px', opacity: '0'}, 1000, 
		function() {popup.remove();});
	});
							
});

// Fenstername wird gesetzt, bei erneuten Aufrufen wird obiger Code nicht mehr ausgeführt 
window.name = "visited";
	
}


