function getSelectedValue(comboBoxName) {
    var comboBox = document.getElementById(comboBoxName);
    return comboBox[comboBox.selectedIndex].value;
}

function areaOnFocus(element, inputText)
{
     if( document.getElementById(element).value == inputText)
     {
    	 document.getElementById(element).value='';
     }
}

function areaOnBlur(element, inputText)
{
     if( document.getElementById(element).value=='')
     {
    	 document.getElementById(element).value = inputText;
     }
}

function setSelectedValue(comboBoxName, selectedValue) {
    var comboBox = document.getElementById(comboBoxName);
    var len = comboBox.options.length;
    for (var i = 0; i < len; i += 1) {
        if (comboBox.options[i].value == selectedValue) {
            comboBox.selectedIndex = i;
        }
    }
}

function updateLogger(loggerName, logLevelId, additivityId) {
    sessionAwareFunction(function() {
        jQuery.noConflict();
        var persist = document.getElementById('persistLogId').checked;

        var logLevelWidget = document.getElementById(logLevelId);
        var logLevel = logLevelWidget[logLevelWidget.selectedIndex].value;

        var additivityWidget = document.getElementById(additivityId);
        var additivity = additivityWidget[additivityWidget.selectedIndex].value;

        jQuery.post('update_logger-ajaxprocessor.jsp',
                    {loggerName: loggerName,
                      logLevel:logLevel,
                      additivity: additivity,
                      persist: persist
                    },
                    function(data){
                         CARBON.showInfoDialog(data);
                    });
    });
}

function showLoggers(beginsWith) {
    sessionAwareFunction(function() {
        jQuery.noConflict();
        var filterText = jQuery.trim(document.getElementById('filterText').value);
        jQuery("#loggers").load('loggers-ajaxprocessor.jsp?filterStr=' + filterText + '&beginsWith=' + beginsWith);
    });
}

function getAppenderData() {
    sessionAwareFunction(function() {
        jQuery.noConflict();
        var appenderName = getSelectedValue("appenderCombo");
        jQuery("#appenderSettings").load('appenders-ajaxprocessor.jsp?appenderName=' + appenderName);
    });
}

function updateAppender() {
    sessionAwareFunction(function() {
        jQuery.noConflict();
        var appenderName = getSelectedValue("appenderCombo");
        var logPattern = jQuery.trim(document.getElementById('appenderLogPattern').value);
        var threshold = getSelectedValue("appenderThresholdCombo");

        var logFile = null;
        if (document.getElementById('appenderLogFile')) {
            logFile = jQuery.trim(document.getElementById('appenderLogFile').value);
        }

        var sysLogHost = null;
        if (document.getElementById('appenderSysLogHost')) {
            sysLogHost = jQuery.trim(document.getElementById('appenderSysLogHost').value);
        }

        var facility = null;
        if (document.getElementById("appenderFacilityCombo")) {
            facility = getSelectedValue("appenderFacilityCombo");
        }
        var persist = document.getElementById('persistLogId').checked;

        jQuery.post('update_appender_ajaxprocessor.jsp',
                    {appenderName: appenderName,
                     logPattern: logPattern,
                     threshold: threshold,
                     logFile: logFile,
                     sysLogHost: sysLogHost,
                     facility: facility,
                     persist: persist
                    }, function(data){
                         CARBON.showInfoDialog(data);
                    });
    });
}

function syslogUpdateConfig(){
    sessionAwareFunction(function() {
        jQuery.noConflict();
        var syslogURL = document.getElementById('syslogURL').value;
        var syslogPort = document.getElementById('syslogPort').value;
        var realm = document.getElementById('realm').value;
        var userName = document.getElementById('userName').value;
        var password = document.getElementById('password').value;
        
        jQuery.post('update_syslog-ajaxprocessor.jsp',
            {syslogURL: syslogURL,
        	 syslogPort:syslogPort,
        	 realm: realm,
        	 userName:userName,
        	 password: password
            },
            function(data){
                CARBON.showInfoDialog(data);
                loadPage();
            });
    });    
}

function globalLog4jUpdateConfig(){
    sessionAwareFunction(function() {
        jQuery.noConflict();
        var persist = document.getElementById('persistLogId').value;
        var logLevel = getSelectedValue("globalLogLevel");
        var logPattern = jQuery.trim(document.getElementById('globalLogPattern').value);

        jQuery.post('updateLog4jGlobal-ajaxprocessor.jsp',
            {logLevel: logLevel,
             logPattern:logPattern,
              persist: persist
            },
            function(data){
                CARBON.showInfoDialog(data);
                loadPage();
            });
    });    
}

function restoreLog4jConfigToDefaults(){
    sessionAwareFunction(function() {
        jQuery.noConflict();
        jQuery.post('restoreDefaults-ajaxprocessor.jsp',
            {},
            function(data){
                CARBON.showInfoDialog(data);
                loadPage();
            });
    });
}

function showConfirmationDialogBox(message, yesCallback){
   jQuery.noConflict();
   CARBON.showConfirmationDialog(message,yesCallback, null);
}

function loadPage() {
    sessionAwareFunction(function() {
        jQuery.noConflict()
        jQuery("#globlaLog4jConfig").load('globalLogConfig-ajaxprocessor.jsp');
        jQuery("#syslogConfig").load('syslogConfig-ajaxprocessor.jsp');
        jQuery("#appenderSettings").load('appenders-ajaxprocessor.jsp');
        jQuery("#loggers").load('loggers-ajaxprocessor.jsp');
    });
}
@@ -1,20 +1,288 @@
+//Checks the browser support for the localstorage functions%0Avar has_localStorage_support = !!window.localStorage%0A    && typeof localStorage.getItem === 'function'%0A    && typeof localStorage.setItem === 'function'%0A    && typeof localStorage.removeItem === 'function';%0A%0A
 function getSelected
@@ -4887,29 +4887,31 @@
 sistLogId').
-value
+checked
 ;%0A        va
@@ -5047,16 +5047,49 @@
 .value);
+%0A        setPersistState(persist)
 %0A%0A      
@@ -6000,32 +6000,50 @@
 axprocessor.jsp'
+, loadPersistState
 );%0A        jQuer
@@ -6236,17 +6236,544 @@
 .jsp');%0A    %7D);%0A
-
 %7D
+%0A%0A/**%0A* Loads the state of persist configuration checkbox%0A*%0A**/%0Afunction loadPersistState() %7B%0A    if (has_localStorage_support) %7B%0A      jQuery.noConflict();%0A      var persist = localStorage.getItem(%22persist%22);%0A      if (persist != null) %7B%0A        jQuery(%22#persistLogId%22).prop(%22checked%22, persist == %22true%22 ? true : false);%0A      %7D%0A    %7D%0A%7D%0A%0A/**%0A* Stores the state of persist configuration checkbox%0A*%0A**/%0Afunction setPersistState(state) %7B%0A    if (has_localStorage_support) %7B%0A      localStorage.setItem(%22persist%22, state);%0A    %7D%0A%7D%0A%0A

Fix global log4j settings persist issue in admin ui