
function getFormContent() {
    return '<table width="350" height="300" cellpadding="10" cellspacing="10"><tr>' +

           '<td valign="top">' +
           '<b>На странице:</b> <span id="perpageindicator"><span>' + userSettings.thumbnailsPerPage + "</span></span><br/>" +
           "<table width='135' border='0' cellspacing='0' cellpadding='0'><tr>" +
           "<td width='15'><input style='margin:0' type='radio' id='perpage15' name='perpageNum' value='15' onchange='updatePerpageIndicator(15)'" + (userSettings.thumbnailsPerPage == 15 ? " checked='checked'" : "") + "'/></td>" +
           "<td valign='bottom'><img src='/resources/img/previewcount1.gif' width='25' height='15'/></td>" +
           "<td width='15'><input style='margin:0' type='radio' id='perpage30' name='perpageNum' value='30' onchange='updatePerpageIndicator(30)'" + (userSettings.thumbnailsPerPage == 30 ? " checked='checked'" : "") + "'/></td>" +
           "<td valign='bottom'><img src='/resources/img/previewcount2.gif' width='25' height='15'/></td>" +
           "<td width='15'><input style='margin:0' type='radio' id='perpage60' name='perpageNum' value='60' onchange='updatePerpageIndicator(60)'" + (userSettings.thumbnailsPerPage == 60 ? " checked='checked'" : "") + "'/></td>" +
           "<td valign='bottom'><img src='/resources/img/previewcount3.gif' width='25' height='15'/></td>" +
           "<td width='15'><input style='margin:0' type='radio' id='perpage120' name='perpageNum' value='120' onchange='updatePerpageIndicator(120)'" + (userSettings.thumbnailsPerPage == 120 ? " checked='checked'" : "") + "'/></td>" +
           "</tr>" +
           "<tr>" +
           "<td colspan='3'>меньше</td>" +
           "<td colspan='6' align='right'>больше</td>" +
           "</tr>" +
           "</table>" +
           "</td>" +

           "<td rowspan='2' valign='top' style='border-left: 1px dotted black'>" +
           "<b>Расположение:</b><br/>" +
           "<input type='radio' id='briefsetting' name='typesetting' value='brief' " + (userSettings.layoutImagesType == 'brief' ? " checked='checked'" : "") + "/><label for='briefsetting'><b>Краткое</b></label><br/>" +
           "<input type='radio' id='fullsetting' name='typesetting' value='full' " + (userSettings.layoutImagesType == 'full' ? " checked='checked'" : "") + "/><label for='fullsetting'><b>Подробное</b></label>" +
           "</td>" +
           "</tr>" +

           "<tr>" +
           "<td valign='top' style='border-top: 1px dotted black'>" +
           "<input type='checkbox' name='previewsetting' id='previewsetting' value='' " + (userSettings.previewVisible ? " checked='checked'" : "") + "/><label for='previewsetting'><b>Превью</b></label>" +
           "</td>" +
           "<tr>" +
           "</table>";
}

function showViewSettings() {


    $.prompt(getFormContent(), {
        callback: mycallbackform,
        buttons: { "Ок": 'apply', 'Отмена': 'close' }
    });

}


function mycallbackform(v, m, f) {
    if (v == 'apply') {
        var showPreview = new Boolean(m.find("#previewsetting").attr("checked"));
        userSettings.setSettingsAndReload(showPreview, f.perpageNum, f.typesetting);
    }
}

function updatePerpageIndicator(val) {
    $("#perpageindicator span").replaceWith('<span>' + val + '</span>');
}
