/*
 *  
*/
(function( $ ){
  $.fn.imageResize = function( options ) {  

	var settings = {
      'maxWidth'  : 100,
      'maxHeight' : 100
    };

    return this.each(function() {        
      // If options exist, lets merge them
      // with our default settings
      if ( options ) { 
        $.extend( settings, options );
      }
	  
      // Tooltip plugin code here
		var _maxWidth = settings.maxWidth;
		var _maxHeight = settings.maxHeight;

		var _maxWidthDelta = $(this).width() / _maxWidth;
		var _maxHeightDelta = $(this).height() / _maxHeight;

		if (_maxWidthDelta > _maxHeightDelta && _maxWidthDelta > 1) {
			$(this).attr("width",  _maxWidth );
			$(this).attr("height", parseInt( $(this).height() / (($(this).width()/_maxWidth))) );
		} else {
			$(this).attr("height", _maxHeight);
			$(this).attr("width", parseInt( $(".randomartisimage").width() / (($(".randomartisimage").height()/_maxHeight))) );
		}
    });

  };
})( jQuery );
