$(document).ready(function() {
var resort = function()
{
var i = 0;
jQuery.each($('.paragraphs .paragraph'), function() {
$(this).children('div.text').children('input.position').val(i++);
});
}
$(".paragraphs .text .up").click(function(){
var div = $(this).parent('div.text').parent('div.paragraph');
div.insertBefore(div.prev());
resort();
return false
});
$(".paragraphs .text .down").click(function(){
var div = $(this).parent('div.text').parent('div.paragraph');
div.insertAfter(div.next());
resort();
return false
});
});