if (document.getElementById && document.getElementsByTagName && document.createTextNode) {
	window.onload = initShowHide;
}

function initShowHide() {
	var hidechanges = document.getElementById('hidechanges');
	// copy original content to div#showchanges, which will keep its del elements
	var showchanges = hidechanges.cloneNode(true);
	showchanges.setAttribute('id', 'showchanges');
	hidechanges.parentNode.appendChild(showchanges);
	// while there are del elements in the original content, remove them
	var dels = hidechanges.getElementsByTagName('del');
	var len = dels.length;
	for( var i=len - 1; i > -1; i-- ){
		dels[i].parentNode.removeChild(dels[i]);
	}
	// plain switcher function
	hide();
	var switcher = document.getElementById('switcher');
	var as = switcher.getElementsByTagName('a');
	show(as[0]);
	for (var i = 0; i < as.length; i++) {
		as[i].onclick = function() {
			show(this);
			return false;
		}
	}
}

function show(s) {
	hide();
	var id = s.href.match(/#(\w.+)/)[1];
	var oldCurrent = document.getElementById('current');
	// If this element exists, remove its ID attribute
	if (oldCurrent) oldCurrent.removeAttribute('id');
	// Add the ID attribute with value 'current' to the newly active tab header (LI element)
	s.parentNode.setAttribute('id', 'current');
	document.getElementById(id).style.display = 'block';
}

function hide() {
	var policy = document.getElementById('showhidewrap').getElementsByTagName('div');
	for (var i = 0; i < policy.length; i++) {
		policy[i].style.display = 'none';
	}
}
