;(function($, window, undefined) {
	var $item,
	$other,
	todo = 'sibling';

	$(document).ready(function() {
		$item = $('#Fitem'),
		$other = $item.prev();

		if ($other.length === 0) {
			$other = $item.parent();
			todo = 'parent';
		}
		
		$(window).on('scroll', function() {
			var scroll_top = $(this).scrollTop(),
			other_top = $other.offset().top,
			other_height = 0,
			top = 0;

			if (todo === 'sibling') {
				other_height = $other.height();				
			}
				
			if (scroll_top >= (other_top + other_height)) {
				$item.addClass('fixed');
			}
			else {
				$item.removeClass('fixed');
			}
		})
	});
})(jQuery, window);

