function initPage() { initButtons(); } function initButtons() { var menu = document.getElementById("nav"); if(menu) { var list = menu.getElementsByTagName("a"); for(var i = 0; i < list.length; i++) { list[i].onmousedown = function() { if(this.className.indexOf("pressed") == -1) this.className += " pressed"; } list[i].onmouseup = function() { this.className = this.className.replace("pressed",""); } list[i].onmouseout = function() { this.className = this.className.replace("pressed",""); } } } var menu = document.getElementById("gallery"); if(menu) { var list = menu.getElementsByTagName("a"); for(var i = 0; i < list.length; i++) { list[i].onmousedown = function() { if(this.className.indexOf("pressed") == -1) this.className += " pressed"; } list[i].onmouseup = function() { this.className = this.className.replace("pressed",""); } list[i].onmouseout = function() { this.className = this.className.replace("pressed",""); } } } var menu = document.getElementById("search"); if(menu) { var list = menu.getElementsByTagName("a"); for(var i = 0; i < list.length; i++) { list[i].onmousedown = function() { if(this.className.indexOf("pressed") == -1) this.className += " pressed"; } list[i].onmouseup = function() { this.className = this.className.replace("pressed",""); } list[i].onmouseout = function() { this.className = this.className.replace("pressed",""); } } } } if (window.addEventListener) window.addEventListener("load", initPage, false); else if (window.attachEvent && !window.opera) window.attachEvent("onload", initPage);