$(document).ready(function() {


// Textschatten erstellen

	var textschatten = {
  		x:      1, 
  		y:      1, 
  		radius: 3,
  		color:  "#000000"
	}
	$(".banner-slogan").textShadow(textschatten);
	$(".nav-title").textShadow(textschatten);



// Fancybox konfigurieren

	$("a[rel=fancybox]").fancybox({
		'overlayShow'	: true,
		'overlayColor'  : false,
		'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>';
		}
	});
	
	
	
// Fancybox (360°) konfigurieren

	$("a[rel=fancybox-360]").fancybox({
		'overlayShow'	: true,
		'overlayColor'  : false,
		'centerOnScroll': true,
		'width'			: 950,
		'height'		: 650,
        'autoScale'     : false,
        'transitionIn'	: 'elastic',
		'type'			: 'iframe',
		'scrolling'		: 'no'
	});
      
      
      
// Cycle-Plugin konfigurieren

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


// Header ausblenden

	$("#header-link-elementausblendung").click(function() {
		$("#header-logo").fadeOut();
		$("#header-navigation").fadeOut();
		$("#header-quicklinks-vollansicht").slideUp().next().delay(600).slideDown();
		return false;
	});



// Header einblenden

	$("#header-link-elementeinblendung, #banner-wrapper").click(function() {
		$("#header-logo").fadeIn();
		$("#header-navigation").fadeIn();
		$("#header-quicklinks-kompaktansicht").slideUp().prev().delay(600).slideDown();
		return false;
	});       
        
 
 
// Kompaktansicht starten

	$("#header-link-zur-kompaktansicht").click(function() {
		$("#header-link-elementausblendung").fadeOut();
		$("#header-link-zur-kompaktansicht").hide();
		$("#header-link-zur-vollansicht").show();
		$('#header-navigation').animate({top: 180, height: 70}, 1000);
		$("#header-kompaktansicht-galerie").delay(1500).fadeIn(1000);
		$("#banner-wrapper").slideUp(1000);
		$("#content-kompaktansicht").animate({height: 250}, 1000);
		$("#content-kompaktansicht-bg").animate({height: 250}, 1000).fadeIn(1000);
		document.cookie = "modus=kompaktansicht";
		return false;
	});
       
             
          
// Vollansicht starten

	$("#header-link-zur-vollansicht").click(function() {
		$("#header-link-elementausblendung").delay(500).fadeIn();
		$("#header-link-zur-vollansicht").delay(500).hide();
		$("#header-link-zur-kompaktansicht").delay(500).show();
		$('#header-navigation').delay(500).animate({top: 535, height: 104}, 1000);
		$("#header-kompaktansicht-galerie").fadeOut();
		$("#banner-wrapper").delay(500).slideDown(1000);
		$("#content-kompaktansicht").delay(500).animate({height: 0}, 1000);
		$("#content-kompaktansicht-bg").fadeOut();
		document.cookie = "modus=vollansicht";
		return false;
	});



// 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();
	});
	
	
	
// Preisliste sliden

	function mycarousel_initCallback(carousel) {
    	$('.content-preisliste-slider-weiter').bind('click', function() {
        	carousel.next();
        	return false;
    	});
    	$('.content-preisliste-slider-zurueck').bind('click', function() {
        	carousel.prev();
        	return false;
    	});
	};
    $(".content-preisliste-slider-container").jcarousel({
        initCallback:   mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null,
		scroll: 1
    });



// 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;
	});
	


// 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;
	});



// 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;
	});



// Zufallsangebote scrollen

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



// Formular: 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;
	});     
      
      
      
// Formular: 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();
				}
			}
		}
	});      
      
      
      
// Formular: Datenschutz (Kurzinfo) ein-/ausblenden

	$(".form-privacy-link").click(function() {
		$('.form-privacy').slideToggle();
		return false;
	});    


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

	$("#form-anfrage").validate({
		errorLabelContainer: $("#form-fehler-block")
	});
      


// Formular: Spamschutz aktivieren

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

});

