$(document).ready( function() {
 if ($('table.tableSplash').length > 0)
  {
    $('div[class^=subtitle]').hide();
    $('div[class^=vig]').hide();
    
    var thisSplash = $('table.tableSplash').parents('div.divSplash');
    
    thisSplash.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

    thisSplash.find('td[class^=box]').mouseenter(function() {
      $(this).find('div[class^=subtitle]').show();
    }).mouseleave(function() {
      $(this).find('div[class^=subtitle]').hide();
    });
    
    thisSplash.find('td[class^=box]').click(function(){
      var splash = $(this).parents('div.divSplash');
      var num = parseInt( $(this).attr('class').match(/\d+$/) );
      var url = splash.find('div.link' + num).find('a').attr('href');
      window.location = url;
    });
  } // if table.tableSplash

});

