// Single page post share box
$(document).ready(function() {

	//put content div class, when scroll beyond this y, float it
	var $postShare = $('.dd_ajax_float');
	var descripY = parseInt($('.dd_content_wrap').offset().top) - 20;
	var pullX = $postShare.css('margin-left');

	$(window).scroll(function () { 
	  
		var scrollY = $(window).scrollTop();
		var fixedShare = $postShare.css('position') == 'fixed';
		
		//make sure .post_share exists
		if($('.dd_ajax_float').length > 0){
		
			if ( scrollY > descripY && !fixedShare ) {
				$postShare.stop().css({
					position: 'fixed',
					left: '50%',
					top: 20,
					marginLeft: -310

				});
			} else if ( scrollY < descripY && fixedShare ) {
				$postShare.css({
					position: 'relative',
					left: 0,
					top: 0,
					marginLeft: pullX
				});
			}
			
		}
		
		
		
	});
	
});