function switches_bind() {
	   var e, i = 0;
       while (e = document.getElementsByTagName ('B') [i++]) {
              if (e.className == 'switch') {
              e.onclick = function () {
                     this.className = this.className == 'switch' ? 'switch off' : 'switch';
                     this.nextSibling.className = this.className == 'switch' ? 'hideA' : 'showA';
                     }
              }
       }
       var e, i = 0;
       if (document.getElementById('gallery') != null){
        while (e = document.getElementById('gallery').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";
                     }
              }
        }
     }
}

