// scripts.js
// Last edited: March 28, 2006 by Damon Popovich

// Nav menu include
function menuinclude() {
	document.writeln('<ul id=\"nav\">' +
	'<li class=\"navitem\" id=\"home\"><a href=\"http://www.nsc.org/index.htm\" class=\"main\">Home</a>' +
	'<ul>' +
		 '<li><a href=\"http://www.nsc.org/aboutus.htm\">About Us</a></li>' +
		 '<li><a href=\"http://www.nsc.org/chaptop.htm\">Chapter Locations</a></li>' +
 		 '<li><a href=\"http://list.nsc.org/chapters/\">Chapter login</a></li>' +
		 '<li><a href=\"http://emergencycare.nsc.org/\">EC Instructor login</a></li>' +
		 '<li><a href=\"http://ddcinfohighway.org/">DDC Info Highway</a></li>' +
		 '<li><a href=\"http://www.nsc.org/news/nscjobs.htm\">Jobs</a></li>' +
		 '<li><a href=\"http://www.nsc.org/news/BillyDYoung.htm">Scholarship in Safety</a></li>' +
		 '<li><a href=\"http://network.nsc.org\">Networking Groups</a></li>' +
	'</ul></li>' +
	'<li class=\"navitem\" id=\"events\"><a href=\"http://www.nsc.org/events/\" class=\"main\">Events</a>' +
	'<ul>' +
		'<li><a href=\"http://www.congress.nsc.org/" target="_blank">Congress &amp; Expo</a></li>' +
		'<li><a href=\"http://list.nsc.org/nsmplanners\">National Safety Month</a></li>' +
		'<li><a href=\"http://www.nsc.org/annconf.htm\">Regional Conferences</a></li>' +
		'<li><a href=\"http://www.nsc.org/events/tradeshow.htm\">Trade Show Conventions</a></li>' +
		'<li><a href=\"http://www.nsc.org/news/aware.htm\">Safety Observances</a></li>' +
	'</ul></li>' +
	'<li class=\"navitem\" id=\"news\"><a href=\"http://www.nsc.org/newstop.htm\" class=\"main\">News</a>' +
	'<ul>' +
		'<li><a href=\"http://www.nsc.org/news/media.htm\">Media Relations</a></li>' +
		'<li><a href=\"http://www.nsc.org/shnews/\"><em>Safety+Health</em> magazine</a></li>' +
	'</ul></li>' +
	'<li class=\"navitem\" id=\"products\"><a href=\"http://www.nsc.org/onlinecart/\" class=\"main\">Products</a>' +
	'<ul>' +
		'<li><a href=\"http://www.nsc.org/onlinecart/\">Products News</a></li>' +
		'<li><a href=\"https://secure.nsc.org/instant/\">eProducts</a></li>' +
		'<li><a href=\"http://www.nsc.org/buyersguide/\">Buyers\' Guide</a></li>' +
		'<li><a href=\"http://www.nsc.org/onlinetraining/\">Online Learning</a></li>' +
		
	'</ul></li>' +
	'<li class=\"navitem\" id=\"resources\"><a href=\"http://www.nsc.org/issues/index.htm\" class=\"main\">Resources</a>' +
	'<ul>' +
		'<li><a href=\"http://www.nsc.org/issues/index.htm\">Safety Issues</a></li>' +
		'<li><a href=\"http://www.nsc.org/library/facts.htm\">Fact Sheets</a></li>' +
		'<li><a href=\"http://www.nsc.org/lrs/libtop.htm\">NSC Library</a></li>' +
	'</ul></li>' +
	'<li class=\"navitem\" id=\"services\"><a href=\"#\" class=\"main\">Services</a>' +
	'<ul>' +
		'<li><a href=\"http://www.nsc.org/consulting/\">Consulting Services</a></li>' +
		'<li><a href=\"http://www.nsc.org/lrs/libtop.htm\">NSC Library</a></li>' +
		'<li><a href=\"http://www.nsc.org/lrs/statstop.htm\">Research & Statistics</a></li>' +
	'</ul></li>' +
	'<li class=\"navitem\" id=\"training\"><a href=\"http://www.nsc.org/train/\" class=\"main\">Training</a>' +
	'<ul>' +
		'<li><a href=\"http://www.nsc.org/train/ddc/\">Driving</a></li>' +
		'<li><a href=\"http://www.nsc.org/train/ec\">Emergency Care</a></li>' +
		'<li><a href=\"http://www.nsc.org/train/osh/\">Occupational Safety</a></li>' +
		'<li><a href=\"http://www.nsc.org/onlinetraining/\">Online Courses</a></li>' +
		'<li><a href=\"http://www.nsc.org/train/ntc.cfm\">National Training Calendar</a></li>' +
		'<li><a href=\"http://www.nsc.org/training/\">Training Center Near You</a></li>' +
	'</ul></li>' +
	'<li class=\"navitem\" id=\"membership\"><a href=\"http://www.nsc.org/memtop.htm" class=\"main\">Membership</a>' +
	'<ul>' +
		'<li><a href=\"http://www.nsc.org/groups/members/\">Members-Only Login</a></li>' +
		'<li><a href=\"http://www.nsc.org/mem/benefits.htm\">Membership Benefits</a></li>' +
		'<li><a href=\"http://www.nsc.org/mem/memlevel.cfm\">Membership Applications</a></li>' +
		'<li><a href=\"http://www.nsc.org/mem/awards.htm\">Award Programs</a></li>' +
		'<li><a href=\"http://www.nsc.org/lrs/libtop.htm\">Resource Center</a></li>' +
		'<li><a href=\"http://www.nsc.org/mem/leader.htm\">Networking Groups</a></li>' +
		'<li><a href=\"http://www.nsc.org/chaptop.htm\">Local Chapters</a></li>' +
		'<li><a href=\"http://www.nsc.org/onlinecart/\">Exclusive Products</a></li>' +
	'</ul></li>' +
	'</ul></li>');
}

function smallheaderinclude() {
	document.writeln('<div id=\"nsclogosmall\">' +
	'<a href=\"http://www.nsc.org\" target=\"_top\">' +
	'<img src=\"http://www.nsc.org/images/logos/smallheaderlogo.gif\" width=\"181\" height=\"42\" alt=\"National Safety Council\" border=\"0\" />' +
	'</a>' +
	'</div>');
	document.writeln('<div class=\"smallsearch\">' +
	<!-- Google CSE Search Box Begins -->
  '<form id="searchbox_002269316995367643228:6yrbpc3s5i0" action="http://www.google.com/cse">'+
    '<input type="hidden" name="cx" value="002269316995367643228:6yrbpc3s5i0" />'+
    '<input name="q" type="text" size="25" />'+
    '<input type="submit" name="sa" value="Search" />'+
    '<input type="hidden" name="cof" value="FORID:0" />'+
  '</form>'+
  '<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_002269316995367643228%3A6yrbpc3s5i0"></script>'+
<!-- Google CSE Search Box Ends -->
	'</div>');
}

function headerinclude() {
	document.writeln('<div id=\"nsclogo\">' +
	'<a href=\"http://www.nsc.org\" target=\"_top\">' +
	'<img src=\"http://www.nsc.org/images/logos/nsclogo65.gif\" width=\"65\" height=\"65\" alt=\"National Safety Council\" border=\"0\" />' +
	'</a>' +
	'</div>' +
	'<div id=\"nscheaderlinks\">' +
		<!-- Google CSE Search Box Begins -->
  '<form id="searchbox_002269316995367643228:6yrbpc3s5i0" action="http://www.google.com/cse">'+
    '<input type="hidden" name="cx" value="002269316995367643228:6yrbpc3s5i0" />'+
    '<input name="q" type="text" size="25" />'+
    '<input type="submit" name="sa" value="Search" />'+
    '<input type="hidden" name="cof" value="FORID:0" />'+
  '</form>'+
  '<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_002269316995367643228%3A6yrbpc3s5i0"></script>'+
<!-- Google CSE Search Box Ends -->
	'<p class="sidebar"></p></div>' +
	'<div id=\"nscorg\"><img src=\"http://www.nsc.org/images/logos/nscorg.gif\" alt=\"nsc.org\" width=\"332\" height=\"65\" /></div>');
}

// IE workaround for nav menu
function initNav(ignore) {
if (document.all && document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
  node = navRoot.childNodes[i];
  if (node.nodeName=="LI") {
  node.onmouseover=function() {
  this.className+=" over";
    }
  node.onmouseout=function() {
  this.className=this.className.replace
      (" over", "");
   }
   }
  }
 }
}

// Table row striping function

  // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
  
// Popup window handler

var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=300,height=300';

function raw_popup(url, target, features) {
    // pops up a window containing url optionally named target, optionally having features
    if (isUndefined(features)) features = _POPUP_FEATURES;
    if (isUndefined(target  )) target   = '_blank';
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function link_popup(src, features) {
    // to be used in an html event handler as in: <a href="..." onclick="link_popup(this,...)" ...
    // pops up a window grabbing the url from the event source's href
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function isUndefined(v) {
    var undef;
    return v===undef;
}

// Handles Rollovers

<!-- hide from none JavaScript Browsers
Image1= new Image(56,60)
Image1.src = "menu_images/home_ro.gif"
Image2 = new Image(56,60)
Image2.src = "http://www.nsc.org/menu_images/home.gif"

function home_ro() {
document.imagefliper.src = Image1.src; return true;
}

function home() {
document.imagefliper.src = Image2.src; return true;
}

Image3= new Image(56,60)
Image3.src = "http://www.nsc.org/menu_images/events_ro.gif"
Image4 = new Image(56,60)
Image4.src = "http://www.nsc.org/menu_images/events.gif"

function events_ro() {
document.imagefliper1.src = Image3.src; return true;
}

function events() {
document.imagefliper1.src = Image4.src; return true;
}

Image5= new Image(56,60)
Image5.src = "http://www.nsc.org/menu_images/news_ro.gif"
Image6 = new Image(56,60)
Image6.src = "http://www.nsc.org/menu_images/news.gif"

function news_ro() {
document.imagefliper2.src = Image5.src; return true;
}

function news() {
document.imagefliper2.src = Image6.src; return true;
}

Image7= new Image(56,60)
Image7.src = "http://www.nsc.org/menu_images/products_ro.gif"
Image8 = new Image(56,60)
Image8.src = "http://www.nsc.org/menu_images/products.gif"

function products_ro() {
document.imagefliper3.src = Image7.src; return true;
}

function products() {
document.imagefliper3.src = Image8.src; return true;
}

Image9= new Image(56,60)
Image9.src = "http://www.nsc.org/menu_images/resources_ro.gif"
Image10 = new Image(56,60)
Image10.src = "http://www.nsc.org/menu_images/resources.gif"

function resources_ro() {
document.imagefliper4.src = Image9.src; return true;
}

function resources() {
document.imagefliper4.src = Image10.src; return true;
}

Image11= new Image(56,60)
Image11.src = "http://www.nsc.org/menu_images/services_ro.gif"
Image12 = new Image(56,60)
Image12.src = "http://www.nsc.org/menu_images/services.gif"

function services_ro() {
document.imagefliper5.src = Image11.src; return true;
}

function services() {
document.imagefliper5.src = Image12.src; return true;
}

Image13= new Image(56,60)
Image13.src = "http://www.nsc.org/menu_images/training_ro.gif"
Image14 = new Image(56,60)
Image14.src = "http://www.nsc.org/menu_images/training.gif"

function training_ro() {
document.imagefliper6.src = Image13.src; return true;
}

function training() {
document.imagefliper6.src = Image14.src; return true;
}

Image15= new Image(56,60)
Image15.src = "http://www.nsc.org/menu_images/membership_ro.gif"
Image16 = new Image(56,60)
Image16.src = "http://www.nsc.org/menu_images/membership.gif"

function membership_ro() {
document.imagefliper7.src = Image15.src; return true;
}

function membership() {
document.imagefliper7.src = Image16.src; return true;
}
// - stop hiding -->