﻿function onLoad(sender, args) {
    //place holder
}

function registerVideoPlayerEventHandlers() {
    //var sl = document.getElementById("SGT");
    //sl.Content.FeatureVideoPlayer.FeatureVideoStarted = onVideoStarted;
    //sl.Content.FeatureVideoPlayer.FeatureVideoCompleted = onVideoCompleted;
    //sl.Content.FeatureVideoPlayer.PostFuncClicked = onPostFuncClicked;
}

function onVideoStarted(sender, args) {
    var videoName = args.MediaName;
    //alert("start: " + videoName);

    If(Wol.Logging.isEnabled())
    {
        var myLogger = new Wol.Logging.Logger(Wol.Logging.commonLoggerTemplate(), Wol.Logging.LogTypeEnum.PageLoad);
        myLogger.setScalar(Wol.Logging.Const.FieldName.InteractionId, 19);
        myLogger.setScalar("prop23", "product tours:" + videoName);
        myLogger.setScalar(Wol.Logging.Const.FieldName.PageName, myLogger._get(Wol.Logging.Const.FieldName.PageName).value + ":pt" + ":vplay" + ":" + videoName);
        myLogger.log();
    }
}

function onVideoCompleted(sender, args) {
    var videoName = args.MediaName;
    //alert("Complete: " + videoName);
    
    If(Wol.Logging.isEnabled())
    {
        var myLogger = new Wol.Logging.Logger(Wol.Logging.commonLoggerTemplate(), Wol.Logging.LogTypeEnum.PageLoad);
        myLogger.setScalar(Wol.Logging.Const.FieldName.InteractionId, 20);
        myLogger.setScalar("prop23", "product tours:" + videoName);
        myLogger.setScalar(Wol.Logging.Const.FieldName.PageName,myLogger._get(Wol.Logging.Const.FieldName.PageName).value + ":pt" + ":vcompl" + ":" + videoName);
        myLogger.log();
    }
}

function onPostFuncClicked(sender, args) {
    var buttonName = args.ButtonName;
    var videoName = args.MediaName;
    
    switch (buttonName) {
        case "share":
            var shareType = args.Parameters[0];
            tagShare(videoName, shareType);
            break;
        case "replay":
            tagReplay(videoName);
            break;
        case "trywindows7":
            tagTryWin7(videoName);
            break;
        case "gohome":
            // place holder
            break;
        default:
            break;
    }
}

function tagShare(videoName, shareType) {
    //alert("share " + videoName + " via " + shareType);

    If(Wol.Logging.isEnabled())
    {
        var myLogger = new Wol.Logging.Logger(Wol.Logging.commonLoggerTemplate(), Wol.Logging.LogTypeEnum.PageLoad);
        myLogger.setScalar(Wol.Logging.Const.FieldName.InteractionId, 101);
        myLogger.setScalar("prop23", "product tours:" + videoName);
        myLogger.setScalar("prop22", shareType);
        myLogger.setScalar(Wol.Logging.Const.FieldName.PageName,myLogger._get(Wol.Logging.Const.FieldName.PageName).value + ":pt" + ":vshare" + ":" + videoName);
        myLogger.log();
    }
}

function tagReplay(videoName) {
    //alert("replay " + videoName);

    If(Wol.Logging.isEnabled())
    {
        var myLogger = new Wol.Logging.Logger(Wol.Logging.commonLoggerTemplate(), Wol.Logging.LogTypeEnum.PageLoad);
        myLogger.setScalar(Wol.Logging.Const.FieldName.InteractionId, 21);
        myLogger.setScalar("prop23", "product tours:" + videoName);
        myLogger.setScalar(Wol.Logging.Const.FieldName.PageName,myLogger._get(Wol.Logging.Const.FieldName.PageName).value + ":pt" + ":vreplay" + ":" + videoName);
        myLogger.log();
    }
}

function tagTryWin7(videoName) {
    //alert("try Win7 from" + videoName);
}

