if(!document.getElementById){
  if(document.all)
  document.getElementById=function(){
    if(typeof document.all[arguments[0]]!="undefined")
    return document.all[arguments[0]]
    else
    return null
  }
  else if(document.layers)
  document.getElementById=function(){
    if(typeof document[arguments[0]]!="undefined")
    return document[arguments[0]]
    else
    return null
  }
}

function selectSubnavItem() {
	if (arguments.length > 0) {
		for (var i = 0; i < arguments.length; i++) {
			var ID = arguments[i];
			var subnav_id = ID+'_subnav';
			if (document.getElementById(subnav_id)) { show(subnav_id); } // If the nav item has subnav, display it.
			if (document.getElementById(ID)) { document.getElementById(ID).className='selected'; }
		}
	} else {
		// try to figure out which links to highlight based on directory structure
		var URL = window.location.href;
		var root_url = 'http://www.onearthpeace.org/'; // Will need to be updated for launch
		var URL_ARRAY = URL.split(root_url);
		URL = URL_ARRAY[1].split('/');
		var section = URL[0];
		var subsection = URL[1];
		var subsubsection = URL[2];
		var selected_subsection = section + '_' + subsection;
		var selected_subsubsection = selected_subsection + '_' + subsubsection;
		selectSubnavItem(selected_subsection);
		selectSubnavItem(selected_subsubsection);
	}
}
function hide() {
	for (var i = 0; i < arguments.length; i++) {
		document.getElementById(arguments[i]).style.display='none';
	}
}
function show() {
	for (var i = 0; i < arguments.length; i++) {
		document.getElementById(arguments[i]).style.display='';
	}
}