$(document).ready(function(){

	// Breite Inhalt => bis => Fenster = dyn. Divs Breite neu
	var WindowWidth = ((($(window).width() - 960) / 2) + 950);
	var ImageHeight = (($('img#headImg').height() - 580) / 4);
	// Wenn JS aktiv => aktualisiere dyn. Divs
	$('div.dynamic, img#headImg').css({width: WindowWidth + 'px'});
	//$('img#headImg').css({marginTop: ImageHeight + 'px'});
	// Wenn Fenstergrš§e verŠndert wird => aktualisiere dyn. Divs
	$(window).bind('resize', resizeWindow);
	function resizeWindow( e ) {
		var WindowWidth = ((($(window).width() - 960) / 2) + 950);
		$('div.dynamic, img#headImg').css({width: WindowWidth + 'px'});
	}

	$('a.imageFilm').fancybox();

	$('a.external').attr('target','_blank');

	$('#advertiseSection').fadeTo('slow', 0.8);
	
	$('ul#navigation').superfish({ 
		delay: 1000,
		speed: 'slow',
		animation:   { opacity: 'show' },
		autoArrows:  false,
		dropShadows: false
	}); 

	$('#navigation a.imageFilm').hoverIntent(function(){
		$(this).stop().animate({height: '160px'},250);
	},function(){
		$(this).stop().animate({height: '40px'},300);
	});
	
	$('#navigation li ul li a').fadeTo('slow', 0.8);
	
	$('#tabs').tabs('#advertiseSection > div', { 
		//effect: 'fade', 
		//fadeOutSpeed: "slow",
		rotate: true
	    }).slideshow({
			prev: '.prev',
			next: '.next',
			autoplay: true,
			interval: 9000
		});
		
		// Bugfix for some Browser
		$('a.prev,a.next').click(function(){
			return false
		});


	$('#breadcumps,#anfahrtsBerechnung').fadeTo('fast', 0.8);
	
	$('#anfahrtsBerechnung').hover(function(){
		$(this).fadeTo('fast', 1);
	},function(){
		$(this).fadeTo('fast', 0.8);
	});

	$('img.fadeTo').fadeTo('fast', 0.5);
	$('img.fadeTo').hover(function(){
		$(this).stop().fadeTo('fast', 1.0);
	},function(){
		$(this).stop().fadeTo('slow', 0.5);
	});
	
});