	jQuery(function($){
 	// Get a reference to the placeholder. This element
	// will take up visual space when the message is
	// moved into a fixed position.
	
		var placeholder = jQuery( "#menu-platzhalter" );
 
	// Get a reference to the message whose position
	// we want to "fix" on window-scroll.
			
		var message = jQuery( "#menu" );
 
	// Get a reference to the window object; we will use
	// this several time, so cache the jQuery wrapper.
			
		var view = jQuery( window );
 
 	// Bind to the window scroll and resize events.
	// Remember, resizing can also change the scroll
	// of the page.
		
		view.bind("scroll resize",
			function(){
	// Get the current offset of the placeholder.
	// Since the message might be in fixed
	// position, it is the plcaeholder that will
	// give us reliable offsets.
				var placeholderTop = placeholder.offset().top;
 
	// Get the current scroll of the window.
				var viewTop = view.scrollTop();
 
	// Check to see if the view had scroll down
	// past the top of the placeholder AND that
	// the message is not yet fixed.
				if (
					(viewTop > placeholderTop) &&
					!message.is( ".menu-fixed" )
					){
 
	// The message needs to be fixed. Before
	// we change its positon, we need to re-
	// adjust the placeholder height to keep
	// the same space as the message.
	//
	// NOTE: All we're doing here is going
	// from auto height to explicit height.
					placeholder.height(placeholder.height());
 
	// Make the message fixed.
					message.addClass( "menu-fixed" );
 
	// Check to see if the view has scroll back up
	// above the message AND that the message is
	// currently fixed.
				} else if (
					(viewTop <= placeholderTop) &&
					message.is( ".menu-fixed" )
					){
 
	// Make the placeholder height auto again.
						placeholder.css( "height", "auto" );
 
	// Remove the fixed position class on the
	// message. This will pop it back into its
	// static position.
						message.removeClass( "menu-fixed" );
 
					}
				}
			);
 
		});     
