grazie mille!
non ho capito bene questa riga

if(tempo) window.clearTimeout(tempo);


cmq mi hai dato delle idee su come procede thanxxx