/**
 * Fonction qui permet de mettre les flash en wmode transparent
 * Parse les widgets
 * @author STL
 */

// on document ready
$(function(){
	
	// liste les widgets embed flash
	$('.widget').has('object').each(function(){
		
		var oObject = $(this).children();
		var oEmbed = oObject.children('embed');
		
		//Cache le widget
		$(this).hide();
		
		//S'il n'y a pas de transparence, on la rajoute
		if(!oEmbed.attr('wmode') || oEmbed.attr('wmode') != 'transparent'){
			oEmbed.attr('wmode', 'transparent');
		}
		
		oObject.children('param[name="wmode"]').attr('value','transparent');
		
		if(oObject.children('param[name="wmode"]').length == 0  ){
			oEmbed.before('<param name="wmode" value="transparent" />');
		}
		
		//Réaffiche le widget
		$(this).show();
				
	});
	
	// liste les widgets iframe avec script flash
	$('.widget').has('iframe').each(function(){
		
		var oIframe = $(this).find('iframe');
		var sSrc	= oIframe.attr('src')+'&wmode=transparent';
		
		//Cache le widget
		$(this).hide();		
		
		oIframe.attr('src', sSrc);
		
		//Réaffiche le widget
		$(this).show();
				
	});
	
	

});

