//Site's Related Right Navigation Link Menu - "Related Links"
//Refresh right navigation when toggled.
function rightnav_refreashDone(){
document.getElementById("rightnav_DL").style.display = 'none';
document.getElementById("rightnav_DL").style.display = 'block';
}
function rightnav_doToggleDL(x){
	var zDD=document.getElementById('rightnav_DL').getElementsByTagName('dd');
	var zDT=document.getElementById('rightnav_DL').getElementsByTagName('dt');
	//Get elements and refresh right navigation.
		setTimeout('rightnav_refreashDone()', 1)
		zDD[x].className=(zDD[x].className=='hideDD')?'showDD':'hideDD';
		zDT[x].className=(zDT[x].className=='DTplus')?'DTminus':'DTplus';	
}
function rightnav_toggleDLopen(){//we open all of them
	var zDD=document.getElementById('rightnav_DL').getElementsByTagName('dd');
	var zDT=document.getElementById('rightnav_DL').getElementsByTagName('dt');	
	for(var i=0;i<zDT.length;i++){
		zDD[i].className='showDD';
		zDT[i].className='DTminus';
	}
	return false;
}
function rightnav_toggleDLclose(){//we close all of them	
	var zDD=document.getElementById('rightnav_DL').getElementsByTagName('dd');
	var zDT=document.getElementById('rightnav_DL').getElementsByTagName('dt');	
	for(var i=0;i<zDT.length;i++){
		zDD[i].className='hideDD';
		zDT[i].className='DTplus';
	}
	return false;	
}
//Remove anchor tag and leaving only the content that was inbetween the anchor tag. The purpose is to remove the link from list content.
function stripHTML(zContent){
var re = /(<([^>]+)>)/gi;
u = zContent;
for (i=0; i < u.length; i++) {
if (u.substr(0,3) == "<A " || u.substr(0,3) == "<a ") {
u=u.replace(re, "");
zContent = u;
}
}
return zContent;
}
function rightnav_toggleDL(){
if (document.getElementById && document.getElementsByTagName){			
	var zDT=document.getElementById('rightnav_DL').getElementsByTagName('dt');
	var zDD=document.getElementById('rightnav_DL').getElementsByTagName('dd');
	var ToggleON = document.getElementById('rightnav_toggleON');
	var ToggleOFF = document.getElementById('rightnav_toggleOFF');	
	if (ToggleON && ToggleOFF){// Show All - Hide All "links"
		ToggleON.onclick = rightnav_toggleDLopen;
		ToggleON.title = "Show all answers";
		ToggleON.href = "#";		
		ToggleOFF.onclick = rightnav_toggleDLclose;	
		ToggleOFF.title = "Hide all answers";
		ToggleOFF.href = "#";		
	}
	for(var i=0;i<zDT.length;i++){
		var zContent = zDT[i].innerHTML;
		//If the item is a link, the anchor tag will be stripped away leaving only the text. DIV tags will be placed around the text for styling and compatibility reasons and anchor tags will be reestablished around the DIV tags.
		if (zDT[i].getElementsByTagName('a').length > 0) {
		zContent = stripHTML(zContent);
		var linking = zDT[i].getElementsByTagName('a')[0].getAttribute("href");
		var zHref = "<a title=\""+zContent+"\" href='" + linking +"'> <div>";
		zDT[i].innerHTML = zHref + zContent + "</div></a>";
		zDD[i].className='hideDD';
		zDT[i].className='DTplus';
		} else {
		var zHref = "<a title=\""+zContent+"\" href='#'> <div onclick=\"rightnav_doToggleDL("+i+");return false\"><img class=\"butO\" align=\"right\" src=\"" + location.protocol+'//'+document.location.host + "/images/BlueArrowO_img.gif\"><img class=\"but\" align=\"right\" src=\"" + location.protocol+'//'+document.location.host + "/images/BlueArrow_img.gif\">";
		zDT[i].innerHTML = zHref + zContent + "</div></a>";
		zDD[i].className='hideDD';
		zDT[i].className='DTplus';
		}
		}
	}
}