var nbPhotos = 0;
var scrollCount = 0;
var elemAnim = null;

function galleryScroll(direction,nbPhotos) {
  var o = document.getElementById("thumbsMove");
  var shiftLength = 270;
  
  if (o != null) {
    switch (direction) {
      case "next":
        if (scrollCount < (nbPhotos / 10)-1) {
          attribs = {points:{by:[0, shiftLength * -1], control:[[0, shiftLength * -1]]}};
          var anim = new YAHOO.util.Motion(o, attribs, 0.7, YAHOO.util.Easing.EaseOut);
          anim.animate();
          scrollCount++;
        }
        break;
      case "prev":
        if (scrollCount != 0) {
          attribs = {points:{by:[0, shiftLength], control:[[0, shiftLength]]}};
          var anim = new YAHOO.util.Motion(o, attribs, 0.7, YAHOO.util.Easing.EaseOut);
          anim.animate();
          scrollCount--;
        }
        break;
    }
    o.blur();
  }
  return false;
}