Catching <a> link click - Fancy Box

Hi all

I have an example here of the simple image gallery I'm working with.
The thumbnails are loaded from an XML and are linked to larger images.

I want to use Fancy box to show the larger images. I have fancy box working on
other sites but can't get it to work here.

In an attempt to work out why it's not working I tried to capture the click on the <a> link,
but that won't work.

I'm stuck now can any see why I can't capture the click on the <a> link.

I think if I can work this out I might be able to get fancy box working.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="style.css" type="text/css">
    <link rel="stylesheet" href="fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
  <div class="wrap">
    <div id="header"><ul></ul></div>  
    <div id="content"></div>
  <script src=""type="text/javascript"></script>
  <script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<script type="text/javascript" src="fancybox/jquery.easing-1.4.pack.js"></script>
  <script type="text/javascript">
    function slideContent(div){
      var $content = $('#content');
      var divPos = $('#content ' + div).position();
      var scrollPosition = $content.scrollTop();
      $('#content').animate({scrollTop: scrollPosition}, 500);
      type: 'GET',
      url: 'images.xml',
      dataType: 'xml',
      success: function(xml){
          var id = $(this).attr('id');
          var secName = $(this).attr('secName');
          var divName = '#'+secName;
          var onclick = "slideContent('" + divName + "')";
          var link = '<a href="#" onclick="' + onclick + '">' +secName+ '</a>';
          $('<li></li>').html(link).appendTo('#header ul');
          $('<div id='+secName+' class="section"><ul></ul></div>').appendTo('#content');         
              var thumb = $(this).attr('imgName')+'_th.jpg'; 
              var img = $(this).attr('imgName')+'.jpg';    
              var className = "groupedImg";   
              $('<li><a href='+img+' class='+className+' ><img src='+thumb+' /></a></li>').appendTo('#'+secName+' ul');