var versionFlashDefault = 6;
var flashPage = false;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
	if (navigator.plugins["Shockwave Flash"]) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
			if (isNaN(parseInt(words[i])))
			continue;
			var PluginVersion = words[i]; 
	    }
	flashPage = PluginVersion >= versionFlashDefault;
	}
}
else if (bw.ie) {
	//detection par vbscript
}

function genereFlash(idPlaceHolder, idFlash, urlSrcFlash, width, height, alt, srcImgAlt, idImgAEnlever) {
	var flashObj, paramObj, imgObj;

//alert('genereFlash');	
	if (document.getElementById(idFlash)==null)
	{
	if (flashPage&&(!bw.ie||bw.opera)) {

//alert('not IE');	
	
		if (objHolder = document.getElementById(idPlaceHolder)) {		
		
//alert('objHolder');	
		
			flashObj = document.createElement("object");
			flashObj.setAttribute("id", idFlash);
			flashObj.setAttribute("width", width);
			flashObj.setAttribute("height", height);		
			flashObj.setAttribute("alt", alt);		
			flashObj.setAttribute("type", "application/x-shockwave-flash");
			flashObj.setAttribute("data", urlSrcFlash);		
			paramObj = document.createElement("param");
			paramObj.setAttribute("name", "movie");
			paramObj.setAttribute("value", urlSrcFlash);
			flashObj.appendChild(paramObj);
			paramObj = document.createElement("param");
			paramObj.setAttribute("name", "quality");
			paramObj.setAttribute("value", "high");
			paramObj = document.createElement("param");
			flashObj.appendChild(paramObj);
			paramObj.setAttribute("name", "wmode");
			paramObj.setAttribute("value", "transparent");
			flashObj.appendChild(paramObj);						
			objHolder.appendChild(flashObj);		
			if (idImgAEnlever) {
				var imgAObj = document.getElementById(idImgAEnlever);
				if (imgAObj) {
					imgAObj.style.display="none";
				}	
			}			
			flashObj = null;
			paramObj = null;
			imgObj = null;
		} else {
			return false;
		}	
	} else {

//alert('IE');	

		if (flashPage&&bw.bw) {
		
//alert('flashPage');	
			if (objHolder = document.getElementById(idPlaceHolder)) {
//alert('objHolder');	

				var srcFlash = "";
				srcFlash = '<object id="' + idFlash + 
							'" width="'   + width   + 
							'" height="'  + height  + 
							'" alt="' + alt +
							'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">' +
							'<param name="movie" value="' + urlSrcFlash + '" />' + 
							'<param name="" value="" />' + 
							'<param name="quality" value="high" />' + 
							'<param name="wmode" value="transparent" />' +
							'<param name="scale" value="exactfit" />' +
							'<embed width="' + width + '" height="' + height + '" src="' + urlSrcFlash + '" quality="high" wmode="transparent" scale="exactfit" type="application/x-shockwave-flash"></embed>' +
							'</object>';																								
				objHolder.innerHTML = objHolder.innerHTML + srcFlash;
				//alert(idImgAEnlever);
				if (idImgAEnlever) {
					var imgAObj = document.getElementById(idImgAEnlever);
					//alert("allo");
					if (imgAObj) {
						imgAObj.style.display="none";
					}	
				}	
				return true;
			} else {
				return false;
			}
		}				
	}	
	}
}

function disableFlash(idFlash, idImg) {
	var objFlash, objImg;
	objFlash = document.getElementById(idFlash);
	objImg = document.getElementById(idImg);
	if (objFlash) objFlash.style.display='none';
	if (objImg) objImg.style.display='block';
}

function enableFlash(idFlash, idImg) {
	var objFlash, objImg;
	objFlash = document.getElementById(idFlash);
	objImg = document.getElementById(idImg);
	if (objFlash) objFlash.style.display='block';
	if (objImg) objImg.style.display='none';
}


