/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  TIPS
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
var BulleTips = new Class({
	//=====================================================================================================
	options: {

	},
	//=====================================================================================================
	initialize: function(){
		this.bulle = new Element('div',{'id':'bulle','style':'display:none'});
		this.bulle.injectInside($E('body'));
		this.bulleFl = new Element('div',{'id':'bulle-tips-fleche'});
		this.bulleFl.injectInside(this.bulle);
		this.bulleCont = new Element('div',{'id':'bulle-tips-cont'});
		this.bulleCont.injectInside(this.bulle);
		this.header = new Element('h1',{'id':'bulle-tips-header'});
		this.header.injectInside(this.bulleCont);
		this.text = new Element('p',{'id':'bulle-tips-text'});
		this.text.injectInside(this.bulleCont);
		this.fx = new Fx.Style(this.bulle, 'opacity', {duration: 100, wait: false}).set(0);
		this.activation = true;
	},											
	//=====================================================================================================
	affiche: function(tx){
		if (this.activation){
			var reg=new RegExp("::", "g");
			var tab = tx.split(reg);
			var titre = tab[0];
			var texte = tab[1];
			this.header.set('html',titre);
			this.text.set('html',texte);
			this.bulle.setStyle('display','block');
			this.func = this.move.bindWithEvent(this);
			$(document.body).addEvent('mousemove',this.func);
			this.fx.start(1);
		}
	},
	//=====================================================================================================
	close: function(){
		$(document.body).removeEvent('mousemove',this.func);
		this.fx.start(0);
	},	
	//=====================================================================================================
	suspend: function(){
		this.close();
		this.activation = false;
	},
	//=====================================================================================================
	active: function(){
		this.activation = true;
	},
	//=====================================================================================================
	move: function(e){
		e.stop();
		var size = this.bulle.getSize();
		var Wsize = $(window).getSize();
		var scroll = Wsize.scroll;
		var X = e.client.x-(size.x-50);
		//
		X=(X>0)?X:0;
		X=((X+size.x)>Wsize.x)?Wsize.x-size.x:X;
		//
		//var Xfleche = (size.size.x/2)-(this.bulleFl.getSize().size.x/2);
		//Xfleche =(e.client.x>Xfleche)?Xfleche:(e.client.x-(this.bulleFl.getSize().size.x/2));
		//Xfleche =(e.client.x>Wsize.size.x-Xfleche)?(size.size.x-(Wsize.size.x-e.client.x))-(this.bulleFl.getSize().size.x/2):Xfleche;
		this.bulle.setStyle('left',X);
		//this.bulleFl.setStyle('left',Xfleche);
		this.bulle.setStyle('top',(e.client.y+scroll.y+5));
	},
	//===============================================================================================
});
BulleTips.implement(new Options);
//*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var TIPS ;

function message(e){
	var mc = e.target;
	TIPS.affiche( '');
	}
function messageOut(e){
	TIPS.close( );
	}

function initTip(){
	$$('.item').each(function(mc){
		mc.removeEvent('mouseenter',message);
		mc.removeEvent('mouseleave',message);
		mc.addEvent('mouseenter',message);
		mc.addEvent('mouseleave',messageOut);
	});
}
/////////////////////////
var MOVE =false;
var AGENDASIZE, AGENDACONTSIZE;
var SLIDE,timeIDup,timeIDdown;

function moveUp(){
	clearTimeout(timeIDdown);
	var y = $('agenda').getStyle('top').toInt()-10;
	if (y > -(AGENDASIZE-AGENDACONTSIZE)){
		$('agenda').setStyle('top', y);
		if (MOVE) timeIDup = setTimeout("moveUp()",20);
	}else{
		$('agenda').setStyle('top',  -(AGENDASIZE-AGENDACONTSIZE));
	}
}

function moveDown(){
	clearTimeout(timeIDup);
	var y = $('agenda').getStyle('top').toInt()+10;
	if (y < 0){
		$('agenda').setStyle('top', y);
		if (MOVE) timeIDdown = setTimeout("moveDown()",20);
	}else{
		$('agenda').setStyle('top',  0);
	}
}
/////////////////////////
function slideToggle(slide,mc){
	slide.toggle();
	mc.innerHTML=(mc.innerHTML=="+ horaires")?"- horaires":"+ horaires";
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function init(){
if (Browser.Engine.trident){
		var dim =(window.getSize().x - $('page').getSize().x);
		$('bkg-top').setStyle('width',dim);		
		$('bkg-fixe').setStyle('width',dim);		
	}

//TIPS = new BulleTips();
//initTip();


SLIDE=[];
//
AGENDACONTSIZE = $('agenda-cont').getSize().y;
AGENDASIZE = $('agenda').getSize().y;
$('agenda').setStyle('top', 0);
$$('#agenda-bt-up').addEvent('mouseover',function(){MOVE =true;moveUp();});
$$('#agenda-bt-up').addEvent('mouseout',function(){MOVE =false;clearTimeout(timeIDup);});
$$('#agenda-bt-down').addEvent('mouseover',function(){MOVE =true;moveDown();});
$$('#agenda-bt-down').addEvent('mouseout',function(){MOVE =false;clearTimeout(timeIDdown);});
//*
//SLIDE =========================================================================================
	$$('.slide').each(function(mc){SLIDE[mc.getProperty('id')] = new Fx.Slide(mc);SLIDE[mc.getProperty('id')].hide();});
//*
//MENU =========================================================================================
	var NAVSLIDE = new Fx.Tween($('navigation-niveau-1'));
	var sousNav = $$('.sous-nav');
	if ($$('.nav-sel')[0]){$$('.nav-sel')[0].inject(sousNav[sousNav.length-1], 'after');}
	
	$$('.sous-nav').each(function(mc){
		mc.addEvent('mouseenter',function(e){
			var cible = $('bt-nav-'+mc.getProperty('id').substring(7));
			cible.addClass('over');
			$$('.sous-nav').each(function(m){m.setStyle('z-index','5');});
			mc.setStyle('z-index','10');
			mc.setStyle('display','block');
		});
		mc.addEvent('mouseleave',function(e){
				if (!mc.hasClass('nav-sel'))
				mc.setStyle('display','none');
				var cible = $('bt-nav-'+mc.getProperty('id').substring(7));
				cible.removeClass('over');
				if (Browser.Engine.trident){
					var h = $$('.nav-sel')[0].getStyle('height').toInt()-12;
				}else{
					var h = $$('.nav-sel')[0].getStyle('height');
				}
				NAVSLIDE.start('height',h);
				});
	});
	//
	$$('.bt-nav').each(function(mc){
		if (!$('nav-id-'+mc.getProperty('id').substring(7)).hasClass('nav-sel')){
			mc.addEvent('mouseenter',function(e){
				var cible = $('nav-id-'+e.target.getProperty('id').substring(7));
				$$('.sous-nav').each(function(m){m.setStyle('z-index','5');});
				cible.setStyle('z-index','10');
				cible.setStyle('display','block');
				//$('navigation-niveau-1').setStyle('height',cible.getStyle('height'));
				if (Browser.Engine.trident){
					var h = cible.getStyle('height').toInt()-12;
				}else{
					var h = cible.getStyle('height');
				}
				NAVSLIDE.start('height',h);
				});
			mc.addEvent('mouseleave',function(e){
				var cible = $('nav-id-'+e.target.getProperty('id').substring(7));
				cible.setStyle('display','none');
				//$('navigation-niveau-1').setStyle('height','35px');
				});
		}
	});
//*/
if (Browser.Engine.trident){
					var h = "500";
				}else{
					var h =  "510";
				}

var so = new Swiff('img/logo.swf', {container:'cont-logo',width: h,height: 100,params: {bgcolor: '#FFFFFF'}});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
window.addEvent('domready',init);



