﻿var texteReplay;	
var idVideo;
var titreVideo;


function getFlowPlayer(urlVideo,urlImage,id,titre){		
		
	    //Variables qui pourront être utilisées par d'autres fonctions
	    idVideo = id;
		titreVideo = titre;	
		//Traitement nécessaire des & et ' pour affichage adéquat avec le plugin content
		titreEmbed = titre.replace(/&/g, "%26#39;");
		titreEmbed = titreEmbed.replace(/\'/g, "%26#39;");	
		
		if(langue == "fr")
		{
		   texteReplay = "Revoir";
		   lienVideoUnique = "http://www.francofolies.com/multimedia-fr/video.aspx?id=";
		}
		else 
		{
		   texteReplay = "Play again";
		   lienVideoUnique = "http://www.francofolies.com/multimedia-en/video.aspx?id=";
		}
		
		var keys = {            
            'francofolies.com' : '#@1d3931685ba0f01cdf6',           
            'francofolies.ca' : '#@97f90e46c494623470d'
        };
        
        var leDomain = (location.host).replace("www.","");
       
			  				
		flowplayer("player", {src: '/js/flowplayer/flowplayer.commercial-3.1.5.swf', wmode: 'transparent'}, { 
		
		    key: keys[leDomain] || '',  
            
            play: { 
            
                // label text; by default there is no text 
                label: null, 
 
                // label text at end of video clip 
                replayLabel:texteReplay 
            },
            
            
            //Ce qui est commun à tous les clips           
            clip: { 
                     autoPlay: true,
                     url: urlVideo
            }, 
             
            
            //Liste des clips, on peut overwriter les propriétés décrites dans clip
            playlist: [
	                   //Le premier clip est l'image du vidéo 
                       {    url: urlImage,scaling: 'fit'    }, 
                       //Le deuxième clip est le vidéo lui-même
                       {    url: urlVideo,
                            autoPlay: false,
                            onStart: function() { 
                                    //alert("on compte click "+ idVideo);      
                                    compteurVideo.clickVideo(idVideo);                                     
                                    }                        
                       }                    
                          
            ],
            
           canvas:  { 
                // configure background properties 
                background: '#000000', 
 
                // remove default canvas gradient 
                backgroundGradient: 'none'
                 
            },

            plugins:{
                     controls: {
								  backgroundGradient: [0.6,0.3,0,0,0],
								  tooltipColor: '#5F747C',
								  sliderColor: '#000000',
								  volumeSliderColor: '#000000',
								  tooltipTextColor: '#ffffff',
								  backgroundColor: '#575757',
								  borderRadius: '0px',
								  bufferColor:'#232323',
                                  bufferGradient: 'low',								 
								  timeColor: '#ffffff',
								  timeBgColor: '#555555',
								  progressColor: '#6a7275',
								  buttonOverColor: '#728B94',
								  buttonColor: '#6a7275',
								  volumeSliderGradient: 'none',
								  progressGradient: 'low',								 
								  durationColor: '#ffffff',
								  sliderGradient: 'none',
								  height: 24,
								  opacity: 1.0,                      
								  playlist: false        
						},
						content: {

		                        // location of the plugin
		                        url: 'flowplayer.content-3.2.0.swf',

		                        // display properties
		                        top: 5,		            

		                        // styling properties
		                        border: "2px solid #ffffff",
		                        borderRadius: 10,		            
		                        display:"block",		            
		                        backgroundGradient: [0.1, 0.2, 0.5],
            		            
		                        // "inline" styling 
		                        style: {
			                        '.titre' : {
				                        fontSize: 14,
				                        fontFamily: 'Arial,verdana,helvetica',
				                        color:'#ffffff',
				                        fontWeight:'bold'
			                        }
		                        },

		                       closeButton: true,
            		          		           
		                       html: '<p class="titre"><a href="'+lienVideoUnique+idVideo+'" target="_blank" ><img src="http://www.francofolies.com/images/multimedia/titreFrancosMontrealTV_small.png" align="middle"/>' + titreEmbed + '</a></p>'
                       		            
	                }//fin de content
		        

	        },//fin de plugin
			
			onLoad: function() {
		        this.getPlugin('content').hide(); 
	        }
					
			     
        });//fin de flowplayer 	
        
        
}//fin getFlowPlayer()		
		
		

