Alright I know they get a bad rap as an unproffesional service, but I have been trying to develop a hack for the proboards engine, based off of JS, sadly my JS skills aren't all that impressive, (well than again neither are my programming skills ) anyway here be the problem

there is a single <a href> with the class nav seen on the following test site somewhere just above the first category bar, on
http://fullphaser.proboards28.com/

Now I would like to place (using javascript) a link that changes depending on if something else (basically you are going to have to look at the source to see where this crazy loop comes from :P ) you'll see in the source you must login or register, which becomes hey username you have x messages x is/are new. this is hidden over by a modification that has already been made. I can't modify the base HTML, and the only code i can put must will be above the "banner" and below the "info center'

this is what I have drawn up so far.
Code:
<script type="text/javascript">
<!--
//PM modifier
var forumTitle = "Fullphaser Designs";
while (pb_username != 'guest'){
var navTree = New RegExp("/^(forumTitle)(*.)(<br/>|</font>)$/i");
var pm = New RegExp("/*^(/d*) (is|are) new.$/i");//How do you assign a number value to this?
if (pm > 0){
var pmaddon = "<div style=\"float: right;\"><a href=\"?action=pm\">New PM's!</a></div><div style=\"clear: both;\"></div>";
navTree.innerHTML(navTree, pmAddon);
}
else {
var pmaddon = "<div style=\"float: right;\"><a href=\"?action=pm\">No New PM's</a></div><div style=\"clear: both;\"></div>";
navTree.innerHTML(navTree, pmAddon);
}
//-->
</script>
any ideas for a JS noob?

its supposed to do something similar to this code
Code:
<script type="text/javascript">
<!--
/* new/no new pms in nav tree - ross
http://support.proboards.com */
var td = document.getElementsByTagName('td');
if(pb_username != 'Guest') {
for(i=0; i<td.length; i++) {
if(td.item(i).width == '100%' && td.item(i).vAlign == 'top' && td.item(i).parentNode.parentNode.parentNode.className == '') {
var navHolder = document.createElement('div');
while(td.item(i).firstChild.nextSibling.nodeName.match(/^(a|br|font|#text)$/i)) {
navHolder.appendChild(td.item(i).firstChild.nextSibling)
}
var pmTable = '<table width="100%" cellPadding="2"><tr><td width="60%" vAlign="bottom">';
pmTable += navHolder.innerHTML;
pmTable += '</td><td width="40%" align="right" vAlign="bottom"><a href="?action=pm">';
td.item(2).innerHTML.match(/ (\d+) (are|is) new./)
pmTable += (RegExp.$1 != '0')? RegExp.$1+' New Private Message'+((RegExp.$2 == 'are')?'s':'') : 'No New Private Messages';
pmTable += '</a></td></tr></table>';
navHolder.innerHTML = pmTable;
td.item(i).replaceChild(navHolder, td.item(i).firstChild)
break;
}
}
}
//-->
I more or less want to figure out how that works.