function next_slide () {
  var current_slide = $(".slide.current");
  current_slide.removeClass("current");
  var next_slide = current_slide.next().size() == 0 ? $(".slide:first") : current_slide.next();
  next_slide.addClass("current");
}

function prev_slide () {
  var current_slide = $(".slide.current");
  current_slide.removeClass("current");
  var prev_slide = current_slide.prev().size() == 0 ? $(".slide:last") : current_slide.prev();
  prev_slide.addClass("current");
}

function add_slide (content, container) {
  var new_slide = $("<div class='slide'>");

  /* image slide */
  if(content.match(/\.(png|jpg|jpeg|gif)/i)) {
    new_slide.addClass("image");
    if(!content.match(/^http/)) content = "assets/" + content;
    new_slide.css("background-image", "url(" + content + ")");
    $(container).append(new_slide);

  /* web slide */
  } else if(content.match(/^http/)) {
    new_slide.addClass("web")
    var iframe = $("<iframe src='" + content + "'>");
    new_slide.append(iframe);
    $(container).append(new_slide);
    iframe.keydown(function(e) {
      console.log(e);
    });

  /* text slide */
  } else {
    new_slide.addClass("text")
    new_slide.html(marked(content));
    $(container).append(new_slide);

    new_slide.css("margin-top", "-" + new_slide.height()/2 + "px");

  }

}

function present(content, container) {
  if(!container) container = "body";

  $(container).addClass('stopwork');
  $(container).addClass('loading');

  // append navigation elements
  $(container).html('\
    <div id="navigation">\
      <button class="prev">&lt;</button>\
      <button class="next">&gt;</button>\
      <div class="current" />\
      <div class="total" />\
    </div>');

  // populate slides
  for (var i = 0; i < content.length; i++) { add_slide(content[i], container); };

  // make first slide visible
  $(".slide:first").addClass('current');
  // mark all other slides as next slides
  $(".current + .slide").addClass('next');
  $(".slide:last").addClass('prev');

  $("#navigation .total").html(content.length);
  $("#navigation .current").html("1");

  $(container).removeClass('loading');
}

$(function() {
  // evaluate stopwork script into slideshow
  if($("script[type$='stopwork']").size() > 0) {
    present(eval( '[' + $("script[type$='stopwork']").text() + ']' ));
  }

  // keyboard scrolling
  $(window).keydown(function(e) {
    if(e.which == 39) { // right
      next_slide();

    } else if(e.which == 37) { // left
      prev_slide();

    }
  });

  // navigation button scrolling
  $("#navigation button.prev").click(function() { prev_slide() });
  $("#navigation button.next").click(function() { next_slide() });
});
@@ -2,16 +2,20 @@
 unction 
+get_
 next_sli
@@ -22,133 +22,168 @@
 de (
+slide
 ) %7B%0A  
-var current_slide = $(%22.slide.current%22);%0A  current_slide.removeClass(%22current%22);%0A  var next_slide = current_slide.next(
+return slide.next(%22.slide%22).size() == 0 ? $(%22.slide:first%22) : slide.next(%22.slide%22);%0A%7D%0A%0Afunction get_prev_slide (slide) %7B%0A  return slide.prev(%22.slide%22
 ).si
@@ -208,42 +208,135 @@
 ide:
-fir
+la
 st%22) : 
-current_slide.next(
+slide.prev(%22.slide%22);%0A%7D%0A%0Afunction refresh_next_prev () %7B%0A  $(%22.slide%22).removeClass('next').removeClass('prev'
 );%0A  
+get_
 next
@@ -341,35 +341,109 @@
 xt_slide
-.addClass(%22current%22
+($(%22.slide.current%22)).addClass('next');%0A  get_prev_slide($(%22.slide.current%22)).addClass('prev'
 );%0A%7D%0A%0Afu
@@ -449,20 +449,20 @@
 unction 
-prev
+next
 _slide (
@@ -554,78 +554,233 @@
 ;%0A  
-var prev_slide = current_slide.prev().size() == 0 ? $(%22.slide:last%22) :
+get_next_slide(current_slide).addClass(%22current%22);%0A%0A  $(%22#navigation .current%22).html($(%22.slide%22).index($(%22.slide.current%22)) + 1);%0A  refresh_next_prev();%0A%7D%0A%0Afunction prev_slide () %7B%0A  var current_slide = $(%22.slide.current%22);%0A 
  cur
@@ -794,18 +794,38 @@
 ide.
-p
 re
-v(
+moveClass(%22current%22
 );%0A  
+get_
 prev
@@ -826,24 +826,39 @@
 t_prev_slide
+(current_slide)
 .addClass(%22c
@@ -866,16 +866,118 @@
 rrent%22);
+%0A%0A  $(%22#navigation .current%22).html($(%22.slide%22).index($(%22.slide.current%22)) + 1);%0A  refresh_next_prev();
 %0A%7D%0A%0Afunc
@@ -3164,8 +3164,9 @@
  %7D);%0A%7D);
+%0A

Implement next/current/prev slide classes