I have an icon image which changes into another image by this code

```
<html>
<script>

function changeImg(thisImg) {
  if(prevImg) {
    prevImg.src=prevSrc;
  }  
  prevImg = thisImg;
  prevSrc = thisImg.src;
  thisImg.src = "flag_green.gif";
}
</script>
<body>
<img alt="" src="flag_blue.gif" id="imgClickAndChange" onclick="changeImg(this)"  />
</body>

```

But I am unable to change it back to the previous image again after clicking the original image . please help. I want it similar like the gmail important star icon feature