show/hide image on click

You need to put it in quotes - it's a string:

document.getElementById('loadingImage').style.visibility='visible';

I would use Jquery. Go download it at the Jquery home page.

Then, include it:

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function showImage(){
$("#loadingImage").toggle();
}

</script>


<img id="loadingImage" src="ajax-loader.gif" style="display:none;"/>

If the other answers don't give you the results you're after, try setting the display to none:

document.getElementById('loadingImage').style.display='none';