add id to script



I want to call UnPopIt when a user clicks on the button whose id is
'joinlist' but I can't figure out how to modify the script correctly.
____________________________________________
<script type="text/javascript">
function PopIt() {
$("a#trigger").trigger('click');
window.onbeforeunload = UnPopIt;
return "Would you like to join our mailing list for other offers?";
}

function UnPopIt() { /* nothing to return */ }

$(document).ready(function() {
window.onbeforeunload = PopIt;

$("a#trigger").fancybox({
'hideOnContentClick': false,
'showCloseButton': false
});

$("a[id!=trigger]").click(function(){ window.onbeforeunload =
UnPopIt; });
});
</script>
.