menu.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2002-2004 The Apache Software Foundation or its licensors,
  3. * as applicable.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /**
  18. * This script, when included in a html file, can be used to make collapsible menus
  19. *
  20. * Typical usage:
  21. * <script type="text/javascript" language="JavaScript" src="menu.js"></script>
  22. */
  23. if (document.getElementById){
  24. document.write('<style type="text/css">.menuitemgroup{display: none;}</style>')
  25. }
  26. function SwitchMenu(obj)
  27. {
  28. if(document.getElementById) {
  29. var el = document.getElementById(obj);
  30. var title = document.getElementById(obj+'Title');
  31. if(obj.indexOf("_selected_")==0&&el.style.display == ""){
  32. //nicolaken: doesn't work :-(
  33. //title.style.backgroundImage = "url('images/chapter_open.gif')";
  34. el.style.display = "block";
  35. }
  36. if(el.style.display != "block"){
  37. //nicolaken: doesn't work :-(
  38. //title.style.backgroundImage = 'url([url]images/chapter_open.gif[/url])';
  39. el.style.display = "block";
  40. }else{
  41. //nicolaken: doesn't work :-(
  42. //title.style.backgroundImage = "url('images/chapter.gif')";
  43. el.style.display = "none";
  44. }
  45. }// end - if(document.getElementById)
  46. }//end - function SwitchMenu(obj)