﻿
var ar = $(".divOverallVideo");
if (ar != null) {
    for (var i = 0; i < ar.length; i++) {
        var title = ar[i].title;
        var getId = ar[i].id;
        var getPage = getId + ".aspx";
        ar[i].innerHtml = "";
        if (getId == "comm100overall") {

            ar[i].innerHTML = "<a onclick=\"WindowOpenOverall('" + getPage + "')\"><span style=\"background-image: url(../images/button/button_video_" + getId + ".png)\"></span><label><img width=\"28px\" height=\"11px\" src=\"../images/icon/icon_hot.gif\" alt=\"Comm100 Introduction\" title=\"Comm100 Introduction\"/> " + title + "</label></a>";

        }
        else if (getId == "comm100overallhot") {
            ar[i].innerHTML = "<a onclick=\"WindowOpenOverall('comm100overall.aspx?type=comm100introductionright')\"><span style=\"background-image: url(../images/button/button_video_comm100overall.png)\"></span><label><img width=\"28px\" height=\"11px\" src=\"../images/icon/icon_hot.gif\" alt=\"Comm100 Introduction\" title=\"Comm100 Introduction\"/> " + title + "</label></a>";

        }
        else if (getId == "livechatoverallihot") {

            ar[i].innerHTML = "<a onclick=\"WindowOpenOverall('livechatoverall.aspx?type=livechatvideoright')\"><span style=\"background-image: url(../images/button/button_video_livechatoverall.png)\"></span><label>" + title + "</label></a>";
        }
        else if (getId == "emailmarketingoverall") {

            ar[i].innerHTML = "<a onclick=\"WindowOpenOverall('emailmarketingoverall.aspx?type=emailmarketingvideoright')\"><span style=\"background-image: url(../images/button/button_video_emailmarketingoverall.png)\"></span><label>" + title + "</label></a>";
        }
        else {
            ar[i].innerHTML = "<a onclick=\"WindowOpenOverall('" + getPage + "')\"><span style=\"background-image: url(../images/button/button_video_" + getId + ".png)\"></span><label>" + title + "</label></a>";
        }
    }
}

function WindowOpenOverall(obj) {

    if (obj == "comm100overall.aspx?type=comm100introductionright") {
        Comm100Cookie("homepage", 2);
    }
   else if (obj == "livechatoverall.aspx?type=livechatvideoright") {
        Comm100Cookie("video", 1);
    }
   else if (obj == "emailmarketingoverall.aspx?type=emailmarketingvideoright") {
        Comm100Cookie("emailmarkeing", 1);
    }
    window.open('../video/' + obj, 'newwindow', 'height=700, width=800, top=50,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=0,location=no, status=no');


}

function Comm100Cookie(name, value) {
    var Days = 30;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
}
        

