﻿// JavaScript Document
var i = 15000;
$(function() {
    $f("player", "../jscript/flowplayer.commercial-3.1.2.swf", {
        // product key from your account 
        key: '#$90846bbf5dda5897bf7',
        canvas: { backgroundColor: "#4d4d4d" },
        plugins: {
            controls: {
                url: 'flowplayer.controls-3.1.2.swf',
                autoPlay: false,
                skin: 'customskin',
                height: 20,
                backgroundGradient: 'medium',
                backgroundColor: '#4d4d4d',
                sliderGradient: 'low',
                sliderColor: '#ffffff',
                progressGradient: 'none',
                // progressColor: '#77216f',
                progressColor: '#0655a4',
                bufferGradient: 'none',
                bufferColor: '#333333',
                fullscreen: false,
                playlist: true,
                timeBgHeightRatio: .7,
                timeBgColor: '#333333',
                timeColor: '#cccccc',
                volumeSliderHeightRatio: .3,
                volumeSliderColor: '#333333',
                // buttonOverColor: '#77216f',
                buttonOverColor: '#0655a4',
                buttonColor: '#333333',
                tooltips: { buttons: true },
                tooltipColor: '#ffffff',
                tooltipTextColor: '#333333'
            },
            customskin: { url: "custom.swf", type: "classLibrary" }
        },

        clip: {
            //autoPlay:true,
            // track start event for this clip 
            onStart: function(clip) { eventTracker._trackEvent("Videos", "Play", clip.fileName); },
            // track pause event for this clip. time (in seconds) is also tracked 
            onPause: function(clip) { eventTracker._trackEvent("Videos", "Pause", clip.fileName, parseInt(this.getTime())); },
            // track stop event for this clip. time is also tracked 
            onStop: function(clip) { eventTracker._trackEvent("Videos", "Stop", clip.fileName, parseInt(this.getTime())); },
            // track stop event for this clip. time is also tracked 
            onResume: function(clip) { eventTracker._trackEvent("Videos", "Resume", clip.fileName, parseInt(this.getTime())); },
            // track finish event for this clip  par
            onFinish: function(clip) { eventTracker._trackEvent("Videos", "Finish", clip.fileName); },
            //when the Clip's duration is tracked,
            onMetaData: function(clip) {
                //create a cuepoint every i seconds (while i < Clip's duration)
                for (i; i < clip.duration * 1000; i = i + 15000) {
                    //creates cuepoint and sends data to GA with name = clip.fileName (define in playlist) and based on current time: Math.ceil(this.getTime())+"sec"
                    this.onCuepoint(i, function(clip, cuepoint) {
                        eventTracker._trackEvent("Videos", Math.round(this.getTime()) + "sec", clip.fileName, parseInt(this.getTime()));
                    });
                }
            }
            //close clips
        },

        playlist: [
        // playlist entries 

        //define first playlist entry
        {
        url: 'http://ceboard.vo.llnwd.net/o1/LeadershipAcademies/General/TestVid/CEBFinal_Short_High.flv',
        fileName: " ",
        title: "1&mdash;TITLE_HERE"
    }
    ]
})

// use playlist plugin. again loop is true
//.playlist("div.petrol", {loop:true});	
// .playlist("div.clips:first", {loop:true});

//this changes the order in which the playlist will play the clips. Each are defined by their index. The first clip created has an index of 0, the second index is 1, and so on and so forth...
// $f("player").play(0, 1, 2);	
});