JS Menu Question

Good day.

I have a JS menu I got off the web I have been working over for my use. I cannot seem to figure out how to get this menu to display the submenu only when it is on the page the main menu takes you too…

Here is the code:

JS:

<script type="text/javascript">
<!--
function montre(id) {
var d = document.getElementById(id);
    for (var i = 1; i<=15; i++) {
        if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
    }
if (d) {d.style.display='block';}
}
//-->
</script>

THE MENU:

<dl id="menu">
    <dt onclick="javascript:montre();">
      <?php $mtitle = "Forest"; ?>
      <span class= <?php 
            if($title != $mtitle){ 
                echo "notactive";
            }
            else{ 
                echo "active";
            } ?>><a href="#"><?php echo $mtitle;?></a></span></dt>
    <?php if?>

<!-- here is where I am working I would like this or something in this effect to happen...-->
<!-- on click go to URL ---- if $mtitle = $title DISPLAY:BLOCK else DISPLAY:NONE -->

    <dt onclick="javascript:montre('smenu2');">
      <?php $mtitle = "About Us"; ?>
      <span class= <?php 
            if($title != $mtitle){ 
                echo "notactive";
            }
            else{ 
                echo "active";
            } ?>><a href="#"><?php echo $mtitle; ?></a></span></dt>
    <dd id="smenu2">
      <ul>
        <li><a href="#">About the Area</a></li>
        <li><a href="#">Here</a></li>
        <li><a href="#">There</a></li>
      </ul>
    </dd>
</dl>

So you click on the Main Link, it takes you to the PAGE, then the SUBMENU is shown… any clues? An easier way? Better way? Better Menu?
:pa:
Thanks!