function callFunction(type) {
    let parameter = {}
    $(".modal-header").css({
        "color": "#000",
        "background-color": "#fff"
    });
    $(".close").css({
        "color": "#000"
    });
    switch (type) {
        case 'selfTest':
            parameter = {requestType : "selfTest"};
            setTimeout(()=> {
                $("#selfTest").modal("hide")
            },autoClose)
            break;
        case 'remoteDiag':
            parameter = {requestType : "remoteDiag"};
            // setTimeout(()=> {
            //     $("#remoteDiagnosticRequest").modal("hide")
            // },autoClose)
            break;
        case 'openManual':
            parameter = {requestType : "openManual"};
            setTimeout(()=> {
                $("#openManual").modal("hide")
            },autoClose)
            break;
        case 'apiCommand':
            parameter = {requestType : "apiCommand"};
            setTimeout(()=> {
                $("#apicommand").modal("hide")
            },autoClose)
            break;
        case 'logs':
            $('.loaderDiv').css('display', 'block');
            parameter = {requestType : "logs"};
            
            break;
    }
    callPythonCgi(parameter);
}
function callPythonCgi(parameter) {
    $.ajax({
        url : "../cgi/cgi_Support.py",
        type : "get",
        data : parameter,
        contentType: 'application/json',
        dataType: 'json',
        headers: {
            'Access-Control-Allow-Origin': '*'
        },
        success: function (response) {
            $('.loaderDiv').css('display', 'none');
            if(parameter.requestType == 'logs'){
                if(response.status == 'fail'){
                    $("#logs").find('.modal-title').text("Error")
                    $(".modal-header").css({
                        "color": "#fff",
                        "background-color": "#db4141"
                    });
                    $(".close").css({
                        "color": "#fff"
                    });
                    $("#logs").modal("show")
                    $("#logs-message").html(response.response);
                    setTimeout(()=> {
                        $("#logs").modal("hide")
                    },autoClose)
                }
                else{
                    
                    $("#logs").modal("show")
                    if(response.status == 400){
                        $(".modal-header").css({
                            "color": "#fff",
                            "background-color": "#FFBF00"
                        });
                        $("#logs").find('.modal-title').text("Warning")
                    }
                    $("#logs-message").html(response.response);
                    setTimeout(()=> {
                        $("#logs").modal("hide")
                    },autoClose)
                }
            }
            // showModal('Success', response.response);
        }
    })
    
}