var overview, galleryHolders, galleryHolder, thumblist, picts, theThumbs, i, j, k;
function initGallery() {
	overview = document.getElementById('overview');
	if (overview) {
		galleryHolders = overview.getElementsByTagName('div');
		for (i=0;i<galleryHolders.length;i++) {
			if (galleryHolders[i].className == 'gallery') {
				galleryHolders[i].thumblist = new Array();
				picts = galleryHolders[i].getElementsByTagName('img');
				for (k=0;k<picts.length;k++) {
					if (picts[k].className == 'big') {
						theThumbs = galleryHolders[i].getElementsByTagName('a');
						for (j=0;j<theThumbs.length;j++) {
							galleryHolders[i].thumblist.push(theThumbs[j]);
							theThumbs[j].pict = picts[k];
							theThumbs[j].galleryHolder = galleryHolders[i];
							theThumbs[j].onmouseover = function() {
								this.getElementsByTagName('img')[0].src = this.getAttribute('colorthumb');
							}
							theThumbs[j].onmouseout = function() {
								this.getElementsByTagName('img')[0].src = this.getAttribute('bwthumb');
							}
							theThumbs[j].onclick = function() {
								this.pict.src = this.getAttribute('value');
								this.galleryHolder.thumblist[this.pict.getAttribute('place')].style.display = 'inline';
								this.pict.setAttribute('place',this.getAttribute('place'));
								this.style.display = 'none';
								return false;
							}
						}
					}
				}
			}
		}
	}
}
