var streamingVideo = function(playerID,videoFile,posterFile,videoHeight,videoWidth,description,featureSlider,autoPlayOption) {

	var playerContainer = '<a href="/video/' + videoFile + '-250.mp4" style="display: block; width: ' + videoWidth + 'px; height: ' + videoHeight + 'px;" id="' + playerID + '">'
					    + '<img src="/images/videoposters/' + posterFile + '" alt="' + description + '" width="' + videoWidth + '" height="' + videoHeight + '" border="0" />'
						+ '</a>';
	document.write(playerContainer);
	
	flowplayer(playerID, "/assets/scripts/flowplayer/flowplayer.commercial-3.2.4-cinema.swf",  {
		onError: function() {
			alert(errorCode);
		},
		canvas: {
			backgroundGradient: 'none',
			backgroundColor: '#000'
		},
		clip: {
			urlResolvers: 'bwcheck',
			provider: 'rtmp',
			autoPlay: true,
			autoBuffering: true,
			bufferLength: 1,
			scaling: 'fit',
			bitrates: [
				{ url: "mp4:" + videoFile + "-3000", width: videoWidth, height: videoHeight, bitrate: 3000 },
				{ url: "mp4:" + videoFile + "-1500", width: videoWidth, height: videoHeight, bitrate: 1500 },
				{ url: "mp4:" + videoFile + "-750", width: videoWidth, height: videoHeight, bitrate: 750 },
				{ url: "mp4:" + videoFile + "-250", width: videoWidth, height: videoHeight, bitrate: 250 }
			],
			onBeforeBegin: function() {
				if(featureSlider) {
					pauseFeature();
					//$f().getClip(0).update({bufferLength:0});
				}
			},
			onFinish: function() {
				this.unload();
				if(featureSlider) {
					startFeature();
				}
			}
		},
		
		plugins: {
			rtmp: {
				url: '/assets/scripts/flowplayer/flowplayer.rtmp-3.2.2.swf',
				netConnectionUrl: 'rtmp://cinestream.usc.edu:80/vod'
			},
			
			bwcheck: {  
				url: '/assets/scripts/flowplayer/flowplayer.bwcheck-3.2.3.swf', 
				serverType: 'fms',
				rememberBitrate: true,
				checkOnStart: true,
				dynamic: false,
				netConnectionUrl: 'rtmp://cinestream.usc.edu:80/vod'
			}				
		}
		
	});
	
	if(autoPlayOption) { 
		flowplayer(playerID).play();
	}
					
}




var progressiveVideo = function(playerID,videoFile,posterFile,videoHeight,videoWidth,description,autoPlayOption) {

	var playerContainer = '<a href="/video/' + videoFile + '" style="display: block; width: ' + videoWidth + 'px; height: ' + videoHeight + 'px;" id="' + playerID + '">'
						+ '<img src="/images/videoposters/' + posterFile + '" alt="' + description + '" width="' + videoWidth + '" height="' + videoHeight + '" border="0" />'
						+ '</a>';
	document.write(playerContainer);
	
	flowplayer(playerID, "/assets/scripts/flowplayer/flowplayer.commercial-3.2.5-cinema-progressive.swf",  {
		onError: function() {
			alert(errorCode);
		},
		canvas: {
			backgroundGradient: 'none',
			backgroundColor: '#000'
		},
		clip: {
			//url: '/video/#filename#.#fileextension#',
			autoPlay: true,
			autoBuffering: true,
			bufferLength: 1,
			scaling: 'fit',
			onFinish: function() {
				this.unload();
			}
		},
		
	});
	
	if(autoPlayOption) { 
		flowplayer(playerID).play();
	}
					
}


