$(document).ready(function() {
	// Kontakt Layer
	$("#contact-button").fancybox({	
		'width'				: 655,
		'height'			: 490,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'hideOnOverlayClick': false
	});
	// Anker
	function filterPath(string) {
		return string
		.replace(/^\//,'')
		.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
		.replace(/\/$/,'');
	}
	var locationPath = filterPath(location.pathname);
	$('a[href*=#]').each(function() {
		var thisPath = filterPath(this.pathname) || locationPath;
		if (  locationPath == thisPath && (location.hostname == this.hostname || !this.hostname) && this.hash.replace(/#/,'') ) {
			var $target = $(this.hash), target = this.hash;
			if (target) {
				var targetOffset = $target.offset().top;
				$(this).click(function(event) {
					event.preventDefault();
					$('html').animate({scrollTop: targetOffset}, 2000, function() {
						location.hash = target;
					});
				});
			}
		}
	});
});

// Urlaubsrechner
function calc(form) {
	var a = document.urechner.uanspruch.value;
	var b = document.urechner.twoche.value;
	var c = document.urechner.atage.value;
	var d = document.urechner.amon.value;
	
	document.urechner.ergebnis.value = Math.round((a/360*d*30/b*c)*100)/100;
	document.urechner.txt_tage.value = "Tage";
}
