// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function max_image_size(image, max_width, max_height){
  width = image.width;
  height = image.height;
  if(width > max_width || height > max_height){
    resize = ((width / max_width) > (height / max_height)) ?
      (width / max_width) : ( height / max_height);
    image.width = width / resize;
    image.height = height / resize;
  }
}
