$(document).ready(function(){
    
    /**
     *  Infoboxen auf der Startseite
    */  
    /** Beispiel für rote Flächen ...
    $(".main-rot").mouseenter(function() {
      $(".main-rot").addClass("main-rot-aktiv");
      $(".main-rot").animate({height : '57px'}, 600);
      // $(".main-rot a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $(".main-rot").removeClass("main-rot-aktiv");
      $(".main-rot").animate({height: '52px'}, 600);
      // $(".main-rot a").animate({marginTop : '0'}, 300);
    });
    **/
    
    $("#main-0").mouseenter(function() {
      $("#main-0").addClass("main-rot-hover");
      $("#main-0").animate({height : '57px'}, 600);
      // $(".main-weiss a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $("#main-0").removeClass("main-rot-hover");
      $("#main-0").animate({height: '52px'}, 600);
      // $(".main-weiss a").animate({marginTop : '0'}, 300);
    });
    
    $("#main-1").mouseenter(function() {
      $("#main-1").addClass("main-weiss-hover");
      $("#main-1").animate({height : '57px'}, 600);
      // $(".main-weiss a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $("#main-1").removeClass("main-weiss-hover");
      $("#main-1").animate({height: '52px'}, 600);
      // $(".main-weiss a").animate({marginTop : '0'}, 300);
    });
    
    $("#main-2").mouseenter(function() {
      $("#main-2").addClass("main-rot-hover");
      $("#main-2").animate({height : '57px'}, 600);
      // $(".main-weiss a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $("#main-2").removeClass("main-rot-hover");
      $("#main-2").animate({height: '52px'}, 600);
      // $(".main-weiss a").animate({marginTop : '0'}, 300);
    });
    
    $("#main-3").mouseenter(function() {
      $("#main-3").addClass("main-weiss-hover");
      $("#main-3").animate({height : '57px'}, 600);
      // $(".main-weiss a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $("#main-3").removeClass("main-weiss-hover");
      $("#main-3").animate({height: '52px'}, 600);
      // $(".main-weiss a").animate({marginTop : '0'}, 300);
    });
    
    $("#main-4").mouseenter(function() {
      $("#main-4").addClass("main-rot-hover");
      $("#main-4").animate({height : '57px'}, 600);
      // $(".main-weiss a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $("#main-4").removeClass("main-rot-hover");
      $("#main-4").animate({height: '52px'}, 600);
      // $(".main-weiss a").animate({marginTop : '0'}, 300);
    });
    
    $("#main-5").mouseenter(function() {
      $("#main-5").addClass("main-weiss-hover");
      $("#main-5").animate({height : '57px'}, 600);
      // $(".main-weiss a").animate({marginTop : '12px'}, 300);
    }).mouseleave(function() {
      $("#main-5").removeClass("main-weiss-hover");
      $("#main-5").animate({height: '52px'}, 600);
      // $(".main-weiss a").animate({marginTop : '0'}, 300);
    });
  
});

function initNavigatorWidth( Element ) {
  var anzeigeBreite;
  
  if ( typeof window.innerWidth != 'undefined' )
    // $( Element ).css('width', window.innerWidth+'px' );
    anzeigeBreite = window.innerWidth;
  if ( typeof document.body.clientWidth != 'undefined' )
    // $( Element ).css('width', document.body.clientWidth+'px' );
    anzeigeBreite = document.body.clientWidth;
  if ( typeof anzeigeBreite != 'undefined' )
    anzeigeOffset = (anzeigeBreite - 960) / 2;
  $(Element).css('width', anzeigeBreite+'px' );
  $(Element).css('text-align', 'center');
  $("#bauer-banner-layer #logos").css('margin-left', anzeigeOffset+'px');
  return ;
}

function getRandom( min, max ) {
	if( min > max ) {
		return( -1 );
	}
	if( min == max ) {
		return( min );
	}
  return( min + parseInt( Math.random() * ( max-min+1 ) ) );
}

function initBackgroundImage( Tageszeit ) {
  var BodyTag = 'body';
  
  if ( typeof Tageszeit != 'undefined' ) {
    var bildId = getRandom(1, 3);
    // $(BodyTag).css('background-image', 'assets/wallpaper/'+Tageszeit+'/hg_wallpaper_'+bildId+'.jpg');
    document.getElementById('body').style.backgroundImage = 'url(assets/wallpaper/'+Tageszeit+'/hg_wallpaper_'+bildId+'.jpg)';
    // alert('assets/wallpaper/'+Tageszeit+'/hg_wallpaper_'+bildId+'.jpg');
  }
  return ;
}
