$(function() {
	var offset = $("#alaune").offset();
	var topPadding = 40;
	$(window).scroll(function() {
		if ($(window).scrollTop() > offset.top) {
			$("#alaune").stop().animate({
				marginTop: $(window).scrollTop() - offset.top + topPadding
			});
		} else {
			$("#alaune").stop().animate({
				marginTop: 0
			});
		};
	});
});
// Menu deroulant
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// Slideshow //
function slideSwitch() {
    var $active = $('#diaporama IMG.active');
    if ( $active.length == 0 ) $active = $('#diaporama IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#diaporama 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  = $( $sibs[ rndNum ] );
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 4000 );
});
// Colorbox //
$(document).ready(function(){
			$("a[rel='galerie']").colorbox({transition:"fade"});
			$(".video").colorbox({iframe:true, innerWidth:750, innerHeight:500});
			$(".comment").colorbox({iframe:true, innerWidth:400, innerHeight:300});
		});
