$(document).ready( function() {
 if ($('table.tableVignette').length > 0) // make sure we have cards and that these cards have summaries on them
  {
    $('div[class^=subtitle]').hide();
    $('div[class^=vig]').hide();
    
    var thisVignette = $('table.tableVignette').parents('div.divVignette');
    
    thisVignette.find('div[class^=image] img').imagesLoaded(function() {
     // alert( ($this).length );
      $(this).each(function() {
        var $this, url, par;
        
        $this = $(this);
        url = $this.attr('src');
        par = $this.parent();

        $this.remove();

        par
          .css({
            'background' : 'url(' + url + ') no-repeat center center'
          });
      }); // this.each
    }); //imagesLoaded

    thisVignette.find('td[class^=box]').mouseenter(function() {
      $(this).find('div[class^=subtitle]').show();
    }).mouseleave(function() {
      $(this).find('div[class^=subtitle]').hide();
    });
    
    thisVignette.find('td[class^=box]').click(function(){
      var vignette = $(this).parents('div.divVignette');
      vignette.find('div[class^=vig]').hide();
      var num = parseInt( $(this).attr('class').match(/\d+$/) );
      vignette.find('div.vig' + num).show();
    });
  } // if table.tableVignette
  
  /*
        var $this, postNum;
      $this = $(this);
      postNum = parseInt( $this.parents('[id^=post]').attr('id') );
      //alert(postNum);
  */
});

