function checkXMLHTTP(xmlhttp) {
    xmlhttp = false;
    try {
        return xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            xmlhttp = false;
        }
    }
    if (!xmlhttp && typeof XMLHttpRequest !== 'undefined') {
        return xmlhttp = new XMLHttpRequest();
    }
}

function documentID(el) {
    return document.getElementById(el); //Get the element with the specified ID
}


function get_course_info(course_id, url) {
    if (course_id !== '') {
        var xmlhttp1 = checkXMLHTTP(xmlhttp1);
        var formdata = new FormData();
        formdata.append("course_id", course_id);
        // alert(xmlhttp1.responseText);
        xmlhttp1.addEventListener("load", function () {
            document.getElementById('course_info').innerHTML = xmlhttp1.responseText;
             $('#datetimepicker1').datetimepicker({
                    viewMode: 'years',
                    format: 'YYYY-MM-DD'

                });
             $('#datetimepicker5').datetimepicker({
                    viewMode: 'years',
                    format: 'YYYY-MM-DD'

                });


        }, false);
        xmlhttp1.addEventListener("error", function () {
            alert("There is some problem in your browser, not working");
        }, false);
        xmlhttp1.addEventListener("abort", function () {
            alert("There is some problem in your browser, aborted");
        }, false);
        xmlhttp1.open("POST", url);
        xmlhttp1.send(formdata);
    }
}
function check_start_date(course_start_date) {
    var course_batch_start_date = documentID('course_batch_start_date').value;   
    if (course_batch_start_date < course_start_date) {
        document.getElementById('warning_message').innerHTML = "Batch start date is before course start date!";
    }
 }

    // alert(start_date);
    //alert(input_date);
//}
//    function get_course_info() {
//        var course_id = document.getElementById('course').value;
//        var xhr = create_xmlhttp();
//
//        var formdata = new FormData();
//        formdata.append("course_id", course_id);
//        xhr.addEventListener("load", function () {
//            document.getElementById('course_info').innerHTML = xhr.responseText;
//        }, false);
//
//        xhr.open("POST", "<?php echo base_url() . 'batch-course-info'; ?>");
//        xhr.send(formdata);
//    }

