﻿var TvinciLinkValidatorInProccess = false;
var flashInitialized = false;

function TvinciLinkValidatorFunction(button, args) {
    if (!TvinciLinkValidatorInProccess) {
        TvinciLinkValidatorInProccess = true;
        args.IsValid = true;
    } else {
        args.IsValid = false;

    }
}

function TvinciPlayerAddToLog(infoMessage) {
    if (typeof (NDSAddToLog) == 'function') {
        NDSAddToLog(infoMessage);
    }
}

function TvinciNDSAddToLog(assetID, logType, Description, OriginalMessage) {
    if (typeof (OriginalMessage) == 'undefined') {
        OriginalMessage = '';
    }

    if (typeof NDSAddToLog == 'function') {
        NDSAddToLog("NDS (" + logType + ") - " + assetID + " - " + Description + (OriginalMessage != "" ? " (" + OriginalMessage + ")" : ""));
    }
}

function KeepAlive() {
    if (typeof window.Technical != 'undefined') {
        window.Technical.KeepAlive(KeepAliveSuccess, KeepAliveFailed);
    } else {
        TvinciPlayerAddToLog("KeepAlive - Failed to perform call against tvp server (webservice not found)");
    }
}

function KeepAliveSuccess() {
    TvinciPlayerAddToLog("KeepAlive - called successfully against tvp server");
}

function KeepAliveFailed() {
    TvinciPlayerAddToLog("KeepAlive - Failed to perform call against tvp server");
}

var keepAliveIntervalID = 0;
function StartKeepAlive() {
    TvinciPlayerAddToLog("KeepAlive - triggered automatic calls every 1 minute");
    keepAliveIntervalID = setInterval("KeepAlive()", 60000);
}

function StopKeepAlive() {
    TvinciPlayerAddToLog("KeepAlive - suspended automatic calls");
    clearInterval(keepAliveIntervalID);
}

function changeBreadCrumbActiveItem(newText) {
    var elem = document.getElementById('BreadCrumbActiveItem');

    if (typeof elem != 'undefined' && elem != null) {
        elem.innerHTML = newText;
        document.title = newText;
    }
}

function LoadWhatYouWantToSee() {
    return;
    
    // Trigger what you want to see
    var whatyouwanttoseepanel = $find(WhatYouWantToSeePanel);

    if (typeof whatyouwanttoseepanel != 'undefined') {
        whatyouwanttoseepanel.refresh();
    }
}