  $(document).ready(function() {
	$('#accordion > ul > li').click(function() {
	  // the clicked LI
	  var clicked = $(this);

	  // all the LIs above the clicked one
	  var previousAll = clicked.prevAll();

	  // only proceed if it's not already on top (no previous siblings)
	  if(previousAll.length > 0) {
		// top LI
		var top = $(previousAll[previousAll.length - 1]);

		// immediately previous LI
		var previous = $(previousAll[0]);

		// how far up do we need to move the clicked LI?
		var moveUp = clicked.attr('offsetTop') - top.attr('offsetTop');

		// how far down do we need to move the previous siblings?
		var moveDown = (clicked.offset().top + clicked.outerHeight()) - (previous.offset().top + previous.outerHeight());

		// let's move stuff
		clicked.css('position', 'relative');
		previousAll.css('position', 'relative');
		clicked.animate({'top': -moveUp});
		previousAll.animate({'top': moveDown}, {complete: function() {
		  // rearrange the DOM and restore positioning when we're done moving
		  clicked.parent().prepend(clicked);
		  clicked.css({'position': 'static', 'top': 0});
		  previousAll.css({'position': 'static', 'top': 0}); 
		}});
	  }
	});
  });
