/*
   ___                                                           _____ 
  |_  |                                                         |  _  |
    | |  __ _  _ __ ___    __ _  _ __    __ _  _ __ ___    __ _ | | | |
    | | / _` || '_ ` _ \  / _` || '_ \  / _` || '_ ` _ \  / _` || | | |
/\__/ /| (_| || | | | | || (_| || |_) || (_| || | | | | || (_| |\ \/' /
\____/  \__,_||_| |_| |_| \__,_|| .__/  \__,_||_| |_| |_| \__,_| \_/\_\
                                | |                                    
                                |_|                                    
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|b|y| |v|i|r|t|u|a|l|g|a|d|j|o|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/

	var clign = new Class({
		Implements: Chain,
		initialize: function(){
			this.chain.apply(this, arguments);
		}
	});

window.addEvent('domready', function(){

	//faire clignoter les phares
	var lum = $$('h1 img')[0];
	lum.setStyle('display', 'none');

	var phares = function(){
		var clignote = new clign (
			function(){ lum.setStyle('display', 'block'); }.delay(200),
			(function(){ lum.setStyle('display', 'none'); }).delay(400),
			(function(){ lum.setStyle('display', 'block'); }).delay(600),
			(function(){ lum.setStyle('display', 'none'); }).delay(800)
		);
	}
	var clignID = phares.periodical(5000);
	//ends faire clignoter les phares

	if ( $$('.accPart').length > 1 ){
		$$('h2').setStyle('cursor', 'pointer');
		var dateAcc = new Fx.Accordion($$('h2'), $$('.accPart'), { opacity: false });
	}

	if ( $$('.citation').length > 0 ) {
		$$('h1').addEvents({
			'mouseenter' : function(e){
				$$('.citation').getRandom().setStyles({
					'top'    : 12,
					'left'   : 363
				});
			},
			'mouseleave' : function(){
				$$('.citation').set('styles', {
					left: '-10000px'
				});
			}
		});
	}

	if ( $$('.cbox').length > 0 ){
		var cbox = new CeraBox();
		cbox.addItems('.mp3blah a.cbox', {
			displayTitle: false
		});
	}

	if ( $$('.zicImg').length > 0 ){
		var mbox = new CeraBox();
		mbox.addItems('.zicImg', {
			displayTitle: false
		});
	}

	if ( $$('.galvign').length > 0 ){
		var galbox = new CeraBox();
		galbox.addItems('a.galvign');
	}

	if ( $$('.videoLink').length > 0 ){
			var viBox = new CeraBox();
			viBox.addItems('.videoLink', {
			group: false,
			width: 700,
			height: 524
		});
	}

	if($$('.unMp3').length > 0){
		var mp3cont = $$('.unMp3');
		var mp3s    = $$('.mp3link');

		mp3s.each(function(el, i){
			ziMp3 = el.getProperty('href');
			//alert (ziMp3);
			var flashvars = {};
			var params    = {
				wmode : 'transparent',
				FlashVars : "mp3="+ ziMp3 + "&showstop=1&bgcolor1=990000&bgcolor2=770000&buttoncolor=ffffff&buttonovercolor=0&slidercolor1=ffffe0c&slidercolor2=999999&sliderovercolor=ffffe0&textcolor=0&showvolume=1"
			};
			var attributes = {
				id  : "zimp3_" + i,
				name: "zimp3_" + i
			};
			swfobject.embedSWF("/assets/flash/player_mp3_maxi.swf", '_'+[i], "200", "30", "9", "/assets/flash/expressInstall.swf", flashvars, params, attributes);
		});
	}

});
