scusa ...
mi è rimasto dentro un pezzo in più..
la funzione corretta è questa

function SetStatoImmagine( ID, mode ) {
if (mode == 0) {
document.getElementById(ID).src="img001"
} else {
document.getElementById(ID).src="img001b"
}
}