$(document).ready(function() {

	$('#images .restaurant a').before('<div class="area"><a href="http://www.stuempelstal-restaurant.de/startseite.html"></a></div>');
	$('#images .hotel a').before('<div class="area german"><a href="http://www.stuempelstal.de/hotel.html"></a></div>');
	$('#images .hotel a').before('<div class="area english"><a href="http://www.stuempelstal.de/en/hotel.html"></a></div>');
	$('#images .house a').before('<div class="area"><a href="http://www.stuempelstal-landhaus.de/landhaus.html"></a></div>');
	
	$('#buttons .restaurant a').before('<div class="overlay"></div>');
	$('#buttons .hotel a').before('<div class="overlay"></div>');
	$('#buttons .house a').before('<div class="overlay"></div>');
	
	fadeArea('restaurant');
	fadeArea('hotel');
	fadeArea('house');
});

function fadeArea(area) {
	var duration = 400;
	
	$('#images .' + area).mouseover(function() {
		$('#header .' + area + ' img').fadeOut(duration);
		$('#images .' + area + ' .image-1').fadeOut(duration);
		$('#buttons .' + area + ' .overlay').fadeOut(duration);
	});
	
	$('#images .' + area).mouseleave(function() {
		$('#header .' + area + ' img').fadeIn(duration);
		$('#images .' + area + ' .image-1').fadeIn(duration);
		$('#buttons .' + area + ' .overlay').fadeIn(duration);
	});
}

/* Image Slider Switch */
/*
function slideSwitch() {
    var $active = jQuery('#images .restaurant img.active');

    if ( $active.length == 0 ) $active = jQuery('#images .restaurant img:last');

    var $next =  $active.next().length ? $active.next()
        : jQuery('#images .restaurant img:first');
	
	// uncomment the 3 lines below to pull the images in random order
	
	//var $sibs  = $active.siblings();
	//var rndNum = Math.floor(Math.random() * $sibs.length );
	//var $next  = jQuery( $sibs[ rndNum ] );
	
    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
        });
}
*/
