function Rich_Web_Forms_Submission_Message(Submission_ID) {
    var Rich_Web_Forms_Submission_Tr = jQuery('.Rich_Web_Forms_Submission_Tr_' + Submission_ID).css('font-weight');
    if (Rich_Web_Forms_Submission_Tr == '700' || Rich_Web_Forms_Submission_Tr == 'bold') {
        var ajaxurl = rw_form_json_object.ajaxurl;
        var data = {
            action: 'Rich_Web_Forms_Submission_RNR',
            rw_form_nonce_field: rw_form_json_object.rw_forms_nonce,
            foobar: Submission_ID,
        };
        jQuery.post(ajaxurl, data, function(response) {
            if (response.success !== true) {
                console.error("Not valid nonce.");
                return false;
            }
            jQuery('.Rich_Web_Forms_Submission_Tr_' + Submission_ID).css('font-weight', 'normal');
        })
    }
    var ajaxurl = rw_form_json_object.ajaxurl;
    var data = {
        action: 'Rich_Web_Forms_Submission_Mess',
        rw_form_nonce_field: rw_form_json_object.rw_forms_nonce,
        foobar: Submission_ID,
    };
    jQuery.post(ajaxurl, data, function(response) {
        if (response.success !== true) {
            console.error("Not valid nonce.");
            return false;
        }
        var responseData = response.data;
        var rich_web_message_table = '<table>';
        for (let i = 0; i < responseData.length; i++) {
            rich_web_message_table += `<tr><td> ${responseData[i]["Forms_Fields_Type"]} </td><td>${responseData[i]["Forms_Fields_Text"]}</td></tr>`;
        }
        rich_web_message_table += '</table>';
        jQuery('.Rich_Web_Forms_Submission_Div').html(rich_web_message_table);
        jQuery('.Rich_Web_Forms_Submission_Div_Main').fadeIn();
        jQuery('.Rich_Web_Forms_Submission_Div').fadeIn();
    })
}

function Rich_Web_Forms_Submission_Spam(Submission_ID) {
    var ajaxurl = rw_form_json_object.ajaxurl;
    var data = {
        action: 'Rich_Web_Forms_Submission_SNS',
        rw_form_nonce_field: rw_form_json_object.rw_forms_nonce,
        foobar: Submission_ID,
    };
    jQuery.post(ajaxurl, data, function(response) {
        if (response.success !== true) {
            console.error("Not valid nonce.");
            return false;
        }
        var Rich_Web_Forms_Submission_Tr = jQuery('.Rich_Web_Forms_Submission_Tr_' + Submission_ID + ' td:nth-child(8)').css('color');
        if (Rich_Web_Forms_Submission_Tr == 'rgb(255, 0, 0)' || Rich_Web_Forms_Submission_Tr == '#ff0000') {
            jQuery('.Rich_Web_Forms_Submission_Tr_' + Submission_ID + ' td:nth-child(8)').css('color', '#2aa800');
        } else {
            jQuery('.Rich_Web_Forms_Submission_Tr_' + Submission_ID + ' td:nth-child(8)').css('color', '#ff0000');
            alert(jQuery('#Rich_Web_Forms_Spam').val());
        }
    })
}

function Rich_Web_Forms_Submission_Delete(Submission_ID) {
    var RWFRFS = Submission_ID;
    jQuery('.Rich_Web_Forms_Fixed_Div').fadeIn();
    jQuery('.Rich_Web_Forms_Absolute_Div').fadeIn();
    jQuery('.Rich_Web_Forms_Relative_No').click(function() {
        jQuery('.Rich_Web_Forms_Fixed_Div').fadeOut();
        jQuery('.Rich_Web_Forms_Absolute_Div').fadeOut();
        RWFRFS = null;
    })
    jQuery('.Rich_Web_Forms_Relative_Yes').click(function() {
        if (RWFRFS != null) {
            jQuery('.Rich_Web_Forms_Fixed_Div').fadeOut();
            jQuery('.Rich_Web_Forms_Absolute_Div').fadeOut();
            var ajaxurl = rw_form_json_object.ajaxurl;
            var data = {
                action: 'Rich_Web_Forms_Submission_Del',
                rw_form_nonce_field: rw_form_json_object.rw_forms_nonce,
                foobar: Submission_ID,
            };
            jQuery.post(ajaxurl, data, function(response) {
                if (response.success !== true) {
                    console.error("Not valid nonce.");
                }
                jQuery('.Rich_Web_Forms_Submission_Tr_' + Submission_ID).hide();
            })
        }
        RWFRFS = null;
    })
}

function Rich_Web_Forms_Submission_Div_Main_Cl() {
    jQuery('.Rich_Web_Forms_Submission_Div_Main').fadeOut();
    jQuery('.Rich_Web_Forms_Submission_Div').fadeOut();
    jQuery('.Rich_Web_Forms_Submission_Div').html('');
}