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

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

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

function replaceInImageSrc (imgName, replace, replaceBy)
{
	if (dom) {
		imgSrc = document.getElementsByName(imgName)[0].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.getElementsByName(imgName)[0].setAttribute("src", imgSrc);
	}
	else if (ns4) {
		imgSrc = document[imgName].src;
		if (imgSrc.indexOf(replace) > 0) document[imgName].src = imgSrc.substring(0, imgSrc.indexOf(replace)) + replaceBy + imgSrc.substring(imgSrc.indexOf(replace) + replace.length, imgSrc.length);
	}
	else {
		imgSrc = document.all[imgName].src;
		if (imgSrc.indexOf(replace) > 0) imgSrc.substring(0, imgSrc.indexOf(replace)) + replaceBy + imgSrc.substring(imgSrc.indexOf(replace) + replace.length, imgSrc.length);
	}
}

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