onload = function() {
	var ee = document.getElementById('gallery');
	if (ee == null) {
		return;
	}
	var e, i = 0;
	while (e = ee.getElementsByTagName('div')[i++]) {
		if (e.className == 'on' || e.className == 'off') {
			e.onclick = function() {
				var getEls = document.getElementsByTagName('div');
				for ( var z = 0; z < getEls.length; z++) {
					getEls[z].className = getEls[z].className.replace('show', 'hide');
					getEls[z].className = getEls[z].className.replace('on',	'off');
				}
				this.className = 'on';
				var max = this.getAttribute('title');
				document.getElementById(max).className = "show";
			}
		}
	}
}
