/**
 * Activate horizontal display of more than one image.
 */
function horizontalGallery($) {
    /* Return if .gallery is not found .*/
    if(!$('.gallery').size()) return;
    
    var $gallery = $('<div class="photosession"></div>');
    var gallery_width = 0;
    $('.gallery .gallery-item img').each(function() {
        $item = $('<div class="photo"></div>')
        $item.append(this)
        $gallery.append($item)
    });
    $(".gallery").replaceWith($gallery)
    $(".photosession").append('<br class="cb" />')
    $(".photosession .photo").each(function() {
        gallery_width += $(this).outerWidth()
    });
    $gallery.width(gallery_width)
    $("#content").width(gallery_width + $("#main-navigation").width() + 20);
}

jQuery(document).ready(function() {horizontalGallery(jQuery)});