function writeSwfVideo(div,swfUrl,urlFlv,id,largeur,hauteur,bgcolor,fullScreen,progressBar,autoplay){
	//if (navigator.appName.toLowerCase().indexOf("netscape")>=0) fullScreen="non";
	swfUrl += "?autoplay="+autoplay+"&urlFlv="+urlFlv+"&showFullscreen="+fullScreen+"&showPB="+progressBar;
	var swfObj = new SWFObject(swfUrl,id,largeur,hauteur,"8",bgcolor,"high");
	
	swfObj.addParam("allowfullscreen","true");
	swfObj.addVariable("urlFlv",urlFlv);
	swfObj.addVariable("showFullscreen",fullScreen);
	swfObj.addVariable("showPB",progressBar);
	swfObj.skipDetect=true;
	swfObj.write(div);
}











var origX=0;
var origY=0;
var isFullScreen=new Object();
var swfDivs = new Object();

function showVideo(swf,xml){
	swfDivs[swf]=xml;
	isFullScreen[swf]=false;
	
	document.getElementById(swf).innerHTML="";
	var swf = document.getElementById(swf);
	var videoSmall = document.createElement("div");
	
	swf.style.position="static";
	swf.style.top="0px";
	swf.style.left="0px";
	swf.style.width=origL+"px";
	swf.style.height=origH+"px";
	
	videoSmall.innerHTML=writeFlash(origL,origH,swfPlayerMini,swfbgColor,urlXml4Swf,urlShare,targetShare,swf);
	swf.appendChild(videoSmall);
}

function isInDiv(divObj,idWanted, tag){
	var ds = divObj.getElementsByTagName(tag);
	for(ii=0;ii<ds.length;ii++){
		if (ds[ii].id==idWanted){
			return true;
		}
	}
	return false;
}

function hideVideos(except){
	var ds = document.getElementsByTagName("DIV");
	for(i=0;i<ds.length;i++){
		//if (ds[i].id.substr(0,5)=="swfV_" && ds[i].id!=except){
		if ((ds[i].className=="pjContrib" || ds[i].className=="commPJ") && !isInDiv(ds[i],except,"DIV")){ //&& ds[i].id!=except){
			ds[i].style.display="none";
			ds[i].style.visibility="hidden";
		}
	}
}

function showVideos(){
	var ds = document.getElementsByTagName("DIV");
	for(i=0;i<ds.length;i++){
		//if (ds[i].id.substr(0,5)=="swfV_"){
		if (ds[i].className=="pjContrib" || ds[i].className=="commPJ"){
			ds[i].style.display="block";
			ds[i].style.visibility="visible";
		}
	}
}

function LaunchFullScreen(swf){
	if(isFullScreen[swf]){
		isFullScreen[swf]=false;
		showVideos();
		showVideo(swf,swfDivs[swf]);
	}else{
		isFullScreen[swf]=true;
		hideVideos(swf);
		document.getElementById(swf).innerHTML="";
		swf_=swf;
		var swf = document.getElementById(swf);
		var video = document.createElement("div");
		
		origX=swf.style.left
		origY=swf.style.left
				
		swf.style.position="absolute";
		swf.style.top="0px";
		swf.style.left="0px";
		
		w="800";
		h="600";
		
		try{
			if (document.documentElement && (document.documentElement.clientWidth||document.documentElement.clientHeight)){
				// IE 6+
				w = document.documentElement.clientWidth;
				h = document.documentElement.clientHeight;
			}else if ( typeof( window.innerWidth ) == 'number' ){
				// Non IE
				w = window.innerWidth;
				h = window.innerHeight;
			}else if(document.body && (document.body.clientWidth||document.body.clientHeight )){
				// Old IE
				w = document.body.clientWidth;
				h = document.body.clientHeight;
			}		
		}catch(e){}
		
		self.location.href="#top";
		
		swf.style.width=w;
		swf.style.height=h;
	
		urlXml4Swf=swfDivs[swf_];
				
		video.innerHTML=writeFlash(w,h,swfPlayerFS,swfbgColor,urlXml4Swf,urlShare,targetShare,swf);
		swf.appendChild(video);
	}
}

function writeFlash(w,h,swf,swfbgColor,urlXml4Swf,urlShare,targetShare,swfDiv){
//	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
//	if(hasRightVersion) {  // si nous avons détecté une version acceptable
	var dat = new Date();
	if (urlXml4Swf.indexOf("?")>0) urlXml4Swf+="&r="+dat.getTime();
	else urlXml4Swf+="?r="+dat.getTime();
	
    	var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		    + 'width="' + w + '" height="' + h + '"'
		    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
		    + '<param name="movie" value="' + swf + '?urlXml=' + urlXml4Swf + '&urlShare=' + escape(urlShare) + '&targetShare=' + escape(targetShare) + '&swfDiv='+escape(swfDiv.id)+'" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="bgcolor" value="' + swfbgColor + '" />' 
			+ '<param name="FLASHVARS" value = "urlXml=' + urlXml4Swf + '&urlShare=' + escape(urlShare) + '&targetShare=' + escape(targetShare) + '&swfDiv='+escape(swfDiv.id)+'">'
		    + '<embed src="' + swf + '" menu="false" quality="high" scale="exactfit" bgcolor="' + swfbgColor + '" '
		    + 'width="' + w + '" height="' + h + '" name="playerVideo" align="middle"'
		    + 'FLASHVARS="urlXml=' + urlXml4Swf + '&urlShare=' + escape(urlShare) + '&targetShare=' + escape(targetShare) + '&swfDiv='+escape(swfDiv.id)+'"'
			+ 'play="true"'
		    + 'loop="false"'
		    + 'quality="high"'
    		+ 'allowScriptAccess="sameDomain"'
   			+ 'type="application/x-shockwave-flash"'
    		+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    		+ '<\/embed>'
    		+ '<\/object>';
/*	}else{
		var oeTags = 'Ce contenu requiert Macromedia Flash Player.'
		   	+ '<a href=http://www.macromedia.com/go/getflash/>Obtenir Flash</a>'; 
	}
*/	return oeTags;
}
