$(document).ready(function () {
    refineLayout();
    initGalleries();
});

$(window).resize(function () {
    refineLayout();
});

function refineLayout() {
    var contentHeight = parseInt($(document).height());
    var baseHeight = contentHeight - 1130;
    if (baseHeight > 0) {
        $("#base").height(baseHeight + "px");
        $("#base").css("top", contentHeight - baseHeight);

        if (baseHeight > 798) {
            $("#base").css("background-position", "center bottom");
        }
    }
}

function initGalleries() {
    $(".gallery a").fancybox({
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 200,
        'overlayShow': true
    });
}

var gaTrackerId = "UA-2899850-3";
function recordOutboundLink(link, category, action) {
  try {
    var pageTracker=_gat._getTracker(gaTrackerId);
    pageTracker._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100)
  }catch(err){}
}


