// JavaScript Document
$(window).load(function() {    

        var theWindow        = $(window),
            $bg              = $("#bg"),
            aspectRatio      = $bg.width() / $bg.height();

        function resizeBg() {

                if ( (theWindow.width() / (theWindow.height() + (theWindow.height() /100 *15 ))) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }
				
        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");
		
		$("a").mouseenter();
		$("a").mouseleave();
		
			
			
		
		
		
		
		
		
		
		
		
		$("a").click(function (event) { 
							   var url = this.href;
							   if (url.indexOf("althaus-bad.de") != -1 && url.indexOf("mailto") == -1) {
							   event.preventDefault();
							   
							   if (url.indexOf("#") == -1 || url.indexOf("#termin") != -1) $("#hide").fadeIn(300, function() { document.location.href = url; });}
							   });
		
		if (window.location.href.indexOf("kontakt.php") != -1) {
			$("#hide").delay(700).fadeOut("slow");
		} else {
			$("#hide").delay(200).fadeOut("slow");
		}
		
		
		$(".logo").mouseenter(function() {
									   $(this).stop(true);
									   $(this).animate({
      backgroundColor: $.Color( 247, 246, 246, 255 )
  }, 300 );
});
		$(".logo").mouseleave(function() {
									   $(this).stop(true);
									   $(this).animate({
      backgroundColor: $.Color( 247, 246, 246, 0 )
  }, 300 );
});
		
		
});
