/* ##################################################
# relContentCheck.js
# this js grabs the li's in an article and 
# checks for duplicates
################################################## */
function relContentCheck() 
{
if (document.getElementById('relatedcontent') != null)
{
// get elements by the tag
relList = document.getElementById('relatedcontent').getElementsByTagName('li');
// loop through 
for (x=0; x < relList.length; x++)
{
if (relList[x].id && relList[x].id != "")
{
if (relList[x].id.indexOf("rel") == 0 && contentList.indexOf(relList[x].id) == -1)
{
// add to the list if it's new
contentList += "|" + relList[x].id;
}
else
{
// otherwise set its display to none
relList[x].style.display = 'none';
}
}
}
}
// if the contains a | we need to hide the whole
// table b/c the only rel content is the article itself
if (contentList.indexOf("|") == -1)
{
if (document.getElementById('relatedcontent'))
{
document.getElementById('relatedcontent').style.display = 'none';
}
}
}
// Stick this function into the onload event
addLoadEvent(relContentCheck);