//
// Toggle show/hide of CSS id block
//
function showHideItemsOld(myItem){
	var myItem = document.getElementById(myItem);
	var myEls = getElementsByClass('news_collapse');
	for ( i=0;i<myEls.length;i++ ) {
		myEls[i].className = 'news_expand';
	}

	myItem.className = "news_collapse";
}

// DFD Test Function
// Collapse them all before expanding the next
function showHideItems(myItem){
	var myItem = document.getElementById(myItem);

	if (myItem.className == "news_collapse") {
		myItem.className = "news_expand";
	}
	else {
		var myEls = getElementsByClass('news_collapse');
		for ( i=0;i<myEls.length;i++ ) {
			myEls[i].className = 'news_expand';
		}
	myItem.className = "news_collapse";
	}
}

//
// Add needed functions
//
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;
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

//
// Alternate table row colors
//   Looks for the class 'stripe' and then
//   toggles the row classes between 'odd'
//   and 'even'
//
function stripeTable(t) {
	var i, odd = true;
	for (i=0; i<t.rows.length; i++) {
		t.rows[i].className += odd ? ' odd' : ' even';
		odd = !odd;
		}
	}
function stripeTableById(id) {
	var t = document.getElementById(id);
	if (t) stripeTable(t);
	}
function stripeTableByClass() {
	var t = getElementsByClass('stripe');
	for (var i=0; i<t.length; i++) stripeTable(t[i])
	}
function stripeAllTables() {
	var t = document.getElementsByTagName('TABLE');
	for (var i=0; i<t.length; i++) stripeTable(t[i])
	}

addLoadEvent(stripeTableByClass);