// JavaScript Document


// Online Buchungsformular Eingabencheck
function checkOnlineBuchung() {
	var error1 = false;
	var error2 = false;
	
	if(document.forms.onlinebuchung.arrival.value == '' ) {
		document.forms.onlinebuchung.arrival.style.border = '1px solid red';		
		error1 = true;
	}else {
		document.forms.onlinebuchung.arrival.style.border = '1px solid #999999';	
	}	
	
	if(document.forms.onlinebuchung.departure.value == '' ) {
		document.forms.onlinebuchung.departure.style.border = '1px solid red';		
		error2 = true;
	}else {
		document.forms.onlinebuchung.departure.style.border = '1px solid #999999';	
	}
		
	if(error1 || error2) {		
		alert('Bitte geben Sie einen Anreise und Abreise Zeitpunkt an!');
		return false;
	}
	else {
		return true;
	}
}

//Navigation dropDown


var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;


function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 

//Navigation Bildwechsel

$(document).ready(function() {
	$('.subnavi a').hover(function() {
		$('#' + $(this).parents('div').attr('id') + 'Image').attr('src', 'img/navi/nav_galerie/' + $(this).attr('id') + '.jpg');
	},
	function() {
		$('#' + $(this).parents('div').attr('id') + 'Image').attr('src', 'img/navi/nav_galerie/' + $(this).parents('div').attr('id') + '_0.jpg');
	});
});

/*** Mehdi Script cufon fonts ***/
	if (typeof Cufon === 'function') {
		Cufon.replace('h1, h2, h3, h1 p', {
			fontWeight: 100,
			letterSpacing: '-1px',
			fontStretch: '95%'
		});
		Cufon.replace('h1.titleHome', {
			fontWeight: 100
		});
	}
/*** End Mehdi Script ***/

//Sprungmarken Position Top Geschichte

$(document).ready(function() {
    
  $('a[href=#liste]').click(function(){
	  $('html, body').animate({scrollTop:0}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#1]').click(function(){
	  $('html, body').animate({scrollTop:160}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#2]').click(function(){
	  $('html, body').animate({scrollTop:450}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#3]').click(function(){
	  $('html, body').animate({scrollTop:750}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#4]').click(function(){
	  $('html, body').animate({scrollTop:1040}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#5]').click(function(){
	  $('html, body').animate({scrollTop:1335}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#6]').click(function(){
	  $('html, body').animate({scrollTop:1600}, 'slow');
	 return false;
	});
	 
});



//Sprungmarken Position Top UnsereGaeste

$(document).ready(function() {
    
  $('a[href=#liste]').click(function(){
	  $('html, body').animate({scrollTop:0}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#h01]').click(function(){
	  $('html, body').animate({scrollTop:200}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#h02]').click(function(){
	  $('html, body').animate({scrollTop:580}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#h03]').click(function(){
	  $('html, body').animate({scrollTop:910}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#h04]').click(function(){
	  $('html, body').animate({scrollTop:1240}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#h05]').click(function(){
	  $('html, body').animate({scrollTop:1565}, 'slow');
	 return false;
	});
	 
});


//Sprungmarken Position Top Familie

$(document).ready(function() {
    
  $('a[href=#liste]').click(function(){
	  $('html, body').animate({scrollTop:0}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#heute]').click(function(){
	  $('html, body').animate({scrollTop:200}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#damals]').click(function(){
	  $('html, body').animate({scrollTop:820}, 'slow');
	 return false;
	});
	 
});

//Sprungmarken Position Top Feiern Specials

$(document).ready(function() {
    
  $('a[href=#liste]').click(function(){
	  $('html, body').animate({scrollTop:0}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#tab01]').click(function(){
	  $('html, body').animate({scrollTop:200}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#tab02]').click(function(){
	  $('html, body').animate({scrollTop:420}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#tab03]').click(function(){
	  $('html, body').animate({scrollTop:640}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#tab04]').click(function(){
	  $('html, body').animate({scrollTop:860}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#tab05]').click(function(){
	  $('html, body').animate({scrollTop:1080}, 'slow');
	 return false;
	});
	 
});

$(document).ready(function() {
    
  $('a[href=#tab06]').click(function(){
	  $('html, body').animate({scrollTop:2010}, 'slow');
	 return false;
	});
	 
});
$(document).ready(function() {
    
  $('a[href=#tab07]').click(function(){
	  $('html, body').animate({scrollTop:2050}, 'slow');
	 return false;
	});
	 
});

var contact = {
	toggle: {
		roomCat: function(element, selector){
			if($(element).attr('checked') == 'checked' || $(element).attr('checked') == true) {
				$(selector).show();
			} else {
				$(selector).hide();
			}
		}
	}
};
