// 修正打開新的modal並關閉上一個modal時，modal內容高度超過螢幕時scrollbar不會出現的問題...
    $(function(){	
        // 使用bootstrap modal的shown.bs.modal這個event就可以顯示scrollbar
        $('.modal').on('shown.bs.modal', function () {
            $('body').addClass('modal-open');
        })
    
        $(".modal [data-toggle='modal']").click(function(){
            $(this).closest(".modal").modal('hide');
            // 修正關閉新modal時，modal scrollbar位置會留下寬度17px空白的問題
            $('body').css("overflow","hidden").css("padding-right","0");    	
        });


        //modal 縮小視窗時，畫面置中
        $('#AddSuccessModal').on('show.bs.modal', function () {
            $('#AddSuccessModal').addClass('d-flex justify-content-center');
        });

        $('#SuccessModal').on('show.bs.modal', function () {
            $('#SuccessModal').addClass('d-flex justify-content-center');
        });
        $('#StopSuccessModal').on('show.bs.modal', function () {
            $('#StopSuccessModal').addClass('d-flex justify-content-center');
        });

        $('#FailModal').on('show.bs.modal', function () {
            $('#FailModal').addClass('d-flex justify-content-center');
        });
        $('#EditSuccessModal').on('show.bs.modal', function () {
            $('#EditSuccessModal').addClass('d-flex justify-content-center');
        });

        $('#confirmBackToCalendarMgnt').on('show.bs.modal', function () {
            $('#confirmBackToCalendarMgnt').addClass('d-flex justify-content-center');
        });


  
        $('#AddSuccessModal').on('hidden.bs.modal', function () {
            $('#AddSuccessModal').removeClass('d-flex justify-content-center');
        })

        $('#SuccessModal').on('hidden.bs.modal', function () {
            $('#SuccessModal').removeClass('d-flex justify-content-center');
        })

        $('#StopSuccessModal').on('hidden.bs.modal', function () {
            $('#StopSuccessModal').removeClass('d-flex justify-content-center');
        })

        $('#FailModal').on('hidden.bs.modal', function () {
            $('#FailModal').removeClass('d-flex justify-content-center');
        })

        $('#EditSuccessModal').on('hidden.bs.modal', function () {
            $('#EditSuccessModal').removeClass('d-flex justify-content-center');
        })

        $('#confirmBackToCalendarMgnt').on('hidden.bs.modal', function () {
            $('#confirmBackToCalendarMgnt').removeClass('d-flex justify-content-center');
        })
    
    });			