window.addEvent('domready', function() {
    if (window.location.hash &&
        window.location.hash.indexOf('comment') == 1) {
        scrollToComments();
    }
});

function enlargeImage() {
    $('submit_comment').className='';
    if ($('show_comments')) { 
        $('show_comments').className='';
    }
    $('exhibit').className = 'large';
    $('description').className = 'hide';
}

function shrinkImage() {
    $('exhibit').className = '';
    $('description').className = '';
}

function scrollToComments() {
    $('submit_comment').className = 'show';
    if ($('show_comments')) { 
        $('show_comments').className = 'show';
    }
    setTimeout(function() {
        var scroll = new Fx.Scroll(window, {
            wait: false,
            duration: 500,
            transition: Fx.Transitions.Quad.easeOut
        });
        if ($('show_comments')) {
            var y = $('show_comments').getPosition().y;
        } else {
            var y = $('submit_comment').getPosition().y;
        }
        scroll.scrollTo(0, y - 15);
    }, 0);
}