/**

* scrollTo Funktion

*/





function goToByScroll(id){

     	$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');

}	





/**

* jQuery

*/

$(document).ready(function() {

	

	

	// initialise plugins

	$('ul.sf-menu').superfish({ 

		delay:       1000,                      // one second delay on mouseout 

		animation:   {opacity:'show'},  		// fade-in and slide-down animation 

		speed:       'normal',                  // faster animation speed 

		autoArrows:  false,                     // disable generation of arrow mark-up 

		dropShadows: false,                     // disable drop shadows 

		disableHI:     true

	}); 





 	$('.mcStyle1 > .mcTwo > .mcContent').innerfade({ 

		speed: 'slow', 

		timeout: 6000, 

		type: 'sequence', 

		containerheight: '220px' 

	}); 





	if (typeof $('a[rel=lightboxIframe]').fancybox == 'function') {

		// fancyLightBox in iFrame 

		$('a[rel=lightboxIframe]').fancybox({

			'autoDimensions': false,

			'autoScale': true,

			'width': 800,

			'height': 600,

			'transitionIn': 'fade',

			'transitionOut': 'fade',

			'type': 'iframe',

			'titleShow': true,

			'titlePosition': 'inside',

			'showNavArrows': false

		});

	}





	// Calender Setup

	$('.inputDate').calendar({

		dateFormat: '%d.%m.%Y'

	});



	

	// auf klick oeffnen

	$('#mailFormButton').click(function() {

		$('#bookingRequest').slideToggle('slow');

		goToByScroll("bookingRequest");

		return false;

	});



	

	/**

	* Pruefen, ob es den Anker "bookingRequest-open" gibt

	* wenn ja, wird nach zum Formular gescrollt 

	* ansonsten wird das Formular "bookingRequest" angeblendet

	*/



	if($('a#bookingRequest-open').length){

		goToByScroll("bookingRequest-open");

	}

	else {

		$('#bookingRequest').hide();

	}











});


