[jQuery] Calling my JQuery function after adding new list items

[jQuery] Calling my JQuery function after adding new list items


Hi,
I have the following list structure on my site:
<UL id=topnav>
<LI>
<A id=11386_Tab onclick="" href="#">Home</A>
<UL style="TOP: 1.7em">
<LI>
<A id=m11387 title="Complaint Search" onclick=""
href="#">Complaint Search</A>
<UL style="LEFT: 11.1em">
<LI>
<A id=m11388 title=Open onclick="" href="#">Open</
A>
</LI>
<LI>
<A id=m11389 title=Pending onclick=""
href="t#">Pending</A>
</LI>
<LI>
<A id=m11390 title=Closed onclick=""
href="#">Closed</A>
</LI>
<LI>
<A id=m15012 title=fdgdfgdg onclick=""
href="#">fdgdfgdg</A>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
I have removed the href and onclick contents for simplicity. I also
have the following Javascript file containing:
function mainmenu(){
$(" #topnav ul ").css({display: "none"}); // Opera Fix
$(" #topnav li").hover(function(){
        $(this).find('ul:first').css({visibility: "visible",display:
"none"}).show(400);
        },function(){
        $(this).find('ul:first').css({visibility: "hidden"});
        });
}
$(document).ready(function(){
    mainmenu();
});
However at various points throughout the site, when a user clicks a
particular link it takes them to a page and adds a link to that page
into the appropriate place in the navigation. So for example the new
list structure would be (see the new link under Closed):
<UL id=topnav>
<LI>
<A id=11386_Tab onclick="" href="#">Home</A>
<UL style="TOP: 1.7em">
<LI>
<A id=m11387 title="Complaint Search" onclick=""
href="#">Complaint Search</A>
<UL style="LEFT: 11.1em">
<LI>
<A id=m11388 title=Open onclick="" href="#">Open</
A>
</LI>
<LI>
<A id=m11389 title=Pending onclick=""
href="t#">Pending</A>
</LI>
<LI>
<A id=m11390 title=Closed onclick=""
href="#">Closed</A>
<UL>
<LI>
<A id=m11391 title=New link
onclick="" href="#">New link</A>
</LI>
</UL>
</LI>
<LI>
<A id=m15012 title=fdgdfgdg onclick=""
href="#">fdgdfgdg</A>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
However when I hover over my menu structure again no sub menus appear
as was the case before the change.
The change does involve replacing all the content within the <UL
id=topnav>. The source of the page does have the new structure
included, but the JQuery no longer seems to recognise this.
So to my question, is there a way to recall or refresh the JQuery
function so that it now picks up the new sub-list?
Just to note, the onlclicks are not important to the way the menu
operates. It is solely on hovering.
Regards
Chris