// multiModal image handler (for PNG, JPEG, etc)
// Usage: multiModal.open('hello.jpg', {method: 'image'});
multiModal.contentHandlers.image = function(url, options, container, caller) {
    var img = document.createElement('img');
    img.src = url;

    if ( options.alt ) {
        img.alt = options.alt;
    }

    if ( options.title ) {
        img.title = options.title;
    }

    set_styles(img, {
        // Centers it horizontally
        display:    'block',
        margin:     '0 auto',
        // Prevents scrollbars showing up
        maxWidth:   container.style.width,
        maxHeight:  container.style.height
    });

    // Centers it vertically
    _addEvent(img, 'load', function(evt) {
        if ( img.height < container.clientHeight ) {
            img.style.marginTop = (container.clientHeight - img.height)/2 + "px";
        }
    });

    return img;
};
