$(document).ready(function(){
  
  //Configuration Options
  // var max_width = 47;               //Sets the max width, in pixels, for every image
  // var selector = '#dpfrontteaser img';     //Sets the syntax for finding the images.  Defaults to all images.
  
  jQuery(selector).each(function(){
    var width = jQuery(this).width();
    var height = jQuery(this).height();
    
    if (width > max_width) {
        
      //Set variables  for manipulation
      var ratio = (height / width );
      var new_width = max_width;
      var new_height = (new_width * ratio);
      var paddingtop = (Math.round((max_width - new_height))/2);
      var mycss = '{ padding-top: "'+paddingtop+' px" ;}';
      
      //Shrink the image and add link to full-sized image
      jQuery(this).height(new_height).width(new_width);
      // jQuery(this).css(mycss);
      jQuery(this).css("padding-top",paddingtop);
  
      } //ends if statement
    }
  );
  
  

  
  
  
  
  
  
  
  
  
  
});
