/* ================================================================ 
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() {
var e, i = 0;
while (e = document.getElementById('gallery').getElementsByTagName ('B') [i++]) {
if (e.className == 'switch') {
e.onclick = function () {
var getClient = document.getElementById('gallery_clients');
var getEls = document.getElementById('gallery').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';		
var getSpan = this.getElementsByTagName('SPAN');
var newClass = x.className == 'show' ? getSpan[0].className : 'none';
getClient.className = newClass;
}}}}