防止jquery ui对话框在点击时弹出多次

I was wondering is it a simple bug in the framework or maybe I'm doing something wrong but I have an applacation were a user clicks a link and a ajax call is made on load of the dialog box but I notice more then one dialog box pops up? The link gets clicks and you see 1-10 boxes stacked ontop of each other! I do not know what is going on. The links come from a php loop that generates anywhere from 1-1000 links that all have the function on mousedown triggering a function that calls for the jquery ui dialog to take the value of the id and make a ajax call with that to return content for that dialog box.

/// php
while($row = mysql_fetch_array($sql3)){
    $clutchs[] = "
        <li id=\"".$row['id']."\" class=\"ui-widget-content\" >
        <a id=\"".$row['id']."\" 
            href=\"#\" onclick=\"return false\" onmousedown=\"popup('c:".$row['id']."')\" 
            title=\"".$row['fs']."\" 
            class=\"cer\">".$row['size']." car worth</a>
            </li>
            ";
    }

// jquery 
function popup(a){
    $.fx.speeds._default=500;
    $(".popup").dialog({
        autoOpen:!0,
        show:"blind",
        hide:"explode",
        stack:!1
    });

    $(".popup").html(
        '<center><img src="source/images/loaders/loaders(1).gif"></center>'
    );

    $.post("....",".....="+a,function(a){
        $(".popup").html(a)
    })
}

you might have more than one element with the class popup