I usually do PHP programming, but I need to get a Javascript functions working with variables.

This is the original code that's working:
Code:
<html>
<head>

<script type="text/javascript">

function show_comment(id, a) {

	menu = document.getElementById(id);

	if(menu.style.display == "block"){
		menu.style.display = "none";
		a.innerHTML = "<img src='folder1/a.gif' />";
	} else {
		menu.style.display = "block";
		a.innerHTML = "<img src='folder2/a.gif' />";
	}

}

</script>

</head>

<body>

<a href="#" onclick="show_comment('1', this);return false;">
	<img src='folder2/a.gif' />
</a>

<div style="display:block;" id="1"><h1>HAAAJ</h1></div>

</body>
</html>

I would now like to change the function so I can use it with different images and still use the same function.

My idea is to change:
show_comment('1', this)
to:
show_comment('1', this, 'a.gif')

And:
function show_comment(id, a) {

menu = document.getElementById(id);

if(menu.style.display == "block"){
menu.style.display = "none";
a.innerHTML = "<img src='folder1/a.gif' />";
} else {
menu.style.display = "block";
a.innerHTML = "<img src='folder2/a.gif' />";
}

}

To:
function show_comment(id, a, img) {

menu = document.getElementById(id);

if(menu.style.display == "block"){
menu.style.display = "none";
a.innerHTML = "<img src='folder1/" . img . "' />";
} else {
menu.style.display = "block";
a.innerHTML = "<img src='folder2/" . img . "' />";
}

}

So the new script would look like this:
Code:
<html>
<head>

<script type="text/javascript">

function show_comment(id, a, img) {

	menu = document.getElementById(id);

	if(menu.style.display == "block"){
		menu.style.display = "none";
		a.innerHTML = "<img src='folder1/" . img . "' />";
	} else {
		menu.style.display = "block";
		a.innerHTML = "<img src='folder2/" . img . "' />";
	}

}

</script>

</head>

<body>

<a href="#" onclick="show_comment('1', this, 'a.gif');return false;">
	<img src='folder2/a.gif' />
</a>

<div style="display:block;" id="1"><h1>HAAAJ</h1></div>

</body>
</html>

The original script is working, but not my version with that extra variable, can somebody please help me.

Thanks in advance.