$(document).ready(function() {
  var totalItems = $('#scroll > .item').length + 1;
  var visibleItems = 5; /* conf */
  var currentItem = 0;

  $('#goUp').click(function() {
    if (currentItem > 0) {
      currentItem -= visibleItems;
      if (currentItem < 0) {
        currentItem  = 0;
      }
    }
    var lastItemPosition = $('#item'+currentItem).position();
    var scrollPosition = $('#scroll').scrollTop() + lastItemPosition.top;
    $('#scroll').animate({scrollTop: scrollPosition}, 500);
    return false;
  });

  $('#goDown').click(function() {
    if (currentItem < (totalItems - visibleItems - 1)) {
      currentItem += visibleItems;
      if (currentItem + visibleItems > totalItems) {
        currentItem = totalItems - visibleItems - 1;
      }
    }
    var lastItemPosition = $('#item'+currentItem).position();
    var scrollPosition = $('#scroll').scrollTop() + lastItemPosition.top;
    $('#scroll').animate({scrollTop: scrollPosition}, 500);
    return false;
  });

  // Nav select
//  $('#newsNewsNav').live('blur', function () {
  $('#newsNewsNav').bind('change', function () {
    window.location = $('#newsNewsNav option:selected').val();
  });
  $('#newsNewsNav2').bind('change', function () {
    window.location = $('#newsNewsNav2 option:selected').val();
  });

});
