document.observe('dom:loaded', function(){
	$$('.dailymotion').each(function(o) {
		var myurl = o.innerHTML;
		o.update('Chargement de la vidéo dailymotion ...');
		var mycode = myurl.substring(myurl.lastIndexOf('/')+1);
		mycode = mycode.substring(0,mycode.indexOf('_'));
		mycode = '<div><object width="420" height="339"><param name="movie" value="http://www.dailymotion.com/swf/' + mycode + '" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://www.dailymotion.com/swf/' +  mycode + '" type="application/x-shockwave-flash" width="420" height="339" allowFullScreen="true" allowScriptAccess="always"></embed></object></div>';
		o.update(mycode);
	});
	
	$$('.deezer').each(function(o) {
		var myurl = o.innerHTML;
		o.update('Chargement de la musique ...');
		var mycode = myurl.substring(myurl.lastIndexOf('/')+1);
		mycode = '<div style="width:220px;height:55px;"><object width="220" height="55"><param name="movie" value="http://www.deezer.com/embedded/small-widget-v2.swf?autoplay=0&idSong=' + mycode + '"></param><embed src="http://www.deezer.com/embedded/small-widget-v2.swf?autoplay=0&idSong=' + mycode + '" type="application/x-shockwave-flash" width="220" height="55"></embed></object></div>';
		o.update(mycode);
	});
	
	$$('.youtube').each(function(o) {
		var myurl = o.innerHTML;
		o.update('Chargement de la vidéo youtube ...');
		var mycode = myurl.substring(myurl.lastIndexOf('v=')+2);
		if(mycode.indexOf('&') > -1) mycode = mycode.substring(0,mycode.indexOf('&'));
		mycode = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/' + mycode + '&hl=fr&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + mycode + '&hl=fr&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';
		o.update(mycode);
	});
});
