$(document).ready(function() {

	$(document).scroll(function() {
		
		var	scroll	=	$('body').scrollTop();
		
		if (scroll < 170) {
			var	percent	=	0;
		}
		else {
			var	percent	=	Math.floor((scroll - 170)/2);
		}
		
		
		if (percent > 100) {
			percent	=	100;
		}
		
		$('#topnav').css('opacity', percent / 100);
	});	
	
	$(document).trigger('scroll');
	
	
	$('.guidedtour-booking form').submit(function() {
		
		var	fields	=	$('.guidedtour-booking form input');
		var	checked	=	true;
		
		$(fields).each(function() {
			
			if (this.type != 'text' && this.type != 'checkbox') {
				return;
			}
			
			if ((this.type == 'text' && $(this).val() == '') || (this.type == 'checkbox' && $(this).attr('checked') == false)) {
				
				if($(this).parent().css('display') == 'none') {
					return;
				}
				
				checked	=	false;
			}
			
		});
		
		if (!checked) {
			alert("Bitte alle Felder ausfüllen!")
			return false;
		}		
	});
});
