﻿var elearingDateLocationURL = "/lib/site/plugin/elearingDateLocation/";







function courseDateLocation(courseDateOID)
{
    if (document.getElementById('mu_elearningCourseDateLocation') == null)
    {
        var dc = new Date();
        $.get(elearingDateLocationURL + "htmlpage.html?cache=" + dc.getTime(), function (d) {

            $("body").append(d);
            courseDateLocation_inner(courseDateOID);
        });
    }
    else
    {
        courseDateLocation_inner(courseDateOID);
    }
}


function courseDateLocation_inner(courseDateOID)
{
    var fd = {};
	fd['courseDateOID'] = courseDateOID;

        $.post(elearingDateLocationURL + "_ajax/handler.ashx", fd, function (d) {

            if (d.success) {
                var template = document.getElementById('mu_elearningCourseDateLocation').innerHTML;
                var rendered = Mustache.render(template, d);

                $("body").append(rendered);

                $(".el-courseLocation-holder-close").click(function () {
                    $(".elc-courseLocation").remove();
                });

            }

        }, "json").fail(function () {
            //alert('ERROR LOADING Messages');
        });
}