var counter_images = 0;
var scr=null;
var scroolScr1=true;
var scr2=null;
var scroolScr2=true;



var Inserm = new Class({
	
	Implements: [Options, Log],

	options: {
	},

	

	/**
	 * Constructeur
	 */
	initialize: function( params ){

		this.debug = debug; /* Activation du mod débug */
		this.console("info", "Inserm initialized");

		/* Chargé partout */
		this.goToOnChange();
		this.smoothScroll();
	},





/* **************************************************************** Contrôles */

	/**
	 * Contrôle des formulaires de recherche
	 */
	checkSearchForm: function () {
		this.console("info", "function checkSearchFormEvent()");
		new FormCheck('searchFormTop', {
			display : {
				errorsLocation : 3,
				indicateErrors : 2,
				flashTips : true,
				fadeDuration : 1000
			}
		})
		if(document.getElementById('searchFormNew')!=null) {
			new FormCheck('searchFormNew', {
				display : {
					errorsLocation : 3,
					indicateErrors : 2,
					flashTips : true,
					fadeDuration : 1000
				}
			})
		}
		if(document.getElementById('searchFormBasis')!=null) {
			new FormCheck('searchFormBasis', {
				display : {
					errorsLocation : 3,
					indicateErrors : 2,
					flashTips : true,
					fadeDuration : 1000
				}
			})
		}
	},


	/**
	 * Contrôle du formulaire de contact
	 */
	 checkForm: function() {
		if ( $('formCheck') ) {
			this.console("info", "function initcheckForm()");
			new FormCheck('formCheck', {
				display : {
					errorsLocation : 1,
					indicateErrors : 1,
					flashTips : true,
					fadeDuration : 1000
				}
			});
		}
	},


	/**
	 * Ajout d'un DatePicker
	 */
	datePicker: function () {
		this.console("info", "function datePicker()");
		$$('img.DatePicker').each( function(el){
			new DatePicker(el, {
				dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
				monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'],
				startDay: 1,
				format: 'dd/mm/yyyy'
			} );
		});
	},





/* ******************************************************************* Divers */

	/**
	 * Utiliser la value d'un champs select pour changer de page
	 */
	goToOnChange: function () {
		this.console("info", "function goToOnChange()");
		$$('.goToOnChange').each( function( select ){
			select.addEvent('change', function(e){
				if ( select.value != '' ) {
					window.location = select.value;
				}
			});
		});
	},



	/**
	 * Augmente ou réduit la taille de la fonte
	 */
	changeFontSize: function() {
		this.console("info", "function changeFontSize()");

		/* Ajuste la taille du texte */
		var ajustFontSize = function( param ) {
			newSize = this.fontSize + param.toFloat();
			this.fontSize = newSize.round(1).limit(0.5, 2);
			setFontSize(this.fontSize);
		}.bind(this);

		/* Défini la taille du texte */
		var setFontSize = function( param ) {
			document.getElement('body').setStyle('font-size', param + fontUnit);
			Cookie.write('fontsize', param, {duration: false});
			this.console("info", "Font size: " + param + fontUnit );
		}.bind(this);

		/* Taille initiale */
		var initFontSize = function( param ) {
			this.fontSize = this.fontSizeDefault = 1;
			if ( Cookie.read('fontsize') ) {
				this.fontSize = Cookie.read('fontsize').toFloat() || this.fontSizeDefault;
				setFontSize(this.fontSize);
			}
		}.bind(this);

		fontUnit = 'em';
		initFontSize();

		/* Evènement sur les boutons */
		$$('.sizeMore').each( function( btn ){
			btn.addEvent('click', function(e){
				ajustFontSize(+0.1);
			});
		});
		$$('.sizeLess').each( function( btn ){
			btn.addEvent('click', function(e){
				ajustFontSize(-0.1);
			});
		});
		$$('.sizeRAZ').each( function( btn ){
			btn.addEvent('click', function(e){
				this.fontSize = this.fontSizeDefault;
				setFontSize(this.fontSizeDefault);
				Cookie.dispose('fontsize');
			}.bind(this));
		}.bind(this));
	},





/* ******************************************************* Effets Bling-bling */
	/**
	 * Fx.SmoothScroll
	 */
	smoothScroll: function() {
		if ( !Browser.Engine.trident ) {
			this.console("info", "function smoothScroll()");
			new Fx.SmoothScroll();
		}
	},


	/**
	 * Scroll
	 */
	scrollBox: function() {
		this.console("info", "function scrollBox()");

		$$('.scrollBox', 'containerMain').each( function( box ){
		    if ( box.getElement('.toRight') ) {
		    	if(box.getAttribute("id")=="tools") {
				    box.getElement('.toRight').addEvent('click', function(e){
						if (scr!=null) {
							scroolScr1=false;
							scr.pause();
						}
						currentPos=parseInt(box.getElement('.scrolling').getScroll().x);
						elemScroll = (parseInt((currentPos+45)/91 )+1)*91;
						duration=150/91*(elemScroll-currentPos);
						scr=new Fx.Scroll( box.getElement('.scrolling'),{duration:duration,
					    	fps:50,transition: Fx.Transitions.linear,wait: false});
						lenght=(parseInt($('tools').getElements('li').length-5) * 91) ;
						if(elemScroll>lenght) {
							elemScroll=elemScroll-lenght;
							currentPos=currentPos-lenght;
							scr.set(currentPos,0);
						}
						scr.start(elemScroll, 0)
					});
		    	} else if(box.getAttribute("id")=="letters") {
				    box.getElement('.toRight').addEvent('click', function(e){
						if (scr2!=null) {
							scroolScr2=false;
							scr2.pause();
						}
						currentPos=parseInt(box.getElement('.scrolling').getScroll().x);
						elemScroll = (parseInt((currentPos+45)/91 )+1)*91;
						duration=150/91*(elemScroll-currentPos);
						scr2=new Fx.Scroll( box.getElement('.scrolling'),{duration:duration,
					    	fps:50,transition: Fx.Transitions.linear,wait: false});
						lenght=(parseInt($('letters').getElements('li').length-3) * 91) ;
						if(elemScroll>lenght) {
							elemScroll=elemScroll-lenght;
							currentPos=currentPos-lenght;
							scr2.set(currentPos,0);
						}
						scr2.start(elemScroll, 0)
					});
		    	}
		    };
		    if ( box.getElement('.toLeft') ) {
		    	if(box.getAttribute("id")=="tools") {
				    box.getElement('.toLeft').addEvent('click', function(e){
						if (scr!=null) {
							scroolScr1=false;
							scr.pause();
						}
						currentPos=parseInt(box.getElement('.scrolling').getScroll().x);
						elemScroll = (parseInt((currentPos+45)/91 )-1)*91;
						duration=150/91*(currentPos-elemScroll);
						scr=new Fx.Scroll( box.getElement('.scrolling'),{duration:duration,
					    	fps:50,transition: Fx.Transitions.linear,wait: false});
						lenght=(parseInt($('tools').getElements('li').length-5) * 91) ;
						if(elemScroll<0) {
							elemScroll=elemScroll+lenght;
							currentPos=currentPos+lenght;
							scr.set(currentPos,0);
						}
						scr.start(elemScroll, 0)
					});
		    	} else if(box.getAttribute("id")=="letters") {
				    box.getElement('.toLeft').addEvent('click', function(e){
						if (scr2!=null) {
							scroolScr2=false;
							scr2.pause();
						}
						currentPos=parseInt(box.getElement('.scrolling').getScroll().x);
						elemScroll = (parseInt((currentPos+45)/91 )-1)*91;
						duration=150/91*(currentPos-elemScroll);
						scr2=new Fx.Scroll( box.getElement('.scrolling'),{duration:duration,
					    	fps:50,transition: Fx.Transitions.linear,wait: false});
						lenght=(parseInt($('letters').getElements('li').length-3) * 91) ;
						if(elemScroll<0) {
							elemScroll=elemScroll+lenght;
							currentPos=currentPos+lenght;
							scr2.set(currentPos,0);
						}
						scr2.start(elemScroll, 0)
					});
		    	}
		    };
		});
	},
	
	
	scrollBoxStop: function() {
		var my_elems;
		var my_elems2;
		var my_li;
		if ($('tools'))
		{
			my_elems=$('tools').getElements('li');
			this.console("info", "function scrollBoxStop()");
			//ajoute les events qui gerent l arret/redemarrage du defilement
			for( i=0; i < my_elems.length ;i++) {
				if(i<5)
				{
					my_li = my_elems[i].cloneNode(true);
					my_elems[i].parentNode.appendChild(my_li);
				}
			}
			my_elems=$('tools').getElements('li');
			for( i=0; i < my_elems.length ;i++) {
				my_elems[i].addEvent('mouseover', function(e){
					if((scr!=null)&&scroolScr1) scr.pause();
				});
				my_elems[i].addEvent('mouseout', function(e){
					if((scr!=null)&&scroolScr1) scr.resume();
				});
			}
		}
		if ($('letters'))
		{	
			my_elems2=$('letters').getElements('li');
			for( i=0; i < my_elems2.length ;i++) {
				if(i<3)
				{
					my_li = my_elems2[i].cloneNode(true);
					my_elems2[i].parentNode.appendChild(my_li);
				}
			}
			my_elems2=$('letters').getElements('li');
			for( i=0; i < my_elems2.length ;i++) {
				my_elems2[i].addEvent('mouseover', function(e){
					if((scr2!=null)&&scroolScr2) scr2.pause();
				});
				my_elems2[i].addEvent('mouseout', function(e){
					if((scr2!=null)&&scroolScr2) scr2.resume();
				});
			}
		}
	},



	/**
	 * modification de la largeur du bandeau 'Tools' suivant le nombre de vignette
	 */
	lengthTools: function() {

		if ( $('tools') ) {
			this.console("info", "function lengthTools()");
			var lg = (parseInt($('tools').getElements('li').length) * 91) + 6;
			$('tools').getElement('.scrolling-inner').setStyle('width', parseInt(lg));
		}
	},



	/**
	 * modification de la largeur du bandeau 'Letters' suivant le nombre de vignette
	 */
	lengthLetters: function() {
		if ( $('letters') ) {
			this.console("info", "function lengthLetters()");
			var lg = (parseInt($('letters').getElements('li').length) * 91) + 6;
			$('letters').getElement('.scrolling-inner').setStyle('width', parseInt(lg));
		}
	},



	/**
	 * Affichage du menu du haut
	 */
	showRightTop: function () {
		if ( $('showRightTop') ) {
			this.console("info", "function showRightTop()");
			div = $('showRightTop');
			div.addEvent( 'mouseenter', function(e){
				div.addClass('showed');
			});
			div.addEvent( 'mouseleave', function(e){
				div.removeClass('showed');
			});
		}
	},


	showRightMenu: function () {
		if ( $('menuRight') ) {
			div = $('menuRight');
			if ( div.hasClass('showHide') ) {
				var menuEffect = new Fx.Morph(div, {
					duration: 'short',
					transition: Fx.Transitions.Sine.easeOut
				});
				var hide = function () {
                    if (Browser.Engine.trident && Browser.Engine.version <= 4) {
                        div.setStyles({ width: "52px", right: "0px" });
                        div.addClass('hidea');
                    }
                    else {
                        menuEffect.start({ width: "52px", right: "0px" });
                    }
				}
				var show = function () {
                    if (Browser.Engine.trident && Browser.Engine.version <= 4) {
                        div.setStyles({width: "245px", right: "0px" });
                        div.removeClass('hidea');
                    }
                    else {
                        menuEffect.start({ width: "245px", right: "0px" });
                    }
				}
				div.setStyles({ width: "52px", right: "0px", display: "block" });
				div.addClass('hidea');

				this.console("info", "function showRightMenu()");
				div.addEvent( 'mouseenter', function(e){ show() });
				div.addEvent( 'mouseleave', function(e){ hide() });
			}
		}
	},


	/**
	 * Gestion de l'annimation du carrousel
	 */
	carrousel: function () {
		if ( $('carrousel') ) {
			this.console("info", "function carrousel()");

			/* Les éléments */
			carrouselDiv = $('carrousel');
			bigIllustration = carrouselDiv.getElement('.bigIllustration img');
			bigTitle = carrouselDiv.getElement('.bigIllustration a');
			bigTitleLink = carrouselDiv.getElement('.bigIllustration a');
			newsSmall = carrouselDiv.getElements('.newsSmall');
			backh4 = carrouselDiv.getElements('.backh4');
			backh4Padding = 5;
			backh4Top = 194;
			counter = 0;

			/* Gestion de la taille de .backh4 ainsi que de l'emplacment de
			 * .bigIllustration et .backh4,
			 * en fonction de la taille de bigTitle */
			var setBackh4Size = function() {
				var height = backh4Padding + bigTitle.getSize().y;
				var top = backh4Top - height;
				backh4.setStyles({
					height: height,
					top: top
				});
				bigTitle.setStyle( 'top', top );
			};

			/* L'action à faite toutes les périodes */
			var changeNews = function(){
				counter++;
				if ( counter >= this.carrouselImagesList.length ) {
					counter = 0
					
				}
				bigIllustration.fade('hide');
				bigTitle.fade('hide');
				bigIllustration.setProperty( 'src', this.carrouselImagesList[counter]);
				bigIllustration.fade('in')
				bigTitle.fade('in')
				bigTitle.set('text', this.carrouselTitlesList[counter]);
				bigTitleLink.set('href', this.carrouselTitlesLink[counter]);
				setBackh4Size();

			};

			/* La période*/
			setBackh4Size();
			timer = changeNews.periodical(5000, this );

			/* L'action sur le clic ! */
			newsSmall.each( function( div ){
				div.addEvent('mouseover', function(e){
					position = div.getProperty('class');
					position = position.substr(19, 1);
					counter = ( position - 2);
					$clear(timer)
					var change = changeNews.bind(this);
					change()
					timer = changeNews.periodical(5000, this );
				}.bind(this));
			}.bind(this));
		}
	},
	
	/**
	 * Gestion de l'animation du carrousel d'images
	 */
	carrousel_images: function () {
		if ( $('blockImgdeSc')&&this.carrousel_images_ImagesList.length>1 ) {
			this.console("info", "function carrousel_images()"+this.carrousel_images_ImagesList.length);
			/* Les éléments */
			carrouselDiv_images = $('blockImgdeSc');
			bigIllustration_images = carrouselDiv_images.getElement('.bigIllustration_images img');
			Lien_image=carrouselDiv_images.getElement('.bigIllustration_images a');
			//bigTitle_images = carrouselDiv_images.getElement('.bigIllustration_images p');
			//backh4_images = carrouselDiv_images.getElements('.backh4_images');
			//backh4Padding_images = 5;
			//backh4Top_images = 194;
			

			/* Gestion de la taille de .backh4 ainsi que de l'emplacment de
			 * .bigIllustration et .backh4,
			 * en fonction de la taille de bigTitle */
			/*var setBackh4Size_images = function() {
				var height = backh4Padding_images + bigTitle_images.getSize().y;
				var top = backh4Top_images - height;
				backh4_images.setStyles({
					height: height,
					top: top
				});
				bigTitle_images.setStyle( 'top', top );
			};*/

			/* L'action à faire toutes les périodes */
			var changeNews_images = function(){
				counter_images++;
				if ( counter_images >= this.carrousel_images_ImagesList.length ) {
					counter_images = 0
				}
				bigIllustration_images.fade('hide');
				//bigTitle_images.fade('hide');
				bigIllustration_images.setProperty( 'src', this.carrousel_images_ImagesList[counter_images]);
				bigIllustration_images.fade('in')
				Lien_image.href=this.carrousel_images_TitlesList[counter_images];
				//bigTitle_images.fade('in')
				//bigTitle_images.set('text', this.carrousel_images_TitlesList[counter_images]);
				//setBackh4Size_images();
			};
			/* La période*/
			//setBackh4Size_images();
			timer_images = changeNews_images.periodical(5000, this );

		}
	},
	
	carrousel_images_next: function () {
		if ( $('carrousel_images')&&this.carrousel_images_ImagesList.length>1 ) {
			
			/* Les éléments */
			carrouselDiv_images = $('carrousel_images');
			bigIllustration_images = carrouselDiv_images.getElement('.bigIllustration_images img');
			bigTitle_images = carrouselDiv_images.getElement('.bigIllustration_images p');
			backh4_images = carrouselDiv_images.getElements('.backh4_images');
			backh4Padding_images = 5;
			backh4Top_images = 194;
			counter_images++;
			
			
			/* L'action à faire toutes les périodes */
			var changeNews_images = function(){
				counter_images++;

				if ( counter_images >= this.carrousel_images_ImagesList.length ) {
					counter_images = 0
				}
				bigIllustration_images.fade('hide');
				bigTitle_images.fade('hide');
				bigIllustration_images.setProperty( 'src', this.carrousel_images_ImagesList[counter_images]);
				bigIllustration_images.fade('in')
				bigTitle_images.fade('in')
				bigTitle_images.set('text', this.carrousel_images_TitlesList[counter_images]);
				setBackh4Size_images();
			};
			$clear(timer_images);
			timer_images = changeNews_images.periodical(5000, this );
			
			/* Gestion de la taille de .backh4 ainsi que de l'emplacment de
			 * .bigIllustration et .backh4,
			 * en fonction de la taille de bigTitle */
			var setBackh4Size_images = function() {
				var height = backh4Padding_images + bigTitle_images.getSize().y;
				var top = backh4Top_images - height;
				backh4_images.setStyles({
					height: height,
					top: top
				});
				bigTitle_images.setStyle( 'top', top );
			};

				if ( counter_images >= this.carrousel_images_ImagesList.length ) {
					counter_images = 0
				}
				bigIllustration_images.fade('hide');
				bigTitle_images.fade('hide');
				bigIllustration_images.setProperty( 'src', this.carrousel_images_ImagesList[counter_images]);
				bigIllustration_images.fade('in')
				bigTitle_images.fade('in')
				bigTitle_images.set('text', this.carrousel_images_TitlesList[counter_images]);
				setBackh4Size_images();
		}
	},
	
	
	carrousel_images_previous: function () {
		if ( $('carrousel_images')&&this.carrousel_images_ImagesList.length>1 ) {
			
			/* Les éléments */
			carrouselDiv_images = $('carrousel_images');
			bigIllustration_images = carrouselDiv_images.getElement('.bigIllustration_images img');
			bigTitle_images = carrouselDiv_images.getElement('.bigIllustration_images p');
			backh4_images = carrouselDiv_images.getElements('.backh4_images');
			backh4Padding_images = 5;
			backh4Top_images = 194;
			counter_images--;
			
			/* L'action à faire toutes les périodes */
			var changeNews_images = function(){
				counter_images++;

				if ( counter_images >= this.carrousel_images_ImagesList.length ) {
					counter_images = 0
				}
				bigIllustration_images.fade('hide');
				bigTitle_images.fade('hide');
				bigIllustration_images.setProperty( 'src', this.carrousel_images_ImagesList[counter_images]);
				bigIllustration_images.fade('in')
				bigTitle_images.fade('in')
				bigTitle_images.set('text', this.carrousel_images_TitlesList[counter_images]);
				setBackh4Size_images();
			};
			
			$clear(timer_images);
			timer_images = changeNews_images.periodical(5000, this );
			
			/* Gestion de la taille de .backh4 ainsi que de l'emplacment de
			 * .bigIllustration et .backh4,
			 * en fonction de la taille de bigTitle */
			var setBackh4Size_images = function() {
				var height = backh4Padding_images + bigTitle_images.getSize().y;
				var top = backh4Top_images - height;
				backh4_images.setStyles({
					height: height,
					top: top
				});
				bigTitle_images.setStyle( 'top', top );
			};
	
			if ( counter_images ==-1  ) {
				counter_images = this.carrousel_images_ImagesList.length-1
			}
			bigIllustration_images.fade('hide');
			bigTitle_images.fade('hide');
			bigIllustration_images.setProperty( 'src', this.carrousel_images_ImagesList[counter_images]);
			bigIllustration_images.fade('in')
			bigTitle_images.fade('in')
			bigTitle_images.set('text', this.carrousel_images_TitlesList[counter_images]);
			setBackh4Size_images();
		}
},

	/**
	 * Gestion de l'animation du carrousel d'images
	 */
	carrousel_extranet: function () {
	
			var length;
			var length2;
			if ($('tools'))
			{
				length=(parseInt($('tools').getElements('li').length-5) * 91) ;
			}
			if ($('letters'))
			{
				length2=(parseInt($('letters').getElements('li').length-3) * 91) ;
			}		
			this.console("info", "function carrousel_images_extranet()"+length);
			this.console("info", "function carrousel_images_extranet()"+length2);
			var scrolling=0;
			var scrolling2=0;
			var elemScroll=0;
			var elemScroll2=0;

			/* L'action à faire toutes les périodes */
			var changeNews_images = function(){
				$$('#tools', 'containerMain').each( function( box ){
					if(scr==null) {
						var tm=(length*7000)/91;
						scr=new Fx.Scroll( box.getElement('.scrolling'),{duration:tm,
				    	fps:50,transition: Fx.Transitions.linear,wait: false});
					    scr.start( length+100, 0)
					} else if (scroolScr1) {						
						scrolling=parseInt(box.getElement('.scrolling').getScroll().x);
					    if (scrolling>=length) {
					    	scr.pause();
				    		scr.set( scrolling-length, 0);
						    scr.start( length+100, 0);
				    	}
				    }
				});
				$$('#letters', 'containerMain').each( function( box ){
					if(scr2==null) {
						var tm=(length2*7000)/91;
						scr2=new Fx.Scroll( box.getElement('.scrolling'),{duration:tm,
				    	fps:50,transition: Fx.Transitions.linear,wait: false});
					    scr2.start( length2+10, 0)
					} else if (scroolScr2) {
						scrolling2=parseInt(box.getElement('.scrolling').getScroll().x);
					    if (scrolling2>=length2) {
					    	scr2.pause();
				    		scr2.set( scrolling2-length2, 0);
						    scr2.start( length2+10, 0);
				    	}
				    }
				});
				
				
				
				
			};

			changeNews_images();
			timer_images = changeNews_images.periodical(50, this );

	},

	
	
	
	
	
	
	
	
	
	


	/**
	 * Gestion de l'annimation du menu de gauche
	 */
	menuLeft: function () {
		if ( $("nav") ) {
			this.console("info", "function menuLeft()");

			/* Ajout de la classe NoBg */
			var addNoBg = function(a) {
				if ( a.getParent().getPrevious() ) {
					a.getParent().getPrevious().addClass('nobg');
				}
			};
			/* Suppression de la classe NoBg */
			var removeNoBg = function(a) {
				if ( a.getParent().getPrevious() && !a.hasClass('slide')) {
					a.getParent().getPrevious().removeClass('nobg');
				}
			};
			/* Remonter tout */
			var unslideAll = function() {
				$('nav').getChildren().each( function( li ){
					a = li.getElement('a');
					if ( !a.hasClass('selected') ) {
						ul = li.getElement('ul');
						ul.slide('out');
						a.removeClass('slide');
						removeNoBg(a);
					}
				});
			};

			$$('.subNav', 'nav').each( function( ul ){
				var a = ul.getParent().getFirst();
				ul.set('slide');
				if ( !a.hasClass('selected') ) {
					ul.slide('hide');

					a.addEvent('click', function(e){
						unslideAll()
						ul.slide('toggle');
						a.toggleClass('slide');
						addNoBg(a);
					});
					a.addEvent( 'mouseenter', function(e){
						addNoBg(a);
					});
					a.addEvent( 'mouseleave', function(e){
						removeNoBg(a);
					});
				}
				else {
					addNoBg(a);
				}
			});
		}
	},





	/**
	 * Gestion des textes explicatifs area organigramme
	 */
	textArea: function () {
        if( $('organigramme') ) {
            this.console("info", "function textArea()");

            var hide = function() {
                $$('.area', 'contentPage').each( function( area ){
                    area.setStyle('display', 'none');
                });
            }
            hide();

            $$('area').each( function( show ){
                show.addEvent( 'click', function(e) {
                    hide();
                    $('entity_' + show.getProperty('class') ).setStyle('display', 'block');
                });
            });
        }
	},





	/**
	 * ajouter à vos favoris
	 */
    addBookmark: function() {
        if ( $('favori') ) {
            this.console("info", "function addBookmark()");
			var nav = navigator.userAgent;
			var ischrome = false;
			var issafari = false;
			if(	nav.indexOf("Chrome")!=-1){ 
				ischrome = true;
			}
			if(	nav.indexOf("Safari")!=-1){ 
				issafari = true;
			}

            $('favori').addEvent( 'click', function(e) {
                if (ischrome||issafari){
					alert('Appuyez sur ctrl+D pour ajouter cette page aux favoris (Command+D sur MAC)');
                } else if (window.external && typeof(window.sidebar) == 'undefined'){
                    window.external.AddFavorite(document.URL, document.title);
				} else if (window.sidebar){
					window.sidebar.addPanel(document.title, document.URL,"");
                }
            });

        }
    },





/* ****************************************************************** Système */

	/**
	 * Ecriture dans la console de Firebug.
	 *
	 * @param type string type de message
	 * @param msg string Suffix de l'ereur
	 */
	console: function ( type, msg ) {
		if( this.debug && Browser.Engine.gecko ) {
			this.log(type, msg);
		}
	}

}); // EOC
