var swapImages;
var swappedImg;

function Swap(d) {// id del elemento que contiene las imagenes
	swapImages = document.getElementById(d).getElementsByTagName('img');
	for(var i = 0; i < swapImages.length; i++) {
		if(swapImages[i].className.indexOf('swap') >= 0) {
			if(swapImages[i].className.indexOf('default') >= 0) {
				swappedImg = swapImages[i];
				swappedImg.src = swappedImg.src.replace('_off', '_on');
			}
			swapImages[i].onmouseout = function() {
				if(swappedImg != this) {
					this.src = this.src.replace('_on', '_off');
				}
			};
			swapImages[i].onmouseover = function() {
				if(swappedImg != this) {
					this.src = this.src.replace('_off', '_on');
				}
			};
			swapImages[i].onclick = function() {
				if(swappedImg != this) {
					this.src = this.src.replace('_off', '_on');
					swappedImg.src = swappedImg.src.replace('_on', '_off');
					swappedImg = this;
				}
			};
		}
	}
}
