var imgDOM;
var startOffset;
var endOffset;
var step;
var crtOffset=-100;
var moving=0;

function move_image(from,to){
  crtOffset=to;
  startOffset=from;
  endOffset=to;
  step=0;
  shift_image();
}

function shift_image(){
  if (step>=14){
    return;
  }
  step++;
  if(step<=7){
    imgDOM.style.left=""+Math.round(startOffset+step*step*(endOffset-startOffset)/98)+"px";
  } else {
    imgDOM.style.left=""+Math.round(endOffset-(14-step)*(14-step)*(endOffset-startOffset)/98)+"px";
  }
  setTimeout(shift_image,5);
}

function move_middle(){
  if (crtOffset!=-40){
    move_image(crtOffset,-40);
  }
}

function move_right(){
  if(crtOffset!=0){
    move_image(crtOffset,0);
  }
}

function move_left(){
  if(crtOffset!=-80){
    move_image(crtOffset,-80);
  }
}
