/*----------------------------------------------------------------------------- browser --------------------------------------------------------------------*/
/* detection du navigateur */
function BrowserDetectLite() {
   var ua = navigator.userAgent.toLowerCase(); 
   
   // browser name
   this.isGecko     = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isMozilla   = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   this.isIE        = ( (ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) ); 
   this.isSafari    = (ua.indexOf('safari') != - 1);
   this.isOpera     = (ua.indexOf('opera') != -1); 
   this.isKonqueror = (ua.indexOf('konqueror') != -1 && !this.isSafari); 
   this.isIcab      = (ua.indexOf('icab') != -1); 
   this.isAol       = (ua.indexOf('aol') != -1); 
   this.isFirefox   = (ua.indexOf('firefox') != -1);
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isNS && this.isGecko) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
   }
   else if (this.isOpera) {
      if (ua.indexOf('opera/') != -1) {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
      }
      else {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
      }
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isIcab) {
      if (ua.indexOf('icab/') != -1) {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
      }
      else {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
      }
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin   = (ua.indexOf('win') != -1);
   this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac   = (ua.indexOf('mac') != -1);
   this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
   
   this.isAutre   = !(this.isIE || this.isFirefox || this.isSafari);
}
browser = new BrowserDetectLite();
/*----------------------------------------------------------------------------- /browser --------------------------------------------------------------------*/
/*---------------------------------------------------------------------------- popup ------------------------------------------------------------------------*/
// ouvre une popup qui se centre; url=url de la page ; nom_fenetre = nom de la fenetre ; hauteur et largeur en chaine et sans unité
// pour une popup fixe : hauteur=hauteur du contenu(<=534px) ; largueur=largueur du contenu(<=790px)
// pour une popup plein écran : hauteur='max' ; largueur='max';
// pour une popup de hauteur 'max' , le scroll est automatique mis avec la fenetre ; le contenu de la popup <= 771px;
// prend en compte les navigateurs IE5.5, IE6, Firefox et Safari +  l'interface du système d'exploitation (barre des taches)
// si besoin d'avoir un scroll, il faut le créer à l'intérieur de la page appelée


/* requis : window.js */
win = null
function popup_dhtml(url, largeur, hauteur){
	win = new Window({className:"popup", width:largeur, height:hauteur, zIndex: 1001, resizable: true, minimizable:false, maximizable:false, draggable:false})
	win.setURL(url);
	
	win.showCenter(true); /* le param true est pour modal */
	
}
/*--------------------------------------------------------------------------- /popup_dhtml ------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------- popup ------------------------------------------------------------------------*/
// ouvre une popup qui se centre; url=url de la page ; nom_fenetre = nom de la fenetre ; hauteur et largeur en chaine et sans unité
// pour une popup fixe : hauteur=hauteur du contenu(<=534px) ; largueur=largueur du contenu(<=790px)
// pour une popup plein écran : hauteur='max' ; largueur='max';
// pour une popup de hauteur 'max' , le scroll est automatique mis avec la fenetre ; le contenu de la popup <= 771px;
// prend en compte les navigateurs IE5.5, IE6, Firefox et Safari +  l'interface du système d'exploitation (barre des taches)
// si besoin d'avoir un scroll, il faut le créer à l'intérieur de la page appelée

function popup(url,nom_fenetre,largeur,hauteur,scrollbar)
{
	//alert(url)
	// ecran
	var hauteurEcran = screen.height;
	var largeurEcran = screen.width;
	if (browser.isIE)
	{
		hauteurEcran = screen.availHeight;
		largeurEcran = screen.availWidth;
	}
	
	// dimension fenetre 
	var hauteurFenetre = null;
	var largeurFenetre = null;
	
	// resolution 800 * 600
	//if(largeur!="max" && parseInt(largeur)>790){largeur=790;alert('Le contenu de la popup ne dois pas dépassé 790px en largeur pour s\'afficher correctement en 800 * 600')}
	//if(hauteur!="max" && parseInt(hauteur)>534){hauteur=534;alert('Le contenu de la popup ne dois pas dépassé 534px en hauteur pour s\'afficher correctement en 800 * 600')}
	
	// largeur fenetre
	if(largeur=='max')
	{
		if(browser.isIE){largeurFenetre = largeurEcran-10;}
		if(browser.isFirefox || browser.isAutre){largeurFenetre = largeurEcran-6}
		if(browser.isSafari){largeurFenetre = largeurEcran;}
	} 
	else
	{largeurFenetre =  parseInt(largeur)}
	
	// hauteur fenetre
	if(hauteur=='max')
	{
		if(browser.isIE){hauteurFenetre = hauteurEcran-36;}
		if(browser.isFirefox || browser.isAutre){hauteurFenetre = hauteurEcran;}
		if(browser.isSafari){hauteurFenetre = hauteurEcran-48}
	} 
	else
	{ 
		if(browser.isIE){hauteurFenetre = parseInt(hauteur)}
		if(browser.isFirefox || browser.isAutre){hauteurFenetre = parseInt(hauteur)}
		if(browser.isSafari){hauteurFenetre = parseInt(hauteur)+1}
	}
	
	// largueur effective fenetre
	var largeurFenetreEffective = null;
	if(browser.isIE){largeurFenetreEffective=parseInt(largeurFenetre)+10;}
	if(browser.isFirefox || browser.isAutre){largeurFenetreEffective=parseInt(largeurFenetre)+6}
	if(browser.isSafari){largeurFenetreEffective=parseInt(largeurFenetre)}
	
	// hauteur effective fenetre
	var hauteurFenetreEffective = null;
	if(browser.isIE){hauteurFenetreEffective=parseInt(hauteurFenetre)+36;}
	if(browser.isFirefox || browser.isAutre){hauteurFenetreEffective=parseInt(hauteurFenetre)+36;}
	if(browser.isSafari){hauteurFenetreEffective=parseInt(hauteurFenetre)}
	
	// position fenetre
	var top = (hauteurEcran-hauteurFenetreEffective)/2;	
	var left = (largeurEcran-largeurFenetreEffective)/2;

	// bug safari
	if(browser.isSafari && left==0){left=1}
	// fenetre
	var nouvelleFenetre=open(url,nom_fenetre,"width="+largeurFenetre+"px,height="+hauteurFenetre+"px,top="+top+"px,left="+left+"px,menubar=no,resizable=no,scrollbars="+scrollbar);
	nouvelleFenetre.focus();
}
/*--------------------------------------------------------------------------- /popup ------------------------------------------------------------------------*/
/*---- css ----*/
function css(chemin,media)
{
	document.write('<link href="'+chemin+'" rel="stylesheet" type="text/css" media="'+media+'"/>')
}
/*---- /css ----*/
/*--- email ----*/
function email(partie_1, partie_2, classe){
	var adresse_email = partie_1;
	adresse_email += '@';
	adresse_email += partie_2;
	document.write('<a href="mailto:'+adresse_email+'" class="'+classe+'">'+adresse_email+'</a>');
}
/*--- /email ----*/
/*-------------  affiche encart newsletter accueil ---------------*/
function affiche_newsletter_accueil() {
	$('flash_newsletter').style.display = "block";
	}
/*-------------  affiche encart newsletter accueil ---------------*/

/*-------------  desaffiche encart newsletter accueil ---------------*/
function desaffiche_newsletter_accueil() {
	$('flash_newsletter').style.display = "none";
	}
/*-------------  desaffiche encart newsletter accueil ---------------*/

/*-------------  javatraceur ---------------*/
function javatraceur(param)
{
	var sas_tmstp=Math.round(Math.random()*10000000000);
	if($('traceur_campagne'))
	{
		var ancien_contenu = $('traceur_campagne').innerHTML ;
		var contenu_ajoute = '<img src="http://www.smartadserver.com/track/pix.asp?2756;309'+param+';'+sas_tmstp+'" width="1" height="1" border="0"/>';
		$('traceur_campagne').innerHTML = ancien_contenu + contenu_ajoute;
	}
}
/*-------------  /javatraceur ---------------*/

/*--------------------------------------------------------------------------- loading ------------------------------------------------------------------------*/
// loading utilisé sur chaque page
function loading()
{
	//preload_rollover
	$$(".rollover_img").each(function(image){
		new Img_rollover(image)
	});
	
	//preload_input_value
	$$(".input_value").each(function(input_value){
		new Input_value(input_value)
	});

	//preload_vignette
	$$(".vignette a").each(function(vignette){
		new Vignette(vignette)
	});
	
	//preload_vignette_2
	$$(".vignette_2 a").each(function(vignette){
		new Vignette(vignette)
	});

	// liste deroulante pour le choix des langues
	if($('liste_langue')){
	new ListeDeroulante('liste_langue','bouton_liste_langue');}
}

//Event.onDOMReady(loading);
Event.observe(window,"load",loading,false)
/*--------------------------------------------------------------------------- /loading ------------------------------------------------------------------------*/