var SLIDETIME = 6000;
var selectedPart = 0;

function slideSelector(id, dur) {
  left = $("#timeline_" + id).position().left + 22;
  $("#timeline_selector").stop().animate({
    left: left
  }, dur);
}

$(window).load(function () {
  $("#timeline_selector").css({top:$("#timeline").position().top - 10});
  slideSelector(0, 0);
  $("#slideshow").cycle({
      fx:'fade',
      before: function(curr) {
        selectedPart = $(this).attr("id").split("slideshow_part")[1];
        slideSelector(selectedPart, 400);
      },
      pager: "#timeline",
      pagerAnchorBuilder: function(idx, slide) {
        return "#timeline_" + idx;
      },
      timeout: SLIDETIME
  });
});

