﻿function LoadPlayer(id, mid, p) {
    $jq(document).ready(function() {
        $jq("#" + id).html("<img src='" + spath + "/DesktopModules/DNNInfo_YouTubePlayer/images/loading.gif' />");
        $jq.ajax({
            cache: false,
            url: spath + "/DesktopModules/DNNInfo_YouTubePlayer/VideoHandler.ashx?mid=" + mid + "&p=" + p + "&id=" + id,
            data: "{}",
            contentType: "text/html; charset=utf-8",
            dataType: "html",
            error: function(xhr, status, error) {
                //alert the error if needed
                //alert(xhr.responseText);
            },
            success: function(msg) {
                $jq("#" + id).html(msg);
                $jq("#" + id).removeClass("ajaxloadingbar");
            }
        });
    });
}

function LoadVideo(id, vid, mid) {
    $jq(document).ready(function() {
        $jq("#" + id).html("<img src='" + spath + "/DesktopModules/DNNInfo_YouTubePlayer/images/loading.gif' />");
        $jq.ajax({
            cache: false,
            url: spath + "/DesktopModules/DNNInfo_YouTubePlayer/VideoLoader.ashx?vid=" + vid + "&mid=" + mid,
            data: "{}",
            contentType: "text/html; charset=utf-8",
            dataType: "html",
            error: function(xhr, status, error) {
                //alert the error if needed
                //alert(xhr.responseText);
            },
            success: function(msg) {
                $jq("#" + id).html(msg);
                $jq("#" + id).removeClass("ajaxloadingbar");
            }
        });
    });
}
