45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
/* ================================================================
|
|
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/more_and_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 getEls = document.getElementById('gallery').getElementsByTagName('DIV');
|
|
for (var z=0; z<getEls.length; z++) {
|
|
if (getEls[z].className == 'hide') {
|
|
w=getEls[z].previousSibling;
|
|
while (w.nodeType!=1) {
|
|
w=w.previousSibling;
|
|
}
|
|
w.className=w.className.replace('switch over', 'switch');
|
|
}
|
|
if (getEls[z].className == 'show') {
|
|
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 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';
|
|
}
|
|
}
|
|
}
|
|
}
|