<div id="modal-window" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title"></h5>
      </div>
      <div class="modal-body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">

  // initiate modal window
  $(document).ready(function(){
    $("#modal-window").modal({
      backdrop: "static",
      show: false,
      keyboard: true
    });
  });

  // function to open modal window
  function showModal(title, content, on_show=function(){}, on_close=function(){}) {
    $("#modal-window").find(".modal-title").html(title);
    $("#modal-window").find(".modal-body").html(content);
    $("#modal-window").on("show.bs.modal", on_show);
    $("#modal-window").on("hide.bs.modal", on_close);
    $("#modal-window").modal("show");
  }

</script>