var anim_running = false;
var anim = null;
var tar = null;

function init() {
   anim = new YAHOO.util.Scroll($('scrollcontent'), {}, .38);
   anim.onComplete.subscribe(function() {
      if (anim_running) {
         anim.attributes = getAttrs(anim.getEl().id);
         anim.animate();
      }
   });

   $E.addListener([$('up'), $('down')], 'mouseover', over, anim, true);
   $E.addListener([$('up'), $('down')], 'mouseout', out);
}
function out(ev) {
   anim_running = false;
}
function over(ev) {
   tar = $E.getTarget(ev);
   anim.attributes = getAttrs();
   anim_running = true;
   anim.animate();
}
function getAttrs(elm) {
   var elm = tar.id;
   if (elm == 'down') {
      var attrs = {
         scroll: {
            to: [0, parseInt($('scrollcontent').scrollTop) + 30]
         }
      };
   } else {
      var attrs = {
         scroll: {
            to: [0, parseInt($('scrollcontent').scrollTop) - 30]
         }
      };
   }
   return attrs;
}
$E.addListener(window, 'load', init);

