window.addEvent('load', function(){
	if($('PlayerVideo-fr')){
		var fr = new SWFObject("flash/PlayerHome.swf", "homeflash", "471", "264", "9", "#fff");
		fr.addParam("wmode", "transparent");
		fr.addParam("allowFullScreen", "true");
		fr.write("PlayerVideo-fr");
	}

	if($('PlayerVideo-gb')){
		var gb = new SWFObject("flash/PlayerHome.swf", "homeflash", "471", "264", "9", "#fff");
		gb.addParam("wmode", "transparent");
		gb.addParam("allowFullScreen", "true");
		gb.write("PlayerVideo-gb");
	}

	if($('ContentFlash')){
		var fr = new SWFObject("flash/banniere.swf", "homeflash", "100%", "182", "9", "#fff");
		fr.addParam("wmode", "transparent");
		fr.write("ContentFlash");
	}

	if($('ContentFlash-gb')){
		var fr = new SWFObject("flash/banniere-gb.swf", "homeflash", "100%", "182", "9", "#fff");
		fr.addParam("wmode", "transparent");
		fr.write("ContentFlash-gb");
	}

});

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

	//adresse postale
	$('AdressePostale').addEvents({
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			this.set('tween', {
				duration: 500,
				transition: Fx.Transitions.Expo.easeOut  // This could have been also 'bounce:out'
			}).tween('height', '150px');
		},
		'mouseleave': function(){
			// Resets the tween and changes the element back to its original size
			this.set('tween', {}).tween('height', '30px');
		}
	});

	//formulaire de login
	if($('TitreAbonnes')){
		var dTween = new Fx.Tween($('Deroulant'), { duration: 700, link: 'cancel', transition: Fx.Transitions.Expo.easeOut });
		var s = "closed";
		$('TitreAbonnes').addEvents({
			'click': function(){
				if (s == "closed") {
					dTween.start('height', 210);
					s = "opened";
				}
				else {
					dTween.start('height', 40);
					s = "closed";
				}
			}
		});
	}

	//new mooVimageMenu('SlideMenuVerticale', '#SlideMenuVerticale a');
	//create our Accordion instance
	var Tourisme = new Accordion('#Tourisme h2.declencheur', '#Tourisme div.UneBreve',{
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyles({
				'background-image'   : 'url(/img/none.png)',
				'background-repeat'  : 'no-repeat',
				'background-position': '10px 10px',
				'width'              : '732px',
				'padding'            : '5px 0 10px 0',
				'color'              : '#c9d200'
			});
		},
		onBackground: function(toggler, element){
			toggler.setStyles({
				'background-image'   : 'url(/img/PuceFlecheAccorClose.png)',
				'background-repeat'  : 'no-repeat',
				'background-position': '10px 10px',
				'width'              : '692px',
				'padding'            : '5px 0 10px 40px',
				'color'              : '#8D9500'
			});
		}
	});
	var Autoroute = new Accordion('#Autoroute h2.declencheur', '#Autoroute div.UneBreve', {
		opacity: true,
		onActive: function(toggler, element){
			toggler.setStyles({
				'background-image'   : 'url(/img/none.png)',
				'background-repeat'  : 'no-repeat',
				'background-position': '10px 10px',
				'width'              : '732px',
				'padding'            : '5px 0 10px 0',
				'color'              : '#c9d200'
			});
		},
		onBackground: function(toggler, element){
			toggler.setStyles({
				'background-image'   : 'url(/img/PuceFlecheAccorClose.png)',
				'background-repeat'  : 'no-repeat',
				'background-position': '10px 10px',
				'width'              : '692px',
				'padding'            : '5px 0 10px 40px',
				'color'              : '#7D8400'
			});
		}
	});

	var trigger = $$('#SelectCategorie div');
	var tLength = trigger.length;
	var actuContent = $$('.ContentBreve');

	actuContent.setStyle('display', 'none');
	actuContent[0].setStyle('display', 'block');

	trigger[0].removeClass('UneCategorieOff');
	trigger[0].addClass('UneCategorieOn');

	trigger.each(function(el, i){
		el.addEvent('click', function(){
			actuContent.each(function(elem, j){
				i == j ? elem.setStyle('display', 'block') : elem.setStyle('display', 'none');
			});
			trigger.each(function(elem, j){
				if (i == j){
					elem.addClass('UneCategorieOn');
					elem.removeClass('UneCategorieOff');
				}
				else {
					elem.addClass('UneCategorieOff');
					elem.removeClass('UneCategorieOn');
				}
			});
		});
	});
});//ends domready
