
/**
 * (c) Simon Fakir 2011
 * Labdanum Javascript 
 */

$().ready(function() {
	// initCrossFader();
	initBackground();
	inithoverFader(".hoverFader");
	inithoverFader("#impressionen a");
	initNyroModal();
	//$('.tipsylnk').tipsy({html:true});
	// $('input.focustip').tipsy({trigger: 'focus', gravity: 'ne', fade: true});
	
});
   var inithoverFader = function (elem) 
     {
     	$(elem).animate({opacity: "0.8"}, 50);
        $(elem).hover(
           function() {
              $(this).animate({opacity: "1"}, 300);
        },
        function() {
               $(this).animate({opacity: "0.8"}, 300);
             
        });
     };

var initBackground = function () {
	 var theWindow        = $(window),
            $bg              = $("#bg"),
            aspectRatio      = $bg.width() / $bg.height();

         theWindow.resize(function() {
          if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
             $bg
               .removeClass()
               .addClass('bgheight');
           } else {
                $bg
                  .removeClass()
                  .addClass('bgwidth');
           }
        }).trigger("resize");


}
var initNyroModal = function() {
	$('.nyroBox').nyroModal();
	$('a[rel*=lightbox]').nyroModal();
	
};

