/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/gallery/simply_more.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */


onload = function() {
	switch_toggle('gallery');
	switch_toggle('gallery2');
}

function switch_toggle(elm) {
	var e, i = 0;
	while (e = document.getElementById(elm).getElementsByTagName ('B') [i++]) {
		if (e.className == 'switch') {
			e.onclick = function () {
				var getEls = document.getElementById(elm).getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
					getEls[z].className=getEls[z].className.replace('show', 'hide');
					w=getEls[z].previousSibling;
					while (w.nodeType!=1) {
						w=w.previousSibling;
					}
					w.className=w.className.replace('switch over', 'switch');
					w.className=w.className.replace('switch off', 'switch over');
				}
				this.className = this.className == 'switch' ? 'switch off' : 'switch';
				x=this.nextSibling;
				while (x.nodeType!=1) {
					x=x.nextSibling;
				}
				x.className = this.className == 'switch off' ? 'show' : 'hide';
			}
		}
	}
}
