// JavaScript Document
function include(filename)
{
	var head = document.getElementsByTagName('head')[0];
	
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	
	head.appendChild(script)
}

function DoOnWindowLoad() {
	HighlightNavSection();
	stripeTables();
}

window.onload = DoOnWindowLoad;


function HighlightNavSection() {
	
	var path = document.getElementById('path')
	path = path.innerHTML //get the breadcrubs
	path = path.replace(/<\/?a[^>]*>/g, "") //strip out all the <a> tags
	var gt3 = path.indexOf("&gt;", path.indexOf("&gt;", path.indexOf("&gt;") + 1 ) + 1) + 10 //find the start of the third breadcrumb element (delimiated by &nbsp;&gt;&nbsp;)
	var gt4 = path.indexOf("&gt;", gt3 + 1) - 6 //find the end of the third breadcrumb element
	if (gt4 < 0) {
		gt4 = path.length
	}
	var sectionName = path.substr(gt3, gt4 - gt3) //get the third breadcrumb element
	var navElements = document.getElementById('subnav').getElementsByTagName('ul')[0].getElementsByTagName('a')
	for(i=0; i<navElements.length; i++) {
		elemLink = navElements[i]
		if (elemLink.innerHTML == sectionName) {
			elemLink.id = "currentSection"
		}
	}
}


/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Dustin Diaz :: http://www.dustindiaz.com/ */

function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

