$j=jQuery.noConflict();

$j(document).ready(function($) {

	//put content div class, when scroll beyond this y, float it
	var $postShare = $('.post_share');
	
	if($('.post_share_content_wrap').length > 0){
	
		var descripY = parseInt($('.post_share_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($('.post_share').length > 0){
			
				if ( scrollY > descripY && !fixedShare ) {
					$postShare.stop().css({
						position: 'fixed',
						left: '50%',
						top: 10,
						marginLeft: -544
	
					});
				} else if ( scrollY < descripY && fixedShare ) {
					$postShare.css({
						position: 'relative',
						left: 0,
						top: 0,
						marginLeft: pullX
					});
				}
				
			}
	
		});
	}

});

jQuery(document).ready(function($) {
    
    $("a.email-icon").click(function() {
        var link = $(this);
        var linkPos = link.offset();
        var id = link.attr("rel").replace('gep_', '');
        var form = $("#gep_email_this");
		
		var position = link.position();
        
        // set the right Post ID
        $("#gep_post_id").val(id);
        
        // position and show/hide form
        form
            .css({
				left: position.left,
				top: position.top + 20
			})
            .toggle();
    });
    
    // hide form if cancel is clicked
    $("#gep_form_cancel").click(function() {
        $("#gep_email_this").hide();
    });
    
});

