$(document).ready(function() {



	// Textschatten erstellen
	var textschatten = {
  		x:      1, 
  		y:      1, 
  		radius: 2,
  		color:  "#000000"
	}
	$(".nav-title").textShadow(textschatten);
	$("#header-icon-wetter-text").textShadow(textschatten);
	$("#header-icon-video-text").textShadow(textschatten);
	$("#header-icon-facebook-text").textShadow(textschatten);



	// Fancybox konfigurieren
	$("a[rel=fancybox]").fancybox({
		'overlayShow'	: true,
		'overlayColor'  : '#00519e',
		'centerOnScroll': true,
		'padding'       : '2px',
		'cyclic'		: true,
		'titlePosition' : 'over',
		'transitionIn'	: 'elastic',
		'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});



	// Header Icons einblenden

		$("#header-icon-wetter").hover(function() {
			$("#header-icon-wetter-text").stop(true, true).fadeToggle(200);
			return false;
		});

		$("#header-icon-video").hover(function() {
			$("#header-icon-video-text").stop(true, true).fadeToggle(200);
			return false;
		});

		$("#header-icon-facebook").hover(function() {
			$("#header-icon-facebook-text").stop(true, true).fadeToggle(200);
			return false;
		});



	// Cycle-Plugin konfigurieren
	$("#banner-fotos").cycle({
		fx:      "fade",
		timeout: 5000,
		speed:   1000,
		delay:   0000,
		before:  onBefore,
		after:   onAfter
	});
	function onBefore() {
		$(".banner-slogan").hide();
	}
	function onAfter() {
		$(".banner-slogan").fadeIn("slow");
	}
	$(".banner-slogan-1").fadeIn("slow");



	// Listenelemente ein-/ausblenden
	$(".content-liste-zeile-1-dynamisch").click(function() {
		// $(".content-liste-zeile-1-dynamisch").removeClass("content-liste-zeile-1-offen");
		// $(".content-liste-zeile-2").slideUp();
		$(this).toggleClass("content-liste-zeile-1-offen");
		$(this).next().slideToggle();
	});



	// Content: Anfrageformular | Listview (Zimmer) ein-/ausblenden
	$("#content-anfrageformular-listview-link-ausstattung-anzeigen a").click(function() {
		$(this).parent().hide();
		$(this).parent().next().show();
		$("#content-anfrageformular-listview-ausstattung").slideDown();
		return false;
	});
	$("#content-anfrageformular-listview-link-ausstattung-schliessen a").click(function() {
		$(this).parent().hide();
		$(this).parent().prev().show();
		$("#content-anfrageformular-listview-ausstattung").slideUp();
		return false;
	});
	$("#content-anfrageformular-listview-link-preise-anzeigen a").click(function() {
		$(this).parent().hide();
		$(this).parent().next().show();
		$("#content-anfrageformular-listview-preise").slideDown();
		return false;
	});
	$("#content-anfrageformular-listview-link-preise-schliessen a").click(function() {
		$(this).parent().hide();
		$(this).parent().prev().show();
		$("#content-anfrageformular-listview-preise").slideUp();
		return false;
	});


	// Content: Anfrageformular | Listview (Urlaubspakete) ein-/ausblenden
	$("#content-anfrageformular-listview-link-leistungen-anzeigen a").click(function() {
		$(this).parent().hide();
		$(this).parent().next().show();
		$("#content-anfrageformular-listview-leistungen").slideDown();
		return false;
	});
	$("#content-anfrageformular-listview-link-leistungen-schliessen a").click(function() {
		$(this).parent().hide();
		$(this).parent().prev().show();
		$("#content-anfrageformular-listview-leistungen").slideUp();
		return false;
	});



	// Content: Angebote | Listview (Zimmer) ein-/ausblenden
	$(".content-angebot-listview-zimmer-link-ausstattung-anzeigen").click(function() {
		$(this).hide();
		$(this).next().show();
		$(this).parent().parent().next().next().slideDown();
		return false;
	});
	$(".content-angebot-listview-zimmer-link-ausstattung-schliessen").click(function() {
		$(this).hide();
		$(this).prev().show();
		$(this).parent().parent().next().next().slideUp();
		return false;
	});



      // Pauschale scrollen
      $("#content-zufallsangebot-box").cycle({
        fx:      "scrollHorz",
        next:    "#content-zufallsangebot-zurueck", 
        prev:    "#content-zufallsangebot-weiter",
        speed:   750,
        timeout: 0
      });


      
      // Formularblöcke ein-/ausblenden
      $(".form-plus-link").click(function() {
        $(this).parent().slideUp();
        $(this).parents('.form-block').next().slideDown();
        return false;
      });
      $(".form-minus-link").click(function() {
        $(this).parents('.form-block').prev().find('.form-plus-div').slideDown();
        $(this).parents('.form-block').slideUp();
        $(this).parents('.form-block').find('select').val('');
        $(this).parents('.form-block').find('.form-kinder-alter').fadeOut();
        return false;
      });     
      
      // Formularfelder ein-/ausblenden
      $('.form-kinder-anzahl').change(function() {
        var kinderAnzahl = $(this).val();
        for(var i = 0; i < 5; i++) {
          if(kinderAnzahl > i) {
            $(this).siblings('select').eq(i).fadeIn();
            if(kinderAnzahl >= 1) {
              $(this).next().fadeIn();
            }
          } else {
            $(this).siblings('select').eq(i).fadeOut().val('');
            if(kinderAnzahl < 1) {
              $(this).next().fadeOut();
            }
          }
        }
      });      
      
      // Datenschutz (Kurzinfo) ein-/ausblenden
      $(".form-privacy-link").click(function() {
        $('.form-privacy').slideToggle();
        return false;
      });    

      // Datenschutz (Details) öffnen
      $("#form-privacy-fancybox").fancybox({
        'type':         'iframe',
        'width':        '75%',
        'height':       '75%',
        'overlayShow':  true,
        'overlayColor': false,
        'transitionIn': 'elastic'
      });      
      
      // Formularfelder prüfen
      $("#form-anfrage").validate({
        errorLabelContainer: $("#form-fehler-block")
      });

      // Spamschutz aktivieren
      $('.form-daten-required').append('<label for="javascript">javascript</label><input type="text" name="javascript" value="javascript">');
      
    });


