jQuery(document).ready(function() {
  var rhsi=jQuery('.rhs-inner');
  rhsi.find('div,img').each(function(i) {
    if($(this).width() > rhsi.width()){
       var height = $(this).height();
       var ratio = rhsi.width() / $(this).width();
       if($(this).attr('tagName').toLowerCase() == 'img'){
          $(this).css('max-height',height * ratio + 'px');
       }
    }
    $(this).css('max-width',rhsi.width() + 'px');

  });
});

