$(document).ready(function() {

    // add clearBoth and top corner to rounded corners
    $("div.sidebarBox").before('<div class="sidebarBoxTop"></div>');
    //$("div.contentBox").before('<div class="contentBoxTop"></div>');
    $("div.sidebarBox, div.gallery, div#galleryContainer, div.galleryImage").append('<div class="clearBoth"></div>'); // adds clearBoth at the end of <div>

    $("div.contentElement, div.sidebarElement").append('<div class="clearBoth"></div>'); // adds clearBoth at the end of <div>

    // add shadow below gallery box
    $("div.gallery").append('<div class="shadow"></div>');

    // thumb hover
    $('.thumbs ul li a').hover(function() {
        $(this).append('<img src="/images/thumbHover.png" alt="" class="hover" />');
    }, function() {
        $('.hover').remove();
    });

    // equalHeight
    function equalHeight(group) {
        tallest = 0;
        group.each(function() {
            thisHeight = $(this).height();
            if (thisHeight > tallest) {
                tallest = thisHeight;
            }
        });
        group.height(tallest);
    }

    setTimeout(function() {
        equalHeight($(".imageContainer .gallery"));
    }, 500);

    setTimeout(function() {
        equalHeight($(".videoContainer .gallery"));
    }, 500);

    // scroll to screenshots
    jQuery('#commentLink').bind('click', function() {
        var offsetpx = jQuery('h3.comments').offset().top;
        jQuery('html,body').animate({ scrollTop: offsetpx }, 1000);
        return false;
    });

    // fancybox
    $("a.fancy").fancybox();
    $("a.videoLink").fancybox({
        'titleShow': false,
        'swf': { 'wmode': 'transparent', 'allowfullscreen': 'true' }
    });    
    
});  









