function ResetCover(cover) {
    cover = $(cover);
    var panelSize = { width: cover.parent().width(), height: cover.parent().height() };
    var coverSize = { width: cover.width(), height: cover.height() };
    var percent = { width: panelSize.width / coverSize.width, height: panelSize.height / coverSize.height };
    if (percent.width < 1 || percent.height < 1) {
        coverSize.width = coverSize.width * (percent.width < percent.height ? percent.width : percent.height);
        coverSize.height = coverSize.height * (percent.width < percent.height ? percent.width : percent.height);
    }
    coverSize.left = (panelSize.width - coverSize.width) / 2;
    coverSize.top = (panelSize.height - coverSize.height) / 2;
    cover.css(coverSize);
}
