
	//  retoune les valeurs {'x','y'} de défilement de la fenêtre
	function get_Pos_Scroll() 
	{
		var x,y;
		
		// autres que IE
		if ( window.pageXOffset!==undefined) 
		{
			x = window.pageXOffset;
			y = window.pageYOffset;
		}
		// IE
		else 
		{
			x = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : (document.body.scrollLeft?document.body.scrollLeft:0) ;
			y = document.documentElement.scrollTop ? document.documentElement.scrollTop : (document.body.scrollTop?document.body.scrollTop:0) ;
		}
		
		return {'x':x, 'y':y};
	}

	// retourne la position (dans la page) de chacun des côtés d'un élément
	function get_Pos_Elt(elem) 
	{
		var pos={'r':0,'l':0,'t':0,'b':0};
		var tmp=elem;
		
		// on procède de parent en parent car IE fonctionne comme ça
		// (les autres donnent directement la position par rapport à la page)
		
		do 
		{
			pos.l += tmp.offsetLeft;
			tmp = tmp.offsetParent;
		} while( tmp !== null );
		pos.r = pos.l + elem.offsetWidth;
		
		tmp=elem;
		do 
		{
			pos.t += tmp.offsetTop;
			tmp = tmp.offsetParent;
		} while( tmp !== null );
		pos.b = pos.t + elem.offsetHeight;
		
		return pos;
	}

	// retourne les dimentions intérieurs de la fenêtre {'x','y'}
	function get_Dim_Win() 
	{
		var x,y;
		if ( window.innerWidth ) { // autres que IE
			x = window.innerWidth;
			y = window.innerHeight;
		} else if ( document.documentElement.clientWidth ) { // IE8
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		} else if ( document.body.clientWidth ) { // IE6
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		} else { alert("winDim() n'est pas parvenu à lire les dimentions de la fenêtre"); }

		return {'x':x, 'y':y} ;
	}

	// retourne les dimentions de l'écran {'x','y'} et dimensions disponibles ('xa','ya')
	function get_Dim_Screen() 
	{
		var x,y,xa,ya;
		x = screen.width;
		y = screen.height;
		xa = screen.availWidth;
		ya = screen.availHeight;

		return {'x':x, 'y':y, 'xa':xa, 'ya':ya} ;
	}

	// retourne les positions {'x','y'} de la souris dans la page
	function get_Pos_Mouse(e)
	{
		var mousePos={'x':0,'y':0};
		if (!e)
			{ e = window.event; }
		if (e.pageX || e.pageY)
		{
			mousePos.x = e.pageX;
			mousePos.y = e.pageY;
		}
		else if (e.clientX || e.clientY)
		{
			mousePos.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			mousePos.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		}
		
		return mousePos;
	}

	// efface la bulle
	function ib_off()
	{
		var bulle = document.getElementById("bulle");
		if (bulle)
		{
			document.getElementsByTagName("body")[0].removeChild(bulle);
		};
	};

	// affiche la bulle
	function ib_on(texte,classe)
	{
		// création de l'objet
		var bulle = document.getElementsByTagName("body")[0].appendChild(document.createElement("div"));
		bulle.id = "bulle";
		bulle.style.position = "absolute";
		
		// appliquer la classe css
		bulle.className = classe;
		
		get_Pos_Mouse();
		winDim();

		// contenu du message
		bulle.innerHTML = texte;
//		bulle.innerHTML = 'Souris : X=' + mousePos.x + ' Y=' + mousePos.y + '<br />Fenêtre : X=' + fenDim.x + ' Y=' + fenDim.y + '<br /><img border="0" src="../../images/angot.org.gif" height="45" alt="" title="www.angot.org" />'

		// positionner la bulle
		bulle.style.visibility = 'hidden';
//		setTimeout(function(){bulle.parici();},100);
//		parici();
		
		// position horizontale
//		var bordDroit = mousePos.x + bulle.offsetWidth ;
//		bulle.style.left = ( (bordDroit>winDims.w) ? mousePos.x - (bordDroit - winDims.w) : mousePos.x) + "px";
		bulle.style.left = mousePos.x+10 + "px";

		// position verticale
//		var auDessus = mousePos.y - (bulle.offsetHeight + 5);
//		bulle.style.top = ( (auDessus<winPos.y) ? mousePos.y + 10 : auDessus) + "px";
		bulle.style.top = mousePos.y+10 + "px";
		
		bulle.style.visibility = 'visible';
	}

	// affiche la bulle photo
	function ib_photoon(photo,la,ha,nom)
	{
		var coeff = 1.5 ;
		position = get_Pos_Elt(document.getElementById(nom)) ;
		fenetre = get_Dim_Win() ;
		defile = get_Pos_Scroll() ;

		imgx = position.l + 5 ;
		imgy = position.b + 5 ;

		if ( (defile.y + fenetre.y) < (imgy + ha/coeff + 5) )
		{
			imgy = position.t - ha/coeff - 10 ;
		};
		
		var bulle = document.getElementsByTagName("body")[0].appendChild(document.createElement("div")) ;
		bulle.id = "bulle" ;
		bulle.style.position = 'absolute' ;
		bulle.className = 'photobul' ;
		bulle.innerHTML = '<img border="0" src="' + photo + '" width="'+la/coeff+'" alt="" title="www.angot.org" />' ;
		// bulle.style.visibility = 'hidden' ;
		bulle.style.left = imgx + 'px' ;
		bulle.style.top = imgy + 'px' ;
		bulle.style.visibility = 'visible' ;
	}

	// affiche la bulle photo + texte
	function ib_photoon2(photo,texte,la,ha,nom)
	{
		var coeff = 1.5 ;
//		position = get_Pos_Elt(document.getElementById(nom)) ;
		position = get_Pos_Mouse() ;
		fenetre = get_Dim_Win() ;
		defile = get_Pos_Scroll() ;

		// imgx = position.l + 5 ;
		// imgy = position.b + 5 ;
		imgx = position.x - (la/coeff / 2) ;
		imgy = position.y + 20 ;

		if ( (defile.y + fenetre.y) < (imgy + ha/coeff + 50) )
		{
			imgy = position.y - ha/coeff - 85 ;
		};
		
		var bulle = document.getElementsByTagName("body")[0].appendChild(document.createElement("div")) ;
		bulle.id = "bulle" ;
		bulle.style.position = 'absolute' ;
		bulle.className = 'photobul' ;
		bulle.innerHTML = '<center><img border="0" src="/' + photo + '" width="'+la/coeff+'" alt="" title="www.angot.org" /></center>' ;
		bulle.innerHTML = bulle.innerHTML + texte ;
		// bulle.style.visibility = 'hidden' ;
		bulle.style.left = imgx + 'px' ;
		bulle.style.top = imgy + 'px' ;
		bulle.style.visibility = 'visible' ;
	}

	// affiche la bulle photo + texte drapeau vertical
	function ib_ban_horiz(num,photo,texte,la,ha,nom)
	{
		var coeff = 1.5 ;
		var nb = 17 ;
		fenetre = get_Dim_Win() ;

		imgy = 115 ;

		decal = ( (780 - 350) / nb ) * (num - 1) + ((fenetre.x-930)/2) ;
		
		imgx = 65 + decal ;

		var bulle = document.getElementsByTagName("body")[0].appendChild(document.createElement("div")) ;
		bulle.id = "bulle" ;
		bulle.style.position = 'absolute' ;
		bulle.className = 'drap-v' ;
		bulle.innerHTML = '<img style="margin-right : 10px" align="left" border="0" src="/' + photo + '" width="'+la/coeff+'" alt="" title="www.angot.org" />' ;
		bulle.innerHTML = bulle.innerHTML + texte ;
		bulle.style.left = imgx + 'px' ;
		bulle.style.top = imgy + 'px' ;
		bulle.style.height = (ha/coeff) + 'px' ;
		bulle.style.visibility = 'visible' ;
	}

	// affiche la bulle photo + texte drapeau horizontal
	function ib_ban_verti(photo,texte,la,ha,nom)
	{
		var coeff = 1.5 ;
		// var nb = 16 ;

		position = get_Pos_Mouse() ;
		fenetre = get_Dim_Win() ;
		decallage = (fenetre.x - 800) / 2 ;
		x = position.x + 40 - decallage ;

		imgx = x+decallage ;
		imgy = position.y - 239 ;

		var tx = 120 ;
		var ty = 69 ;
		
		imgx = ( imgx ) - ( imgx%tx ) + 110 ;
		imgy = ( imgy ) - ( imgy%ty ) + 239 ;

		var bulle = document.getElementsByTagName("body")[0].appendChild(document.createElement("div")) ;
		bulle.id = "bulle" ;
		bulle.style.position = 'absolute' ;
		bulle.className = 'drap-v' ;
		bulle.innerHTML = '<img style="margin-right : 10px" align="left" border="0" src="/' + photo + '" width="'+la/coeff+'" alt="" title="www.angot.org" />' ;
		bulle.innerHTML = bulle.innerHTML + texte ;
		bulle.style.left = imgx + 'px' ;
		bulle.style.top = imgy + 'px' ;
		bulle.style.height = (ha/coeff) + 'px' ;
		bulle.style.visibility = 'visible' ;
	}

	// affiche la bulle photo + texte mapemonde
	function ib_map(photo,texte,la,ha,x,y)
	{
		var coeff = 1.5 ;
		var nom = 'carteid';
		position = get_Pos_Elt(document.getElementById(nom)) ;
		fenetre = get_Dim_Win() ;
		defile = get_Pos_Scroll() ;

		imgx = x + 5 ;
		imgy = y + position.y ;

		if ( (defile.y + y) < (imgy + ha/coeff + 5) )
		{
			imgy = position.t - ha/coeff - 10 ;
		};
		
		var bulle = document.getElementsByTagName("body")[0].appendChild(document.createElement("div")) ;
		bulle.id = "bulle" ;
		bulle.style.position = 'absolute' ;
		bulle.className = 'drap-v' ;
		bulle.innerHTML = '<img style="margin-right : 10px" align="left" border="0" src="/' + photo + '" width="'+la/coeff+'" alt="" title="www.angot.org" />' ;
		bulle.innerHTML = bulle.innerHTML + texte + "<br />x = " + position.x + ", y = " + position.y ;
		bulle.style.left = 50 + 'px' ;
		bulle.style.top = 50 + 'px' ;
		bulle.style.height = (ha/coeff) + 'px' ;
		bulle.style.visibility = 'visible' ;
	}

