/********************************************************
  CSS CLASS SWITCHER
  
  use this function to apply a new css class to an html
  element, or switch back and forth between css classes
********************************************************/
function changeCSSClass(id, newClass) {
	document.getElementById(id).className = newClass;
	return;
}

/*****************************************************
 SHOW/HIDE SUB MENUS
*****************************************************/
function switchYear(item) {
	// Turn all divs off first. loop though each div.on, remove .on and add .off class
	$$('div.on').each(function (div) { div.className='off'; });
	// turn current item's class to .on
	changeCSSClass('timelineCase', item)
	document.getElementById(item).className = 'on';
}
function hideYears() {
	// Turn all divs off first. loop though each div.on, remove .on and add .off class
	$$('div.on').each(function (div) { div.className='off'; });
}

/********************************************************
  NEW BROWSER WINDOW
  use this function to recreate the tarbet=_blank effect
********************************************************/
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");

	for (var i=0; i<anchors.length; i++) {
  	var anchor = anchors[i];
  		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "newwin")
    			anchor.target = "_blank";
	}
}
window.onload = externalLinks;