var hor=0; 
var ver=0; 

// step = величина шага
var step=1;

function moved(side,idd) {
elapsed=new Date().getTime()
ee=(1-Math.cos(step*Math.PI));
if (side=='right') {
for (i=0;i<200;i++) {de=setTimeout(function(){right(idd)},i*2);}
}
if (side=='left') {
for (i=0;i<200;i++) {de=setTimeout(function(){left(idd)},i*2);}
} 
}

function right (idd) {
if (hor!=0)
{
hor+=step/2;
document.getElementById(idd).style.left=(hor+'px');
}
} 
function left (idd) {
if (hor>-2000)
{
hor-=step/2;
document.getElementById(idd).style.left=(hor+'px');
}
} 