  function showCurrentItem(carousel, item, idx, state) {
    //alert(jQuery(item + " .thumb").attr("href"));
    var img = jQuery(item).find("a").attr("href");
    caption = jQuery(item).find("a").attr("title");
    jQuery("#bigimg").html('<img class="prop" title="'+caption+'" src="'+img+'" /><br /><a href="" id="slideshowlink"><img style="position:relative; top: -10px;" src="/img/slideshow.gif" alt="slideshow" /></a>');
    jQuery("#zoomlink").attr("href", img);
    jQuery("#zoomlink").attr("title", caption);
    jQuery("#slideshowlink").attr("href", img);
    jQuery("#slideshowlink").attr("title", caption);
  }
  var currentImg = 1;
  var totalimgs = 0;

  function carInitCallback(carousel) {
    jQuery('#prevlink').bind("click", function () {
       jQuery('#thumb_' + currentImg).removeClass('current');

      if(currentImg == 1)
        currentImg = totalimgs;
      else
        currentImg--;

      jQuery('#thumb_' + currentImg).addClass('current');
      img = jQuery('#standard_' + currentImg).html();
      caption = jQuery('#thumb_' + currentImg).attr("title");
      largeImg = jQuery('#thumb_' + currentImg).attr("href");
      jQuery("#bigimg").html('<img title="'+caption+'" class="prop" src="'+img+'" /><br /><a href="" id="slideshowlink"><img src="/img/slideshow.gif" alt="slideshow" style="position:relative; top: -10px;" /></a>');
      jQuery("#zoomlink").attr("href", largeImg);
      jQuery("#zoomlink").attr("title", caption);
      jQuery("#slideshowlink").attr("href", largeImg);
      jQuery("#slideshowlink").attr("title", caption);

      carousel.scroll(currentImg);

      return false;
    });

    jQuery('#nextlink').bind("click", function () {

      jQuery('#thumb_' + currentImg).removeClass('current');

      if(currentImg == totalimgs)
        currentImg = 1;
      else
        currentImg++;

      jQuery('#thumb_' + currentImg).addClass('current');
      caption = jQuery('#large_' + currentImg).attr("title");
      img = jQuery('#standard_' + currentImg).html();
      largeImg = jQuery('#thumb_' + currentImg).attr("href");
      jQuery("#bigimg").html('<img title="'+caption+'" class="prop" src="'+img+'" /><br /><a href="" id="slideshowlink"><img src="/img/slideshow.gif" alt="slideshow" style="position:relative; top: -10px;" /></a>');
      jQuery("#zoomlink").attr("href", largeImg);
      jQuery("#zoomlink").attr("title", caption);
      jQuery("#slideshowlink").attr("href", largeImg);
      jQuery("#slideshowlink").attr("title", caption);
      carousel.scroll(currentImg);

      return false;
    });

  }

  jQuery(document).ready(function() {

    jQuery('#thumbs').jcarousel({scroll:1, wrap: 'last', initCallback: carInitCallback});

    jQuery(".thumb").click(function () {
      var t1 =  jQuery(this).attr("id").split("_");
      var thisnum = t1[1];
      jQuery('#thumb_' + currentImg).removeClass('current');
      jQuery(this).addClass('current');
      currentImg = thisnum;
      var img = jQuery('#standard_' + currentImg).html();
      largeImg = jQuery('#thumb_' + currentImg).attr("href");
      var caption = jQuery(this).attr("title");
      jQuery("#bigimg").html('<img title="'+caption+'" class="prop" src="'+img+'" /><br /><a href="" id="slideshowlink"><img src="/img/slideshow.gif" alt="slideshow" style="position:relative; top: -10px;" /></a>');
      jQuery("#zoomlink").attr("href", largeImg);
      jQuery("#zoomlink").attr("title", caption);
      jQuery("#slideshowlink").attr("href", largeImg);
      jQuery("#slideshowlink").attr("title", caption);
      return false;
    });

    totalimgs = jQuery("#thumbs li").length;

    jQuery('#thumb_1').addClass('current');

    jQuery("#bigimg").click(function () {
      var largeImg = jQuery('#thumb_' + currentImg).attr('href');
      var caption = jQuery('#thumb_' + currentImg).attr('title');
      tb_show(caption, largeImg, 'gallery');
      this.blur();
    	return false;
    });

    jQuery("#zoomlink").click(function () {

      var largeImg = jQuery('#thumb_' + currentImg).attr('href');
      var caption = jQuery('#thumb_' + currentImg).attr('title');
      tb_show(caption, largeImg, 'gallery');
      this.blur();
    	return false;
    });

    jQuery("#slideshowlink").click(function () {

      var largeImg = jQuery('#thumb_' + currentImg).attr('href');
      var caption = jQuery('#thumb_' + currentImg).attr('title');
      tb_show(caption, largeImg, 'gallery');
      this.blur();
    	return false;
    });

  });

