function getMessage(a,b){try{var c=chrome.i18n.getMessage(a,b);if(c)return c}catch(d){}}
function save_options(){var a=$("#backupPeriod"),b=parseInt(a.val());isNaN(b)&&(a.val(5),b=5);b<1||b>999?alert(getMessage("optionsBackupPeriodOutOfRange")):(localStorage.backupPeriod=b,localStorage.crashRestore=$("#crashRestore").prop("checked"),chrome.extension.getBackgroundPage().changeBackupSetting(),$("#options-saved").show(),localStorage.dateFormat=$("#dateFormatSelect option:selected").val(),a=$("input[name=popupSizeSelect]:checked").val(),a=="1"?delete localStorage.popupSize:localStorage.popupSize=
a=="0.9"?"0.9":$("#customPopupSize").val()/100,localStorage.editOrder=$(editOrder).prop("checked"))}
function restoreSetting(){localStorage.crashRestore=="true"?($("#crashRestore").prop("checked",!0),$("#backupPeriod").prop("disabled",!1)):($("#crashRestore").prop("checked",!1),$("#backupPeriod").prop("disabled",!0));localStorage.editOrder=="false"&&$(editOrder).prop("checked",!1);$("#backupPeriod").val(localStorage.backupPeriod?localStorage.backupPeriod:5);$("#dateFormatSelect").val(localStorage.dateFormat||1);if(localStorage.popupSize){var a=localStorage.popupSize;a=="1"||a=="0.9"?($('input[name="popupSizeSelect"][value="'+
a+'"]').prop("checked",!0),$("#customPopupSize").attr("disabled","disabled")):($('input[name="popupSizeSelect"][value="custom"]').prop("checked",!0),$("#customPopupSize").val(a*100))}}
function init(){if(getMessage("optionsPageTitle"))document.title=getMessage("optionsPageTitle"),$("#pagetitle").html(getMessage("optionsPageTitle")),$("#optionsEnableCrashRecovery").html(getMessage("optionsEnableCrashRecovery")),$("#optionsBackupPeriod").html(getMessage("optionsBackupPeriod")),$("#optionsDateFormat").html(getMessage("optionsDateFormat")),$("#stringSave").html(getMessage("save")),$("#options-saved").html(getMessage("optionsSaved")),$("#supportUs").html(getMessage("supportUs")),$("#stringMinutes").html(getMessage("minutes")),
$("#optionsNewUserTips").html(getMessage("optionsNewUserTips")),$("#optionsPopupSize").html(getMessage("popupSizeLabel")),$("#sizeWarning").html(getMessage("sizeWarning")),$(optionsReorder).html(getMessage("optionsReorder"));$("#crashRestore").change(function(){$(this).prop("checked")?$("#backupPeriod").prop("disabled",!1):$("#backupPeriod").prop("disabled",!0)});$("input[name=popupSizeSelect]").change(function(){var a=$('input[name="popupSizeSelect"]:checked').val();a=="0.9"||a=="1"?$("#customPopupSize").prop("disabled",
!0):$("#customPopupSize").prop("disabled",!1)})}$(document).ready(function(){init();restoreSetting();$(saveBtn).click(function(){save_options()})});
