﻿var confDefault = {

    //license key
    key: '#$96b72f86c9bd00d9a55',

    //flowplayer location
	flowplayerurl:'/flash/flowplayer/flowplayer.swf', //required
	
	loop:true, //required
	
	clip: {
		autoPlay: false,
		autoBuffering: false,
		scaling: "fit", //"orig"
		baseUrl: '',
		
	    fadeInSpeed: 2000,
	    
	    // if screen is hidden show it upon startup
	    onStart: function() {
	        this.getScreen().css({opacity: 1});
	    },
	
		onBegin: function() { //required
		    var thisClip = this.getClip();
		    var thisPlaylist = this.getPlaylist();
			var clipCount = this.getPlaylist().length;
			var captionDiv = $get("PlayerCaptionDiv");
			var controls = this.getControls();
			var scroll = $("div.PlaylistWrapperDiv").scrollable();
			
			controls.fadeIn(1000);
			
			try {
			    captionDiv.innerHTML = "<div class=\"ClipTitleDiv\">" + thisClip.title + "</div>" + (thisClip.author.length > 1 ? "<div class=\"ClipAuthorDiv\">by " + thisClip.author + "</div>": "") + (clipCount > 1 ? "<div class=\"ClipCountDiv\">" + (thisClip.index + 1) + " of " + clipCount + "</div>\n" : "");
			} catch(err) {}
		    
		    try {
                var scrollIndex = thisClip.index - 3;
                if(scrollIndex == thisPlaylist.length - 3)
                {
			        scroll.seekTo(0);
			    }
			    else
			    {
			        scroll.seekTo(scrollIndex);
			    }
			    scrollIndex = null;
			} catch(err) {}

			thisClip = null;
		    thisPlaylist = null;
			clipCount = null;
			captionDiv = null;
			controls = null;
			scroll = null;
		},
		
		onBeforeFinish: function() { //continously loop the playlist
		    if(this.getClip().index == this.getPlaylist().length - 1)
		    {
		        return false;
		    }
		},
		
		onFinish: function() {
            this.getClip() == null;
		}
	},

	// plugins
	plugins: {
	    audio: {
	        url: 'flowplayer-audio.swf'
	        },
	        
	    controls: {
	        url: 'flowplayer-controls.swf', //must be in the same folder as flowplayer itself
	        
	        height:24,
	        zIndex:100,
	        backgroundColor:'#000000',
	        backgroundGradient:'low',
	        
	        timeColor:'#01DAFF',
            durationColor: '#ffffff',
            progressColor: '#015B7A',
            progressGradient: 'medium',
            bufferColor: '#6c9cbc',
            bufferGradient: 'none',
            sliderColor: '#000000',
            sliderGradient: 'none',
            buttonColor: '#889AA4',
            buttonOverColor: '#92B2BD',
            volumeSliderColor: '#000000',
            volumeSliderGradient: 'none',
            timeBgColor: '#555555',
            
	        autoHide:'always',
	        opacity:0.5,
	        hideDelay:2000,
	        
	        play:true,
	        volume:true,
	        mute:true,
	        time:true,
	        stop:true,
	        playlist:true,
	        fullscreen:true,
	        scrubber:true,
	        
	        tooltips: { 
                buttons: false, 
                fullscreen: 'Enter fullscreen mode' 
            } 
	    }
	},
	
	canvas: {
	    backgroundColor:'#000000',
	    backgroundGradient: [0.3, 0],
	    borderRadius:0
	}
}

/* AUDIO PLAYER */
var confAudio = {

    //license key
    key: '#$7d5226efd6271719a21',

    //flowplayer location
	flowplayerurl:'/flash/flowplayer/flowplayer.swf', //required
	
	loop:true, //required
	
	clip: {
		autoPlay: false,
		autoBuffering: false,
		baseUrl: '',
	
		onBegin: function() { //required
		    var thisClip = this.getClip();
		    var thisPlaylist = this.getPlaylist();
			var clipCount = this.getPlaylist().length;
			var captionDiv = $get("PlayerCaptionDiv");
			var controls = this.getControls();
			var scroll = $("div.PlaylistWrapperDiv").scrollable();
			
			try {
			    captionDiv.innerHTML = "<div class=\"ClipTitleDiv\">" + thisClip.title + "</div>" + ((thisClip.author != null && thisClip.author.length > 1) ? "<div class=\"ClipAuthorDiv\">by " + thisClip.author + "</div>": "") + (clipCount > 1 ? "<div class=\"ClipCountDiv\">" + (thisClip.index + 1) + " of " + clipCount + "</div>\n" : "");
			} catch (err) {}
		    
		    try {
                var scrollIndex = thisClip.index - 2;
                if(scrollIndex == thisPlaylist.length - 3)
                {
			        scroll.seekTo(0);
			    }
			    else
			    {
			        scroll.seekTo(scrollIndex);
			    }
			    scrollIndex = null;
			} catch (err) {}

			thisClip = null;
		    thisPlaylist = null;
			clipCount = null;
			captionDiv = null;
			controls = null;
			scroll = null;
		},
		
		onFinish: function() {
            this.getClip() == null;
		}
	},

	// plugins
	plugins: {
	    audio: {
	        url: 'flowplayer-audio.swf'
	        },
	        
	    controls: {
	        url: 'flowplayer-controls.swf', //must be in the same folder as flowplayer itself
	        
	        height:24,
	        zIndex:100,
	        backgroundColor:'#000000',
	        backgroundGradient:'low',
	        
	        timeColor:'#01DAFF',
            durationColor: '#ffffff',
            progressColor: '#015B7A',
            progressGradient: 'medium',
            bufferColor: '#6c9cbc',
            bufferGradient: 'none',
            sliderColor: '#000000',
            sliderGradient: 'none',
            buttonColor: '#889AA4',
            buttonOverColor: '#92B2BD',
            volumeSliderColor: '#000000',
            volumeSliderGradient: 'none',
            timeBgColor: '#555555',
            
	        autoHide:'never',
	        opacity:1,
	        
	        play:true,
	        volume:true,
	        mute:true,
	        time:true,
	        stop:true,
	        playlist:false,
	        fullscreen:false,
	        scrubber:true,
	        
	        tooltips: { 
                buttons: false
            } 
	    }
	},
	
	canvas: {
	    backgroundColor:'#000000',
	    backgroundGradient: [0.3, 0],
	    borderRadius:0
	}
}
