function launch(rtmp,link,mp3)
{
		if (rtmp){		
					//document.img_player.style.cssText = "width:329px;height:187px;";
					
					var player = document.getElementById("player");
					player.style.cssText = "width:329px;height:217px;";
						
					// Execute la fonction qui permet la lecture du rtmp
					$f("player", "http://lanotebleue.mc/fileadmin/templates/js/flowplayer-3.2.7.swf", {
					wmode: 'transparent',
					clip: {
						//url: 'http://sensationscotedazur.ice.radiosensations.net/sensationsazur-high.aac?type=.flv',
						url: 'http://lanotebleueradio.ice.infomaniak.ch/lanotebleueradio.aac?type=.flv',
						live: true,
						onStart: function() {
							this.getPlugin('content').getHtml();			
						},
						onMetaData: function(song) {
							var meta = song.metaData;
							
							//for (i in meta) {
  							//	alert(i);
							//}
    							this.getPlugin('c1').setHtml(
    								'<br><br><br><br><br><br><br><br><p class="artist">Artiste: ' + meta.title + '</p>' +
    								'<p class="album">Album:   ' + meta.name + '</p>'
    							);				
						}
					},
					plugins: {
						controls: {
							fullscreen: false,
							height: 30,
							autoHide: false
						},
						c1: {
							url: 'http://lanotebleue.mc/fileadmin/templates/js/flowplayer.content-3.2.0.swf',
							borderRadius: 0,
							backgroundImage: 'url(http://lanotebleue.mc/fileadmin/user_upload/player/player.png)',
							style: {
								'p': {
									marginLeft: 4,
									marginRight: 4
								}
							},
							top: 0,
							left: 0,
							width: 330,
							height: 187
						}
					}
					
				});	
	
		}
		else // MP3 & Videos
		{
			if (mp3){
						
				var player = document.getElementById("player");
				player.style.cssText = "width:329px;height:217px;";
						
				//  install Flowplayer inside a#player
				$f("player", "http://lanotebleue.mc/fileadmin/templates/js/flowplayer-3.2.7.swf", {
						
					 
				wmode: 'transparent',		
				clip: {
				 
					// use baseUrl so we can play with shorter file names
					baseUrl: 'http://lanotebleue.mc',
					url: link,
				 
					// use first frame of the clip as a splash screen
					autoPlay: true,
					autoBuffering: true
				},
				
				plugins: {
					audio: {
						url: 'http://lanotebleue.mc/fileadmin/templates/js/flowplayer.audio-3.2.2.swf'
					},
					controls: {
						fullscreen: false,
						height: 30,
						autoHide: false
					}
				}
				
				});
			}
			else
			{
				//var pict = document.img_player
				//pict.style.cssText = "display:none;";
						
				var player = document.getElementById("player");
				player.style.cssText = "width:329px;height:217px;";
						
				//  install Flowplayer inside a#player
				$f("player", "http://lanotebleue.mc/fileadmin/templates/js/flowplayer-3.2.7.swf", {
						
					 
				wmode: 'transparent',		
				clip: {
				 
					// use baseUrl so we can play with shorter file names
					baseUrl: 'http://lanotebleue.mc',
					url: link,
				 
					// use first frame of the clip as a splash screen
					autoPlay: true,
					autoBuffering: true
				} 
				});
			}
						
				 
				 
						
		}
}

var rtmp = true;
launch(rtmp,0,false);

// Rï¿½cupï¿½re le lien contenu dans le div#video_inner
var links = document.getElementById("headervideo").getElementsByTagName("a");
 
 // Clic sur Retour lecture Radio
	links[0].onclick = function() {
		
		launch(true,0,false);
				
		// by returning false normal link behaviour is skipped
		return false;
	}


// get all links that are inside div#maincontent
var links2 = document.getElementById("maincontent").getElementsByTagName("a");
				 
				// loop those links and alter their click behaviour
				for (var i = 0; i < links2.length; i++) {
					var sizeoflink = links2[i].getAttribute("href", 2).length - 3;
					var linkext = links2[i].getAttribute("href", 2).substring(sizeoflink,sizeoflink + 3);
						
					if (linkext.toLowerCase() == 'flv')
					{
						
						links2[i].onclick = function() {
						
						launch(false,this.getAttribute("href", 2),false);
						
						// play the clip specified in href- attribute with Flowplayer
						//$f().play(this.getAttribute("href", 2));
						
						// by returning false normal link behaviour is skipped
						return false;		
						}
						
					}
					if (linkext.toLowerCase() == 'mp3')
					{
						
						links2[i].onclick = function() {
						
						launch(false,this.getAttribute("href", 2),true);
						
						// play the clip specified in href- attribute with Flowplayer
						//$f().play(this.getAttribute("href", 2));
						
						// by returning false normal link behaviour is skipped
						return false;		
						}
						
					}
				}
