
/* SI_clearFooter() v1.0
 * Use this function when absolutely positioning section navigation, 
 * primarary and secondary content and the footer falls below any one
 * of them. Absolute positioning avoids the unwanted wrapping that
 * sometimes occurs in IE PC when floats are used for layout.
 */
/* function SI_clearFooter() {
	var d = document,w=window,dE=d.documentElement,dB=d.body,h;
	if (!d.getElementById || !dB.offsetHeight) return;
	
	/* Configuration */    /*
	var container	  = 'inner-container';	// The inner container div
	var minHeight	  = 410;	// Minimum page height in pixels
	var extendShallow = true;	// Extends shallow children so that repeating backgrounds 
								// will repeat all the way to the footer
	var bottomOut	  = true;	// Whether the footer should just clear the contents of the 
								// inner-container div or snap to the bottom of the window 
								// when content is too short
								
								
	var ic = d.getElementById(container); // The inner container div
	ic.style.height = '0';		// Resets the height
	var oh = [];		// Holds the offset heights of each child div
	var icTop = ic.offsetTop;
	var winHeight	= (typeof(w.innerHeight)=='number')?w.innerHeight:(dE&&dE.clientHeight)?dE.clientHeight:(dB&&dB.clientHeight)?dB.clientHeight:0;
	var footHeight	= d.getElementById('footer').offsetHeight;
	oh[0] = minHeight-icTop-footHeight;	// Minimum height of the inner-container div

	
	// Make an array of the rendered heights of the contained elements
	for (i=0;i<ic.childNodes.length;i++) { c = ic.childNodes[i]; if (c.nodeName=='DIV') { c.style.height = 'auto'; oh[oh.length] = parseInt(c.offsetHeight); }}
	// Determine the max height
	h = 0; for (k=0;k<oh.length;k++) { h = (oh[k]>h)?oh[k]:h;}
	// Force footer to the bottom of the window 
	if (bottomOut) { h = ((icTop+h+footHeight) < winHeight)?winHeight-footHeight-icTop:h; }
	// Extend shorter elements
	if (extendShallow) { for (i=0;i<ic.childNodes.length;i++) { c = ic.childNodes[i]; if (c.nodeName=='DIV') { c.style.height = h+'px'; }}}
	ic.style.height = h+'px';
	}     */    


/* SI_initializeTabs()/SI_activateTab() v1.0
 * Accessible content tabbing that requires only one hit to the server
 * and degrades to simple HTML anchors when JavaScript is disabled.
 * Need to add: Support for multiple classes on ul.tabs li
 *
 * Changing `className` instead of `style.display` would allow for more 
 * control when dealing with print stylesheets.
 */
var SI_tabs=new Object();
function SI_initializeTabs() {
	for (var tab in SI_tabs) { 
		SI_activateTab(tab,SI_tabs[tab].active);
		}
	}
function SI_activateTab(tabGroup,activeTab) {
	var d = document;
	if (!d.getElementById) return;
	
	for (i=0; i<SI_tabs[tabGroup].tabs.length; i++) {
		//alert('tab-'+tabGroup+'-'+SI_tabs[tabGroup].tabs[i])
		tab = 'tab-'+tabGroup+'-'+SI_tabs[tabGroup].tabs[i];
		d.getElementById(tab).className = '';
		d.getElementById(tabGroup+'-'+SI_tabs[tabGroup].tabs[i]).style.display = 'none';
		}
	d.getElementById(tabGroup+'-'+activeTab).style.display = 'block';
	d.getElementById('tab-'+tabGroup+'-'+activeTab).className = 'active-tab';
	
	// Redraw the footer...
//	SI_clearFooter();
	}

/* SI_initializeGroups()/SI_toggleGroups() v1.0
 * 
 */
var SI_groups=new Object();
function SI_initializeGroups() {
	var d = document;
	if (!d.getElementById) return;
	for (var group in SI_groups) {
		d.getElementById(group+'-toggle').style.display = 'inline';
		for (i=0; i<SI_groups[group].items.length; i++) {
			anItem = SI_groups[group].items[i];
			d.getElementById(anItem+'-toggle').style.display = 'inline';
			}
		SI_groups[group].expanded = SI_groups[group].items.length;
		SI_toggleGroups(group,'',d.getElementById(group+'-toggle'));
		}
	}
function SI_toggleGroups(group,item,toggle) {
	var d = document;
	if (!d.getElementById) return;
	                                                                              
//	var state = (toggle.innerHTML.toLowerCase().indexOf('hide ')!=-1);
  var state = (toggle.className.toLowerCase().indexOf('hide')!=-1);
	var display = (state)?'none':'block';
	var action = (state)?'Show ':'Hide ';
	if (item!='') {
		d.getElementById(item).style.display = display;
//		toggle.innerHTML = action+SI_groups[group].label;
		toggle.className = action+SI_groups[group].label;
		SI_groups[group].expanded = (state)?SI_groups[group].expanded-1:SI_groups[group].expanded+1;
//		d.getElementById(group+'-toggle').innerHTML = (SI_groups[group].expanded == SI_groups[group].items.length)?'Hide All':'Show All';
	  d.getElementById(group+'-toggle').className = (SI_groups[group].expanded == SI_groups[group].items.length)?'hideall':'showall';
		}
	else {
		for (i=0; i<SI_groups[group].items.length; i++) {
			item = SI_groups[group].items[i];
//			d.getElementById(item+'-toggle').innerHTML = ((state)?'Show ':'Hide ')+SI_groups[group].label;
			d.getElementById(item+'-toggle').className = ((state)?'show':'hide')+SI_groups[group].label;
			d.getElementById(item).style.display = display;
			SI_groups[group].expanded = (state)?0:SI_groups[group].items.length;
			}
//		toggle.innerHTML = action+'All';
		toggle.className = action+"all";
		}
	
	// Redraw the footer...
//	SI_clearFooter();
	}


/* addEvent()/removeEvent()
 * From: http://www.scottandrew.com/weblog/articles/cbs-events
 * Used to add multiple function calls to a particular event
 * Most useful for adding multiple events to window.onload
 * Errm, doesn't work in IE 5 Mac, oh well. Content should be
 * accessible without scripting anyway.
 */
function addEvent(elm,evType,fn,useCapture) {
	if (elm.addEventListener) { elm.addEventListener(evType,fn,useCapture); return true; }
	else if (elm.attachEvent) { var r = elm.attachEvent("on"+evType,fn); return r; }
	}
function removeEvent(elm,evType,fn,useCapture) {
	if (elm.removeEventListener) { elm.removeEventListener(evType,fn,useCapture); return true; }
	else if (elm.detachEvent) { var r = elm.detachEvent("on"+evType,fn); return r; }
	}
/*
addEvent(window,'load',SI_clearFooter,false);
addEvent(window,'load',SI_initializeTabs,false);
addEvent(window,'load',SI_initializeGroups,false);
addEvent(window,'resize',SI_clearFooter,false);
*/

window.onload = function() {
//	SI_clearFooter();
	SI_initializeTabs();
	SI_initializeGroups();
//	window.onresize = SI_clearFooter;
	}
