var page = document.URL;
var muted = new RegExp("mute");

document.write("<div id='sound_control'>");

if (muted.test(page) == true) {
	document.write("<a href='" + page.replace("?sound=mute","") + "' title='Click to unmute' onmouseover='unmute_hover()' onmouseout='unmute_out()'>");
	document.write("<img id='unmute_button' src='img/sound_off.jpg' alt='Click to unmute'>");
	document.write("</a>");
}
else {
	document.write("<a href='" + page + "?sound=mute" + "' title='Click to mute' onmouseover='mute_hover()' onmouseout='mute_out()'>");
	document.write("<img id='mute_button' src='img/sound_on.jpg' alt='Click to mute'>");
	document.write("</a>");
}

document.write("</div>");

function mute_hover() {
	document.getElementById("mute_button").src = "img/sound_on_hover.jpg";
}

function mute_out() {
	document.getElementById("mute_button").src = "img/sound_on.jpg";
}

function unmute_hover() {
	document.getElementById("unmute_button").src = "img/sound_off_hover.jpg";
}

function unmute_out() {
	document.getElementById("unmute_button").src = "img/sound_off.jpg";
}
