$(document).ready(function(){

	controlsObj = {
					autoHide: 'always' ,
			        sliderColor: '#bab8b9',
			        buttonColor: '#929090',
			        progressGradient: 'medium',
			        progressColor: '#323030',
			        borderRadius: '0px',
			        bufferColor: '#807e7e',
			        tooltipTextColor: '#ffffff',
			        durationColor: '#929090',
			        tooltipColor: '#302E2E',
			        backgroundGradient: [0.6,0.3,0,0,0],
			        volumeSliderGradient: 'none',
			        sliderGradient: 'none',
			        timeBgColor: '#555555',
			        backgroundColor: '#302E2E',
			        volumeSliderColor: '#000000',
			        bufferGradient: 'none',
			        buttonOverColor: '#000000',
			        timeColor: '#dcd9da',
			        height: 24,
			        opacity: 1.0
	};

	if(typeof flowplayerStreamingUrl != 'undefined')
	{
		 pluginsObj = {
                 controls: controlsObj,
                 rtmp: {
                     url: flowplayerRtmpPath,
                     netConnectionUrl: flowplayerStreamingUrl
                 }
         };
		 clipObj = {
					 provider: 'rtmp',
					 url: movie,
			         autoPlay: true, 
			         autoBuffering: true,
			         onStart: function() { 
			         },
			         onBegin: function() {
						playButton.fadeOut("slow");
					 },
			         onResume: function() {
					 	playButton.fadeOut("slow");
			         },
			         onPause: function() {
					 	playButton.fadeIn("slow");
			         },
			         onFinish : function() {
			        	playButton.fadeIn("slow");
			         }
         };
         if ((typeof  flowplayerBwcheckPath != 'undefined') && flowplayerBwcheckPath)
         {
                 pluginsObj.bwcheck = {
                     url: flowplayerBwcheckPath,
                     netConnectionUrl: flowplayerStreamingUrl,
                     bitrates: [ 300, 800, 1500 ],
                     bitrates: [ 800 ],
                     serverType: 'fms',
                     urlPattern: '{2}:{0}-{1}',
                     defaultBitrate: 700,
                     dynamic: true
                 };
                 clipObj.urlResolvers = 'bwcheck';
		}
	}
	else
	{
		pluginsObj = { controls: controlsObj };

		clipObj = {
				 url: movie,
		         autoPlay: true, 
		         autoBuffering: true,
		         onStart: function() { 
		         },
		         onBegin: function() {
					playButton.fadeOut("slow");
				 },
		         onResume: function() {
				 	playButton.fadeOut("slow");
		         },
		         onPause: function() {
				 	playButton.fadeIn("slow");
		         },
		         onFinish : function() {
		        	playButton.fadeIn("slow");
		         }
		};
	}

	if(typeof flowplayerCommercialCode == 'undefined')
	{
		flowplayerCommercialCode = '';
	}
	
	flowplayer ( containerId, 
			{ src: flowplayerPath }, 
			{
				clip: clipObj,
				plugins: pluginsObj,
				key: flowplayerCommercialCode
			} 
	);
});

