function styleToggle(b) {  for (var i = 0; i< b.form.length; i++) {   if (b.form[i].name == b.name) {    b.form[i].parentNode.style.fontWeight = b.form[i].checked? 'bold' : '';   }  {    b.form[i].parentNode.style.color = b.form[i].checked? '#993300' : '';   }} }  
function clearValue(field) {
  field.value="";}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function addEvent(elm, evType, fn, useCapture)
// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
{
  if (elm.addEventListener) {
    elm.addEventListener(evType, fn, useCapture);
    return true;
  } else if (elm.attachEvent) {
    var r = elm.attachEvent('on' + evType, fn);
    return r;
  } else {
    elm['on' + evType] = fn;
  }
}

function showSection() {
  if(document.getElementById("breadcrumbs")) {
    var breadcrumbURL = document.getElementById("breadcrumbs").getElementsByTagName("a");
    if (breadcrumbURL.length > 1) {
      //var sectionURL = breadcrumbURL[1].pathname;
      var sectionURL = breadcrumbURL[1].href;
    } else {
      var sectionURL = location.href;
    }
  }
  if(document.getElementById("rightnav")) {
    var menuList = document.getElementById("rightnav").getElementsByTagName("li");
    for(var i = 0; i < menuList.length; i++) {
      if(menuList[i].childNodes) {
        if(menuList[i].childNodes.length > 0) {
          var menuItem = menuList[i].childNodes[0];
          //var menuItemURL = menuItem.pathname;
          var menuItemURL = menuItem.href;
          
          if(sectionURL == menuItemURL) {
            //found section from breadcrumbs in the menu
            if(breadcrumbURL.length > 1) {
              //sub-section,content,below content - open sub menu
              P7_swapClass(0,menuItem.parentNode.id,'open','closed','li');
              
              //highlight any sub-section within the current section
              var menuSubList = menuList[i].getElementsByTagName("li");
              for(var j = 0; j < menuSubList.length; j++) {
                if(menuSubList[j].childNodes) {
                  if(menuSubList[j].childNodes.length > 0) {
                    var menuSubItemURL = menuSubList[j].getElementsByTagName("a")[0];
                    if(location.href == menuSubItemURL) {
                      //found sub-section matching current URL
                      menuSubList[j].className = "active";
                    }
                    if(breadcrumbURL.length > 2) {
                      if(breadcrumbURL[2].href == menuSubItemURL) {
                        //found sub-section matching breadcrumb URL
                        menuSubList[j].className = "active";
                      }
                    }
                  }
                }
              }
            } else {
              //section - close sub menu items and highlight
              menuItem.style.backgroundColor = '#fff';
              menuItem.style.color = '#006699';
            } // end if
          } // end if
        } // end if
      } // end if
    } // end for
  } // end if
} //end function

addEvent(window, 'load', showSection, false);

// Splintered striper 1.3
// reworking of Zebra Tables and similar methods which works not only for tables and even/odd rows,
// but as a general DOM means of assigning any number of classes to children of a parent element.
// Patrick H. Lauke aka redux / www.splintered.co.uk
// Distributed under the Creative Commons Attribution-ShareAlike license - http://creativecommons.org/licenses/by-sa/2.0/

/*
 * Summary:      Core experiment function that applies any number of classes to all child elements
 *               contained in all occurences of a parent element (either with or without a specific class)
 * Parameters:   parentElementTag - parent tag name
 *               parentElementClass - class assigned to the parent; if null, all parentElementTag elements will be affected
 *               childElementTag -  tag name of the child elements to apply the styles to
 *               styleClasses - comma separated list of any number of style classes (using 2 classes gives the classic "zebra" effect)
 * Return:       none
 */
function striper(parentElementTag, parentElementClass, childElementTag, styleClasses)
{
 var i=0,currentParent,currentChild;
 // capability and sanity check
 if ((document.getElementsByTagName)&&(parentElementTag)&&(childElementTag)&&(styleClasses)) {
  // turn the comma separate list of classes into an array
  var styles = styleClasses.split(',');
  // get an array of all parent tags
  var parentItems = document.getElementsByTagName(parentElementTag);
  // loop through all parent elements
  while (currentParent = parentItems[i++]) {
   // if parentElementClass was null, or if the current parent's class matches the specified class
   if ((parentElementClass == null)||(currentParent.className == parentElementClass)) {
    var j=0,k=0;
    // get all child elements in the current parent element
    var childItems = currentParent.getElementsByTagName(childElementTag);
    // loop through all child elements
    while (currentChild = childItems[j++]) {
     // based on the current element and the number of styles in the array, work out which class to apply
     k = (j+(styles.length-1)) % styles.length;
     // add the class to the child element - if any other classes were already present, they're kept intact
     currentChild.className = currentChild.className+" "+styles[k];
    }
   }
  }
 }
}