﻿$(document).ready(function() {
    
    $(".flowPlayer").html("");
    $(".audioFlowPlayer").html("");
    
    //get video placeholders
        
    $(".flowplayer_ph").replaceWith(function(){
		var width = this.width;
		var height = this.height;
		
		if(width < 250){
			width = 250;
		}
		if(height < 150){
			height = 150;
		}
		//alert("width:" + width + " height:" + height);
		var newElement = '<a href="' + this.alt + '" class="flowPlayer" style="display: block; width:' + this.width + 'px !important; height:' + this.height + 'px; !important" ></a>';
		return newElement;
    });
    
    
    flowplayer(".flowPlayer", "/CoreCode/flash/flowplayer/flowplayer-3.2.7.swf", { 
        
        clip: {
			autoPlay:false,
			autoBuffering:true			
		},
		plugins: {
			controls: {
				url: '/CoreCode/flash/flowplayer/flowplayer.controls-3.2.5.swf',
				volume: false,
				mute:false,
				play:true
			}
		}
     
    });
    
    // install flowplayer into container 
    $f(".audioFlowPlayer", "/CoreCode/flash/flowplayer/flowplayer-3.2.7.swf", {

	// fullscreen button not needed here
	plugins: {
		controls: {
			fullscreen: false,
			height: 22,
			autoHide: false,
			
			buttonColor: 'rgba(0, 0, 0, 0.9)',
			buttonOverColor: '#000000',
			backgroundColor: '#D7D7D7',
			backgroundGradient: 'medium',
			sliderColor: '#FFFFFF',
			
			sliderBorder: '1px solid #808080',
			volumeSliderColor: '#FFFFFF',
			volumeBorder: '1px solid #808080',
			
			timeColor: '#000000',
			durationColor: '#535353'
		}
	},

	clip: {
		autoPlay: false,

		// optional: when playback starts close the first audio playback
		onBeforeBegin: function() {
			$f("player").close();
		}
	}

});
});
