var tx = 0, pressionado = false,largura_add=0, largura=0;

function chama_anda(imgs)

{
	pressionado = true;
	anda_dir();
	var obj = document.getElementById("move");
	largura_add = 145*imgs;
	largura = 0+largura_add;
	obj.style.width = largura+"px";
}

function chama_anda2(imgs)

{
	pressionado = true;
	anda_esq();
	var obj = document.getElementById("move");
	largura_add = 145*imgs;
	largura = 0+largura_add;
	obj.style.width = largura+"px";	
}



function anda_esq()

{

	var inverte, obj = document.getElementById("move");
	
	if(pressionado==true)
	{
			inverte = -(obj.offsetWidth - 780 );

		//alert(obj.offsetWidth);
		if(tx>=inverte)
		{
			tx=tx-20;
			obj.style.left = tx+"px";
		}
		setTimeout(anda_esq,100);
		document.onmouseout = function() { pressionado=false };
	}
}



function anda_dir()
{
	var inverte, obj = document.getElementById("move");

	if(pressionado==true)
	{
		if(tx<0)
		{
			tx=tx+20;
			obj.style.left = tx+"px";
		} 	
		setTimeout(anda_dir,100);
		document.onmouseout = function() { pressionado=false };

	}

}
