﻿var indexcid = 1;
//弹评价窗口
function OpenFreeVideo() {
    parent.location.href = "../Video/FreePlay.aspx?cid="+cid+"";


}


//弹开视频登录窗口
function OpenLoginGo() {


    var loginHref = "../IframeLogin.aspx?cid=" + cid + "&rand=" + Math.random();
   
    $.fn.colorbox({
        href: loginHref,
        width: "400px",
        height: "280px",
        opacity: "0.3",
        iframe: true,
        onClosed: function () {

            if (control) {

                OpenFreeVideo();

            }
        }
    });
}







//异步判断用户状态（0未登录，1未开通课程，2已登录并开通）-视频课程
function UserCheckFreeVideo(call) {
  
    $.ajax({
        url: "../Ajax/GetSession.ashx",
        //        url: "../Ajax/UserCheck.ashx",
        type: 'get',
        data: "cid=" + cid + "&rand=" + Math.random(),
        async: true,
        success: function (str) {

            if (str == "true")
            { OpenFreeVideo(); }
            else {

                OpenLoginGo();
            }

        }
    });

    //return result;
}


//弹评价窗口
function OpenFreeVideoIndex(indexcid) {
    parent.location.href = "../Video/FreePlay.aspx?cid=" + indexcid + "";


}


//弹开视频登录窗口
function OpenLoginGoIndex(indexcid) {

     
    var loginHref = "../IframeLogin.aspx?cid=" + indexcid + "&rand=" + Math.random();

    $.fn.colorbox({
        href: loginHref,
        width: "400px",
        height: "280px",
        opacity: "0.3",
        iframe: true,
        onClosed: function () {

            if (control) {
          
                OpenFreeVideoIndex(indexcid);

            }
        }
    });
}


//异步判断用户状态（0未登录，1未开通课程，2已登录并开通）-视频课程
function UserCheckFreeVideoIndex(indexcid) {

    $.ajax({
        url: "../Ajax/GetSession.ashx",
        //        url: "../Ajax/UserCheck.ashx",
        type: 'get',
        data: "cid=" + indexcid + "&rand=" + Math.random(),
        async: true,
        success: function (str) {

            if (str == "true")
            { OpenFreeVideoIndex(indexcid); }
            else {
           
                OpenLoginGoIndex(indexcid);
            }

        }
    });

    //return result;
}
