In alternativa:

if (document.getElementById(immagine.id).src.indexOf( "portato2.gif")>=0){