/*Browser-Style Sheet Detection
document.write('<link rel="stylesheet" href="http://www.rsmithdesign.com/ss_beta/styles/');
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf('mac') != -1) document.write('mac.css');
else if (agt.indexOf('gecko') != -1) document.write('mozilla.css');
else if (agt.indexOf('msie') != -1) document.write('iexplorer.css');
else document.write('default.css');
document.write('" type="text/css">');
*/

/*Collapsable Menu*/
var menuTimers = {  
  menus : [{top:"top1", sub:"sub1"},{top:"top2", sub:"sub2"},{top:"top3", sub:"sub3"},{top:"top4", sub:"sub4"},{top:"top5", sub:"sub5"}], 
  open : null,  
  close : null,  
  init : function() {  
    // Remove the current page from menus array 
    var page = document.body.id; 
    if (page) { 
      page = page.substring(5); // Strip off the 'page-' part of the id 
    } 
    for (i = 0; i < menuTimers.menus.length; i++) { 
      if (menuTimers.menus[i].sub == page) { 
        menuTimers.menus[i] = null; 
        continue; 
      } 
      var top = document.getElementById(menuTimers.menus[i].top); 
      var itm = document.getElementById(menuTimers.menus[i].sub);  
      if (itm) { itm.style.display = 'none'; }  
      // Attach event listeners 
      top.onmouseover = function(id) { 
        return function() { 
          menuTimers.openItem(id); 
        }; 
      }(menuTimers.menus[i].sub); 
      top.onmouseout = function(id) { 
        return function() { 
          menuTimers.closeItem(id); 
        }; 
      }(menuTimers.menus[i].sub); 
    } 
  },  
  openItem : function(id) {  
    clearTimeout(menuTimers.open);  
    menuTimers.open = setTimeout(function() {  
      var itm;  
      // Hide others  
      for (var i = 0; i < menuTimers.menus.length; i++) { 
        if (menuTimers.menus[i] == null) { continue; } 
        if (id!= menuTimers.menus[i].sub) {  
          itm = document.getElementById(menuTimers.menus[i].sub);  
          if(itm) { itm.style.display = 'none'; }  
        }  
      }  
      // Show this one  
      itm = document.getElementById(id);  
      if(itm) { itm.style.display = ''; }  
    }, 450); // Set the timeout value  
  },  
  closeItem : function(id) {  
    clearTimeout(menuTimers.close);  
    menuTimers.close = setTimeout(function() {  
      var itm = document.getElementById(id);  
      if(itm) { itm.style.display = 'none'; }  
    }, 4000); // Set the timeout value  
  }  
}  
window.onload = menuTimers.init;  

 /*End Collapsable Menu*/
 

