$(".detail_page_content").find('img').each(function(i) {
var thisImg = $(this).offset().top+$(this).height();
var nextImg = $(".detail_page_content img").eq(i+1).offset().top;
var pos = (nextImg - thisImg) / 2;
$(this).after("<div class='up_page' style='margin-top: "+pos.toFixed()+"px;'>В начало статьи</div>");
});