
function resize(elem, max) {

    if (elem == undefined || elem == null) return false;
    if (max == undefined) max = 100;
    if (elem.width > elem.height) {
        if (elem.width > max) elem.width = max;
    } else {
        if (elem.height > max) elem.height = max;
    }
}


$(document).ready( function () {
    
    $('#searchResults img').wrap("<div class='resultImage'></div>")
   
    $('#searchResults img').each( function(i) {
    
        var img = this;
        
        $(this).load( function () {
            
            resize(img, 120);
            
            //$(this).css('visibility', 'normal');
        });
    });
    
});
    


