$(document).ready(function () {
    $(window).resize(function () {
        gallbdr();
    });
});

var gallbdr = function () {
    var oldli = 1;
    $(".gallery .work-list li.fcell").removeClass("fcell");
    $(".gallery .work-list li").each(function () {
        var nowli = $(this).position().top;
        if (oldli == 1) {
            $(this).addClass("fcell");
        } else if (oldli < nowli) {
            $(this).addClass("fcell");
        }
        oldli = nowli;
    });
}

var imgCenter = function () {
    $(".gallery .work-list li .work-pct").each(function () {
        var dist = Math.round(($(this).height() - $(this).find("img").height()) / 2);
								$(this).find("img").css("margin-top",dist + "px");
    });
}
