window.InitUserScripts = function()
{
var player = GetPlayer();
var object = player.object;
var once = player.once;
var addToTimeline = player.addToTimeline;
var setVar = player.SetVar;
var getVar = player.GetVar;
var update = player.update;
var pointerX = player.pointerX;
var pointerY = player.pointerY;
var showPointer = player.showPointer;
var hidePointer = player.hidePointer;
var slideWidth = player.slideWidth;
var slideHeight = player.slideHeight;
window.Script1 = function()
{
  var start = new Date();
var startComparable = Date.parse(start);
var player = GetPlayer();
player.SetVar("1_Start",startComparable);
}

window.Script2 = function()
{
  let player = GetPlayer();
var timeCountdown = 0;
var finish = false;

function startTimer(duration) {
    var timer = duration, minutes, seconds;
    setInterval(function () {
       	if(finish == false){
        minutes = parseInt(timer / 60, 10);
        seconds = parseInt(timer % 60, 10);

        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;

        timeCountdown = minutes + ":" + seconds;
        if(minutes==0 && seconds==0){
        	finish = true
        }
        player.SetVar('timeCountdown', timeCountdown);
		console.log(timeCountdown)
		console.log('finish= ', finish)
        if (--timer < 0) {
            timer = duration;
        }}
    }, 1000);    
}

var fiveMinutes = 60 * 5
startTimer(fiveMinutes);
}

window.Script3 = function()
{
  var end = new Date();
var endComparable = Date.parse(end);
var player = GetPlayer();
player.SetVar("1_End",endComparable);
}

window.Script4 = function()
{
  var player = GetPlayer();
var startComparable = player.GetVar('1_Start');
var endComparable = player.GetVar('1_End');
var ms = endComparable - startComparable; 
var s = ms % 1000;
ms = (ms - s) / 1000;
var secs = ms % 60;
ms = (ms - secs) / 60;
var mins = ms % 60;
var hrs = (ms - mins) / 60;
player.SetVar("1_Hours",hrs);
player.SetVar("1_Minutes",mins);
player.SetVar("1_Seconds",secs);
}

window.Script5 = function()
{
  var player = GetPlayer();
var scorePercent = player.GetVar('score')
scorePercent = (scorePercent*100)/39
var scorePercentRound = Math.round(scorePercent);
player.SetVar('scorePercent',scorePercentRound)
}

};
