/* objet */
function getOb(ob) { return (document.all)?eval('document.all.'+ob):(document.getElementById)?eval('document.getElementById("'+ob+'")'):null }

/*----------------------------------------------------------------------- proprietes -------------------------------------------------------------*/
/* hauteur */
function getHt(ob) { return ob.offsetHeight }
/* largeur */
function getLg(ob) { return ob.offsetWidth }
/* position y */
function getx(ob) { return (document.all)?ob.style.pixelLeft:parseInt(ob.style.left) }
/* position x */
function gety(ob) { return (document.all)?ob.style.pixelTop:parseInt(ob.style.top) }
/* hauteur zone affichage */
function htZoneAffichage() {if(browser.isIE55){return document.body.clientHeight} if(browser.isIE6up){return document.documentElement.clientHeight} if(browser.isAutre || browser.isFirefox || browser.isMac){return document.documentElement.clientHeight}}
/*----------------------------------------------------------------------- /proprietes -------------------------------------------------------------*/


/*------------------------------------------------------------------------ methodes ---------------------------------------------------------------*/
/* visible */
function show(ob) { ob.style.visibility = "visible" }
/* invisible */
function hide(ob) { ob.style.visibility = "hidden" }
/* affiche */
function d_block(ob) { ob.style.display = "block" }
/* desaffiche */
function d_none(ob) { ob.style.display = "none" }
/* definit hauteur */
function laht(ob,px) { ob.style.height = px+'px' }
/* definit largeur */
function lalg(ob,px) { ob.style.width = px+'px' }
/* positionne en x */
function enx(ob,px) { if (document.all) ob.style.pixelLeft = px; else ob.style.left = px+'px'; }
/* positionne en y */
function eny(ob,px) { if (document.all) ob.style.pixelTop = px; else ob.style.top = px+'px'; }
/* clip */
function clp(ob,htm,lgd,htp,lgg) { ob.style.clip = eval("'rect("+htm+"px, "+lgd+"px, "+htp+"px, "+lgg+"px)'") }
/* proportion */
function prop(mn,mx,bi,ind,bs) { return (((mx-mn)*ind)/(bs-bi)) }
/* definit contenu */
function inner(ob,contenu){ ob.innerHTML = contenu; }
/* change source image */
function swimg(im,src) { eval( 'document.'+im+'.src = "'+src+'"' ) }
/* definit hauteur image */
function iht(im,px) { eval('document.'+im+'.style.height = '+px+'px') }
/* definit largueur image */
function ilg(im,px) { eval('document.'+im+'.style.width = '+px+'px') }

function getOffsetPosition(inID, inTYPE){var iVal = 0;var oObj = document.getElementById(inID);var sType = 'oObj.offset' + inTYPE;while (oObj && oObj.tagName != 'BODY') {iVal += eval(sType);oObj = oObj.offsetParent;}return iVal;}
/*----------------------------------------------------------------------------- /methodes -----------------------------------------------------------------*/


/*----------------------------------------------------------------------------- parametreURL --------------------------------------------------------------*/
/* Renvoi la valeur du parametre "nom_parametre" contenu dans l'url (null si non existant) */
function parametreURL(nom_parametre)
{
	var url = window.location.search;
	var valeur = null;
	var param_avec_valeur = null;
	if(url.indexOf('?')!=-1)
	{
		var les_parametres = url.substring(url.indexOf('?')+1,url.length);
		var pos_nom_param = les_parametres.indexOf(nom_parametre+'=');
		
		if(pos_nom_param!=-1)
		{
			// un seul parametre
			if(pos_nom_param==1&&les_parametres.indexOf('&')!=-1)
			{
				param_avec_valeur=les_parametres.substring(pos_nom_param,les_parametres.length);
			}
			else
			// plusieurs parametres
			{
				les_parametres = les_parametres.substring(pos_nom_param,les_parametres.length);
				pos_nom_param = les_parametres.indexOf(nom_parametre);
				
				if(les_parametres.indexOf('&')!=-1)
				{
					param_avec_valeur = les_parametres.substring(pos_nom_param,les_parametres.indexOf('&'));
				}
				else
				// dernier parametre
				{
					param_avec_valeur = les_parametres;
				}
			}
			valeur = param_avec_valeur.substring(param_avec_valeur.indexOf('=')+1,param_avec_valeur.length);
		}
	}
	
	return valeur;
}
/*----------------------------------------------------------------------------- /parametreURL --------------------------------------------------------------*/


/*----------------------------------------------------------------------------- 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

function popup(url,nom_fenetre,largeur,hauteur,scrollbar)
{
	// 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 ------------------------------------------------------------------------*/
/*--------------------------------------------------------------------- preload rollover --------------------------------------------------------------------*/
function preload_rollover()
{
	var imgs_roll = document.getElementsByClassName("rollover_img");
	for(var i=0 ; i<imgs_roll.length ; i++)
	{
		new Img_rollover(imgs_roll[i]);
	}
}
/*--------------------------------------------------------------------- /preload rollover --------------------------------------------------------------------*/
/*--------------------------------------------------------------------- transforme PNG --------------------------------------------------------------------*/
function transforme_PNG()
{
	if(browser.isIE)
	{
		var imgs_png = document.getElementsByClassName("img_png");
		for(var i=0 ; i<imgs_png.length ; i++)
		{
			new Img_PNG(imgs_png[i]);
		}
	}	
}
/*--------------------------------------------------------------------- /transforme PNG --------------------------------------------------------------------*/
/*--------------------------------------------------------------------------- loading ------------------------------------------------------------------------*/
// loading utilisé sur chaque page
ajout_fonction_onload = new Array;
//ajout_fonction_onload.push('preload_rollover()')
//ajout_fonction_onload.push('transforme_PNG()')
function loading()
{
	if(ajout_fonction_onload!=null)
	{
		for(var i=0;i<ajout_fonction_onload.length;i++)
		{
			eval(ajout_fonction_onload[i])
		}
	}
}

window.onload=loading
/*--------------------------------------------------------------------------- /loading ------------------------------------------------------------------------*/







/*------------------------------ zoom image -------------------------------------*/

function img_zoom(ph,w,h,titre)

{

	var hauteurFenetre = h;

 	var largeurFenetre = w;

	var barre_des_taches = 18;

	if (h>screen.height)

	{

		top=0;

		hauteurFenetre = screen.height;



		if (navigator.appName == "Microsoft Internet Explorer" )

		{

			hauteurFenetre -= 36;

		}

		if (navigator.appName != "Microsoft Internet Explorer" )

		{

			largeurFenetre += 29;

		}

	}

	if (navigator.appName == "Microsoft Internet Explorer" )

	{

		largeurFenetre += 19;

	}

	var top = (screen.height - hauteurFenetre)/2;

	var left = (screen.width - largeurFenetre)/2;

	if (navigator.appName == "Microsoft Internet Explorer" )

	{

		top -= barre_des_taches;

		left -= 5;

	}

 	fenetre_zoom=window.open('','zoom','height='+hauteurFenetre+'px,width='+largeurFenetre+'px,left='+left+'px,top='+top+'px,toolbar=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no')

	fenetre_zoom.document.open();

	fenetre_zoom.document.writeln('<html><head>');

	fenetre_zoom.document.writeln('<title>zoom - '+titre+'</title>');

	fenetre_zoom.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">');

	fenetre_zoom.document.writeln('<style>*{margin:0;padding:0;}img {border:none;}</style>');

	fenetre_zoom.document.writeln('</head><body>');

	fenetre_zoom.document.writeln('<div><img onclick="window.close()" src="'+ph+'"/></div>');

	fenetre_zoom.document.writeln('</body></html>');

	fenetre_zoom.document.close();

	fenetre_zoom.focus();

	

}

/*------------------------------ /zoom image -------------------------------------*/
