$(document).ready(function() {

	var countVideoPlayers = 0;
	var countAudioPlayers = 0;
	
	var theSplashImage = "";
	
	theSplashImage = $("div.news-single-img a img").attr('src');
	
	$("dl.news-single-files dd a[href$='flv']").each(function(a_flv) {
		countVideoPlayers++;
		$(this).attr("id", "video_player_"+countVideoPlayers);		
		$(this).attr("class", "video_player");		
		$(this).attr("href", "/"+$(this).attr("href"));	
		$(this).html("");
		var newLink = $(this);
		$(this).parent().html(newLink);
		
		flowplayer($(this).attr("id"), "/fileadmin/berater_webseiten/flash/flowplayer-3.1.5.swf",  { 
			clip: { 
				autoPlay: false,  
				autoBuffering: true 
			} 
		});
		
	});
	
	$("dl.news-single-files dd a[href$='mp3']").each(function(a_flv) {
		countAudioPlayers++;
		$(this).attr("id", "audio_player_"+countAudioPlayers);		
		$(this).attr("class", "audio_player");	
		$(this).attr("href", "/"+$(this).attr("href"));		
		$(this).html("");
		var newLink = $(this);
		$(this).parent().html(newLink);	
		
		flowplayer($(this).attr("id"), "/fileadmin/berater_webseiten/flash/flowplayer-3.1.5.swf",  { 
			// fullscreen button not needed here 
			plugins: { 
				controls: { 
					fullscreen: false, 
					height: 30 
				} 
			}, 
			clip: { 
				autoPlay: false, 
				onBeforeBegin: function() { 
					$f("player").close(); 
				} 
			} 
		});		
			
	});
	
});
