var teaserVideoListener = new Object();
var teaserVideoPlaylist = new Array(1, 2, 3, 4);
var currTeaserVideo = 0;

teaserVideoListener.onInit = function()
{
    currTeaserVideo = Math.floor(Math.random() * teaserVideoPlaylist.length); // Temporary
    getTeaserVideoObj().SetVariable("method:setVolume", 0);
    playTeaserVideo(currTeaserVideo);
}

teaserVideoListener.onUpdate = function()
{
}

teaserVideoListener.onFinished = function()
{
    currTeaserVideo++;
    if(currTeaserVideo > teaserVideoPlaylist.length)
        currTeaserVideo = 0;
    playTeaserVideo(currTeaserVideo);
}

function playTeaserVideo(videoId)
{
    getTeaserVideoObj().SetVariable("method:setUrl", "http://www.bandit.nl/resources/videos/video" + teaserVideoPlaylist[currTeaserVideo] + ".flv");
    //getTeaserVideoObj().SetVariable("method:setPosition", 0);
    getTeaserVideoObj().SetVariable("method:play", "");
}

function getTeaserVideoObj()
{
    return document.getElementById("teaserVideoObj");
}
