window.addEvent('domready', function()
{
	if(typeof(form) == 'object')
	{
		form.changeRadio();
		/*
		new iMask({
			onValid: Class.empty, //function(event, obj) {obj.setStyles({"background-color":"#ffffff", "border":"1px solid #800000"})},
			onInvalid:Class.empty // function(event, obj) {obj.setStyles({"background-color":"#fcc", "border":"1px solid #c00"})}
		});
		var exValidatorB = new fValidator("form_tx_txtracafluide_",
		{
			styleNeutral: {"background-color": "#ffffff", "border-color": "#777777"},
			styleInvalid: {"background-color": "#fcc", "border-color": "#c00"},
			styleValid: {"background-color": "#ffffff", "border-color": "#800000"},
			required: {type: "required", re: /[^.*]/, msg: "Ce champ est requis."},
			alpha: {type: "alpha", re: /^[a-z ._-]+$/i, msg: "This field accepts alphabetic characters only."},
			alphanum: {type: "alphanum", re: /^[a-z0-9 ._-]+$/i, msg: "This field accepts alphanumeric characters only."},
			integer: {type: "integer", re: /^[-+]?\d+$/, msg: "Please enter a valid integer."},
			real: {type: "real", re: /^[-+]?\d*\.?\d+$/, msg: "Please enter a valid number."},
			date: {type: "date", re: /^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$/, msg: "Please enter a valid date (mm/dd/yyyy)."},
			email: {type: "email", re: /^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i, msg: "Merci de saisir un email valide."},
			phone: {type: "phone", re: /(\d{2}\-?){5}/, msg: "Merci de saisir un numéro valide."},
			url: {type: "url", msg: "Merci de saisir une url valide."},
			confirm: {type: "confirm", msg: "Les mots de passe ne sont pas identiques."}
		});
		*/
		
		var helpT = {
			init:function()
			{
				this.t = new Element('span',{'class':'helpInfos'}).injectAfter($('container'));
				this.tt = new Element('span',{'class':'helpInfosT'}).injectInside(this.t);
				this.tc = new Element('span',{'class':'helpInfosC'}).injectInside(this.t);
				this.tb = new Element('span',{'class':'helpInfosB'}).injectInside(this.t);
				this.t.setStyles({'display':'none'});
				this.t.addEvent('click', 
					function(e){
						this.setStyle('display','none');
					} 
				);
			},
			help:function(el, texte)
			{
				this.tc.innerHTML = texte;
				this.t.setStyle('display','block');
				this.GetThePos(el);
			},
			GetThePos:function(el)
			{
				var c = el.getCoordinates();
				
				this.t.setStyle('top',c.top - this.t.getSize().size.y);
				this.t.setStyle('left',c.left-59);
			}
		};
		helpT.init();
		$$('a.help').each(function(el,index)
		{
			el.addEvent('click',function(e) 
			{
				var e = new Event(e);
				e.stop();
				helpT.help(this,this.getAttribute('title'));
			});
		});
	}
	if($('loginBox') && $('helpLoginbox'))
	{
		var loginForm = $$('#loginBox form')[0];
		loginForm.onkeydown = function(event){
			var event = new Event(event);
			if(event.key == "enter")
			{
				event.stop();
				this.submit();
			}
		};
		var fadeLogin = $('helpLoginbox').effect('opacity', {duration: 500, transition: Fx.Transitions.linear});
		var posLogin = $('helpLoginbox').effect('top', {duration: 500, transition: Fx.Transitions.linear});
		
		$('showLoginBox').addEvent('click',function(e)
		{
			var e = new Event(e).stop();
			this.setStyle('display','none');
			$('helpLoginbox').setStyles({'display':'block','opacity':0});
			fadeLogin.start(0,1);
			posLogin.start(-10,0);
		});
		$$('.helpTop a')[0].addEvent('click', function(e)
		{
			var e = new Event(e).stop();
			$('showLoginBox').setStyle('display','block');
			fadeLogin.start(0);
			posLogin.start(-10);
		});
	}
	//form.changeSelect();
	//var mainPath = '';
	var mainPath = 'fileadmin/templates/';
	// AJOUT D'UN SWF : 
	var flashvars = {
		mainXML:mainPath+"flash/phrases_header.xml",
		mainurl:mainPath+"flash/"
	};
	var params = {
		menu:"false",
		wmode:"transparent",
		scaleMode:"noScale"
	};
	var attributes = {
		id: "anim",
		name: "anim"
	};
	swfobject.embedSWF(mainPath+"flash/header.swf","animGoesHere", "100%", "89", "8", mainPath+"flash/expressInstall.swf", flashvars, params, attributes);
	if($('animAccueil'))
	{
	var flashvars = {
		mainurl:mainPath+"flash/",
		mainXML:'index.php?type=200', //mainPath+"flash/accueil.xml",
		actusXML:'index.php?type=101', //mainPath+"flash/actus.xml",
		noDebug:true
	};
	var params = {
		menu:"false",
		wmode:"transparent",
		scaleMode:"noScale"
	};
	var attributes = {
		id: "animAc",
		name: "animAc"
	};
	swfobject.embedSWF(mainPath+"flash/accueil.swf","animAccueil", "960", "460", "8", mainPath+"flash/expressInstall.swf", flashvars, params, attributes);
	}
	/* SUCKERFISH MENU */
	if(window.ie6)
	{
		//Suckerfish Alternative for IE, using MOOTOOLS.
		$$('#menu li', '#header #menu').each(function(el, index)
		{
			el.addEvents(
			{
				'mouseenter':function(e)
				{
					this.addClass('over');
				},
				'mouseleave':function(e)
				{
					this.removeClass('over');
				}
			});
		});
	}
	if($('menu') && $('menu').getParent().id == "header")
	{
		var hov = new Element('span', {'id':'menuhover'}).injectTop($('menu'));
		hov.setStyle('opacity', 0);
		hov.fx = hov.effect('opacity', {duration: 800, transition: Fx.Transitions.Quint.easeOut, wait:false});
		var ul = $('menu').getChildren()[1];
		$('menu').addEvents(
		{
			mouseenter:function(e)
			{
				var e = new Event(e);
				hov.fx.start(1);
				e.stop();
			},
			mouseleave:function(e)
			{
				var e = new Event(e);
				hov.fx.start(0);
				e.stop();
			}
		});	
	}
	if($('sitemap'))
	{
		var sm = $('sitemap');
		var bt = new Element('a',
		{
			id:'toggleSitemap',href:"#",
			events:{
				'click':function(e)
				{
					var e = new Event(e);
					e.stop();
					sms.toggle();
				}
			}
		}).setText('Voir le plan du site').injectBefore(sm);
		var sms = new Fx.Slide(sm);
		sms.hide();
	}
	if($('loginBox'))
	{
		var boxes = $$('#loginBox label');
		/*
		boxes.each(function(el, index){
			var input = el.getFirst();
			var sp = new Element('span', {'class':'labelOver'}).injectTop(el);
			sp.setStyle('opacity', 0);
			input.fx = {
				'bg':sp.effect('opacity', {duration: 500, transition: Fx.Transitions.Quint.easeOut, wait:false}),
				'text':input.effect('color', {duration: 500, transition: Fx.Transitions.Quint.easeOut, wait:false})
			};
			input.addEvents(
			{
				focus:function(e)
				{
					var e = new Event(e);
					e.stop();
					this.fx.bg.start(1);
					this.fx.text.start('#000000');
				},
				blur:function(e)
				{
					var e = new Event(e);
					e.stop();
					this.fx.bg.start(0);
					this.fx.text.start('#9b9b9b');
				}
			});
		});
			*/
	}
});

