/*(function(jQuery){
jQuery.fn.fitImg = function(width_,height_) {
    jQuery(this).each(function(){
        var _this = jQuery(this);
        if(width_ === undefined || height_ === undefined){
            var parentElem = _this.parents("div:first");
            var Pw = parentElem.width();
            var Ph = parentElem.height();
        }else{
            var Pw = width_;
            var Ph = height_;
        }
        //Get dimensions of the image        
        var width = _this.width();
        var height = _this.height();
        
        if(Pw >= width && Ph >= height){
            //parent height and width is greater than image's
            //so do nothing
            return;
        } 
        
        var ratio = width/height;
        var Pdiff = Pw/Ph;
        
        if(Pdiff < ratio){
            //fit by width
            width = Pw;
            height = width/ratio;
        }else{
            //fit by height
            height = Ph;
            width = height * ratio;
        }
        
        _this.css("height", height-10+"px");
        _this.css("width", width-10+"px");
    });
}
})(jQuery);*/