var actualImage = "";
var oldImage = new String;

function turnOn (imgId) {
	replaceInImageSrc(imgId, "_off.", "_on.");
}

function turnOff (imgId) {
	if (imgId != actualImage) replaceInImageSrc(imgId, "_on.", "_off.");
}

function replaceInImageSrc (imgId, replace, replaceBy)
{
	if (dom) {
		imgSrc = document.getElementById(imgId).getAttribute("src");
		if (imgSrc.indexOf(replace) > 0) imgSrc = imgSrc.substring(0, imgSrc.indexOf(replace)) + replaceBy + imgSrc.substring(imgSrc.indexOf(replace) + replace.length, imgSrc.length);
		document.getElementById(imgId).setAttribute("src", imgSrc);
	}
}

function setImg (imgId) {
	oldImage = actualImage;
	actualImage = imgId;
	if (oldImage != "") turnOff(oldImage);
	if (imgId != "") turnOn(actualImage);
}
