// JavaScript functions to handle pushed buttons // // This frameset should include a window called 'navbar' containing the // buttons to be manipulated // // This script should be executed by the navbar window and the onResize() // event handler set to reactivate_button('icons') (where 'icons' is the // directory containing the button images *relative to navbar.html*. // // The images for the buttons should have the same name as that given to // the IMG tag (with a name=) but with the extension '.gif' for the up // button and '_d.gif' for the down button // // Any images in the navbar frame which are not buttons should have a // name starting with 'static_' // // Each source file which is activated by a button should execute this // script. At the end of the file, add the line: // // where 'home' is the name of the button for this page and 'icons' is // the directory containing the button image files *relative to the // frame executing this command*. // // The navbar frame may call preload('img') on each pushed button. // function dobuttons(n, bdir) { // Set all buttons to up version unless it's the named one in which // case set it to the down one debug=0; // Find which browser we are using and strip a leading ../ from bdir // if the browser is MIE. In MIE the path is interpreted with respect to // the frame for which the image is loaded whereas in Netscape it is // with respect to the frame which executes this JavaScript // 31.10.03 Now treats Netscape >= 5.0 same way as MIE if((navigator.appName.substr(0,8) != "Netscape") || (navigator.appVersion.substr(0,4) >= 5.0)) { if(bdir.substr(0,3) == "../") { bdir = bdir.substr(3); } } if(top.bannerframe==null) { if(top.navbar==null) return; for(i=0; i= 1) { alert("Setting " + n + " to " + down + "\nActual was: " + top.navbar.document.images[i].src); } } else { top.navbar.document.images[i].src=up; } if(debug >= 2) { // For debugging show the URL for each image alert(top.navbar.document.images[i].src); } } } } else { if(top.bannerframe.navbar == null) return; for(i=0; i= 1) { alert("Setting " + n + " to " + down + "\nActual was: " + top.bannerframe.navbar.document.images[i].src); } } else { top.bannerframe.navbar.document.images[i].src=up; } } } } } function reactivate_button(bdir) { debug = 0; if(top.bannerframe == null) { down = bdir + "/" + top.navbar.document.images[top.navbar.current_button].name + "_d.gif"; top.navbar.document.images[top.navbar.current_button].src = down; if(debug >= 1) { alert("Resetting " + top.navbar.document.images[top.navbar.current_button].name + " to " + down); } } else { down = bdir + "/" + top.bannerframe.navbar.document.images[top.bannerframe.navbar.current_button].name + "_d.gif"; top.bannerframe.navbar.document.images[top.bannerframe.navbar.current_button].src = down; if(debug >= 1) { alert("Resetting " + top.bannerframe.navbar.document.images[top.bannerframe.navbar.current_button].name + " to " + down); } } } function preload(btn) { img = new Image(); img.src = btn; }