Hi, i am quite new to javascript. i am trying to animate a div tag right to left and then left to right by using window.onload. i have written my code below. Please help sombody to fix this.

Code:
<script language="javascript">
function move() {
  var elem = document.getElementById('example_block');
  var left = 0;

  function animate_forward() {
    
    left++;  // update parameters 
    
    elem.style.left = left + 'px'; // show frame 

    if (left == 660){  // check finish condition
      clearInterval(id);
	  animate_backward();
	  }
	  function animate_backward(){
	  	left--;  // update parameters 
    
		elem.style.left = +left + 'px'; // show frame 
	
		if (left == 0){  // check finish condition
			  clearInterval(id);
		  }
	  }
  }

  var id = setInterval(animate_forward, 1); // draw every 10ms
}
window.onload = move;
</script>

<div class="example_path">
	<div id="example_block"></div>
</div>