var movimento="";

function clip() {
 	if(movimento){
		clearTimeout(movimento);
		movimento="";
	}
	var id1 = document.getElementById('img_int');
 	var width = id1.offsetWidth;

 	id1.style.left = parseInt(id1.style.left)-2 + 'px';

 	if(parseFloat(id1.style.left) <= -(width/2)) {
  		id1.style.left = '0px';
 	}
 	movimento=setTimeout(clip,50);
}

// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  //mi devo calcolare la larghezza di img_int
  larghezza=0;
  box_int=document.getElementById('img_int');
  box_int_img=box_int.getElementsByTagName('img');
  for(i=0; i<box_int_img.length; i++){
	larghezza+=box_int_img[i].offsetWidth;
	}
  box_int.style.width=larghezza+"px";
  clip();
  box=document.getElementById('img');
  box.onmouseover=function(){
	  if(movimento){clearTimeout(movimento); movimento="";}
	};
  box.onmouseout=function(){
	  clip();
	};
});

