$(document).ready(function(){ 

        $("#slideshow img").unwrap("p");
		$("#slideshow a").remove();
		$("#slideshow img").attr('title',' ');
		
        $("ul.sf-menu").supersubs({ 
            minWidth:    false,   // minimum width of sub-menus in em units 
            maxWidth:    false,   // maximum width of sub-menus in em units 
            extraWidth:  10})
			.superfish({				 
		    disableHI : false,
            animation: {width:'show',height:'show'},
			speed: 0,
            delay: 400,
			onInit:       function(){
				          },
			onBeforeShow: function(){
						  },
			onShow		: function(){
				          },
		    onHide		: function(){			                
						  }
        });
		
		
		/* $("a:has('img')").not("a:has('#logo')").append("<span class='lupe'></span>");
        $("a:has('img')").hover(function(){
          $(this).children("span.lupe").stop(true,true).fadeIn(400);
        },function(){
          $(this).children("span.lupe").stop(true,true).fadeOut(200);
        });
		*/		
		$("ul.liste").find("li:even").css("background-color","#E5E5E5");
		$(".fahrplan tr").find("td:first").css("text-align","left");
		
		$("#fahrplan1 tr,#fahrplan2 tr").find("td:first").css("text-align","center").end().find("td:gt(3)").css("text-align","left");
		
		
		$("#text a[rel^=lightbox]").fancybox();
		
		$(".angebot:not('.news')").hover(function(){
			   $(this).find(".angebot-text").slideDown();			
			},function(){
			   $(this).find(".angebot-text").stop(true,true).slideUp();
		});
		$("input[type=radio]:first").attr("checked","checked");
		
		$("#slider").anythingSlider({
			// Appearance
			width               : null,      // Override the default CSS width
			height              : null,      // Override the default CSS height
			resizeContents      : true,      // If true, solitary images/objects in the panel will expand to fit the viewport
		  
			// Navigation
			startPanel          : 1,         // This sets the initial panel
			hashTags            : true,      // Should links change the hashtag in the URL?
			buildArrows         : true,      // If true, builds the forwards and backwards buttons
			buildNavigation     : false,      // If true, buildsa list of anchor links to link to each panel
			navigationFormatter : null,      // Details at the top of the file on this use (advanced use)
			forwardText         : "", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
			backText            : "", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
		  
			// Slideshow options
			autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : true,      // If true & the slideshow is active, the slideshow will pause on hover
			resumeOnVideoEnd    : true,      // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video has completed
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page
			playRtl             : false,     // If true, the slideshow will move right-to-left
			startText           : "Start",   // Start button text
			stopText            : "Stop",    // Stop button text
			delay               : 4000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			animationTime       : 600,       // How long the slideshow transition takes (in milliseconds)
			easing              : "swing"    // Anything other than "linear" or "swing" requires the easing plugin
});
		
});
$(window).load(function() {
	var slideshowbilder = $('#slideshow img');
	var anzahlbilder = slideshowbilder.length;
	if(anzahlbilder>1){
		slideshowbilder.css('display','none');
		$('#slideshow').nivoSlider({
			effect:'random', // Specify sets like: 'fold,fade,sliceDown'
			slices:15, // For slice animations
			boxCols: 8, // For box animations
			boxRows: 4, // For box animations
			animSpeed:500, // Slide transition speed
			pauseTime:4000, // How long each slide will show
			startSlide:0, // Set starting Slide (0 index)
			directionNav:false, // Next & Prev navigation
			directionNavHide:false, // Only show on hover
			controlNav:true, // 1,2,3... navigation
			controlNavThumbs:false, // Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, // Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', // Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
			keyboardNav:true, // Use left & right arrows
			pauseOnHover:false, // Stop animation while hovering
			manualAdvance:false, // Force manual transitions
			captionOpacity:0, // Universal caption opacity
			prevText: '', // Prev directionNav text
			nextText: '', // Next directionNav text
			beforeChange: function(){}, // Triggers before a slide transition
			afterChange: function(){}, // Triggers after a slide transition
			slideshowEnd: function(){}, // Triggers after all slides have been shown
			lastSlide: function(){}, // Triggers when last slide is shown
			afterLoad: function(){} // Triggers when slider has loaded
		});
	};
});
