var EventsVideo = Class.create({
	
	initialize: function () {
		new Roll( $('seeAllEventsVideo') );
		$$('#eventsVideoMain .sendToFriend').each(function(o){ new Roll(o); });
		$$('#eventsVideoItems .play').each(function(o){
			Event.observe(o,'click',this._setVideo.bind(this,o));
		}.bind(this));
		$$('#eventsVideoItems .playImg').each(function(o){
			Event.observe(o,'click',this._setVideo.bind(this,o));
		}.bind(this));
		new Aheuh.IE6Hack().pngFix(ulSite+'/Site/includes/images/pix.gif');
		Element.setStyle($('envoyerAmiVideo'),{ display:'none', top:'400px', left:'500px' });
	},
	
	_setVideo:function (o) {
		var str = '';
		if (o.rel.indexOf('http://www.youtube.com')!=-1) {
			if (navigator.IE6) {
				str = '<embed src="'+o.rel+'&amp;autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="527" height="437"></embed>';
			}
			else {
				str = '<object width="527" height="437">' +
						  '<param name="movie" value="'+o.rel+'&amp;autoplay=1"></param>' +
						  '<param name="allowFullScreen" value="true"></param>' +
						  '<param name="allowscriptaccess" value="always"></param>' +
						  '<param name="wmode" value="transparent"></param>' +
						  '<embed src="'+o.rel+'&amp;autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" allowfullscreen="true" width="527" height="437"></embed>' +
					  '</object>';
			}
		}
		else if (o.rel.indexOf('http://www.dailymotion.com')!=-1) {
			if (navigator.IE6) {
				str = '<embed src="'+o.rel+'&autoPlay=1" type="application/x-shockwave-flash" width="527" height="437" allowFullScreen="true" allowScriptAccess="always"></embed>';	
			}
			else {
				str = '<object width="527" height="437">' +
							'<param name="movie" value="'+o.rel+'&autoPlay=1"></param>' +
							'<param name="allowFullScreen" value="true"></param>' +
							'<param name="wmode" value="transparent"></param>' +
							'<param name="allowScriptAccess" value="always"></param>' +
							'<embed src="'+o.rel+'&autoPlay=1" type="application/x-shockwave-flash" width="527" height="437"  wmode="transparent" allowFullScreen="true" allowScriptAccess="always"></embed>' +
					  '</object>';
			}
		}
		$('videoFlash').innerHTML = str;
	}
	
});

onLoadGlobal.add(function(){ new EventsVideo(); });
