$(document).ready(function(){

  // track the max height in a closure
  var maxheight = 0;

  
  $('#custom .block-block').each(function(){
    // make the whole div clicable
    
    // get the url of the readmore link
    var url = $(this).find('.readmore').attr('href');

    // if a url was found then use it to make the whole div clickable
    if(typeof url == 'string' && url.length !== 0)
    {
      $(this).css('cursor', 'pointer').click(function(){
        window.location = url;
      });
    }
    
    // look for max height in the items
    var thisheight = $(this).height();
    if(thisheight > maxheight)
    {
      // find the max height of the items comparing to each in the loop
      maxheight = thisheight;
    }
  });
  
  // set height, and set to relative so we can position the elements inside absolute
  $('#custom .block-block').css('position', 'relative').height(maxheight);
  
  // move the learn more buttons to the bottom
  $('#custom .block-block .readmore').css('position', 'absolute').css('bottom', '12px');
  
});
