var animation=350;
var button_animation=300;
var offset=0;
var offset_px=0;

function slider_go(direction) {
  slider_ol = document.getElementById("slider");
  items = slider_ol.getElementsByTagName("li");
  max = items.length - 4;

  from_px = offset * 162;
  if (offset <= 0 && direction < 0) return false;
  if (offset >= max && direction > 0) return false;
  offset = offset + direction;
  if (offset == 0) { window.setTimeout("document.getElementById('slider_left').className = 'left nomore';", button_animation);} else { window.setTimeout("document.getElementById('slider_left').className = 'left';", button_animation); }
  if (offset == max) { window.setTimeout("document.getElementById('slider_right').className = 'right nomore';", button_animation); } else { window.setTimeout("document.getElementById('slider_right').className = 'right';", button_animation); }
  to_px = offset * 162;
  for (i = 1; i <= 50; i++) {
    r = Math.floor((to_px*i + from_px*(50-i))/50);
    window.setTimeout("document.getElementById('slider').style.marginLeft = (-"+r+")+'px';", Math.floor(i*(animation/50)));
  }
  return false;
}

