   var vp;
   var tgt;
   var i;
   var timer = 0;
   function nextLine() {
    if (timer)
      clearTimeout(timer);
    vp.scrollTop(0);
    vp.scrollTop(tgt.eq(i).offset().top - vp.offset().top + tgt.eq(i).height() - vp.height());
    i++;
    if (i < tgt.length)
      timer = setTimeout("nextLine()", tgt.eq(i-1).html().length * 5);
    else
      timer = 0;
   }
   $(document).ready(function() {
    $('#viewport div').css("margin-top", "100%");
    $('#viewport div').css("padding-top", "100%");
    var url = document.location.toString();
    var chn;
    if (!url.match('#'))
      url = $('#menu ul:first a').attr('href');

    tgt = $('#' + url.split('#')[1] + ' p');
    $('#channel p').html('[#' + url.split('#')[1] + ']');

    vp = $('#viewport');
    i = 0;
    if (timer)
      clearTimeout(timer);
    timer = setTimeout("nextLine()", 500);

    $('#menu a').click(function() {
     var url = $(this).attr('href');
     if (url.match('#')) {
      $('#channel p').html('[#' + url.split('#')[1] + ']');
      tgt = $('#' + url.split('#')[1] + ' p');
      i = 0;
      if (timer)
        clearTimeout(timer);
      timer = setTimeout("nextLine()", 500);
     }
    });
   });
   $(window).resize(function () {
    if (i > 0) {
      vp.scrollTop(0);
      vp.scrollTop(tgt.eq(i - 1).offset().top - vp.offset().top + tgt.eq(i - 1).height() - vp.height());
    }
   });
