Change image on click then back to original image on another image click/html jscript

First of all, I have basically no knowledge on how to write Java, so my problem might be quite simple to answer, but I’ve done some research and I didn’t find anything yet.
I’d like to know how to change my image on click then back to original image when another image is clicked, not the same one.

In my research, I’ve found how to go from one image to another on click and I found this :

function changeImage(img){
  if(img.src=="resources/items/original_image.png"){
    img.src="resources/items/icon2blue.png";
  }else {
    img.src="resources/items/original_image.png"; 
  }
}

which works perfectly, but is not really want I want to do. And I don’t know how to modify this to arrive where I want to go haha.

I found another post on the forum with the same problem but couldn’t make any of the solution answered work.
thanks to anybody who helps 🙂