$(document).ready(function() {
	
	
	var top = $('#emailus').offset().top - parseFloat($('#emailus').css('marginTop').replace(/auto/, 0));
	var content = $("#content").height();
	var sidebar =$("#sidebar").height();
	if (content <= sidebar ) {
		$("#sidebar").css('height', content+150);
		
	} else {
		$("#emailus").wrap("<div id='FloatWrapper'></div>");
		$(window).scroll(function (event) {
			// what the y position of the scroll is
			var y = $(this).scrollTop();
			
			// whether that's below the form
			if (y >= top) {
				// if so, ad the fixed class
				$('#emailus').addClass('fixed');
			} else {
				// otherwise remove it
				$('#emailus').removeClass('fixed');
			}
		});
	}
});
