var isNav = navigator.appName.indexOf("Netscape") !=-1;var isN6 = ((isNav) && (document.getElementById));
var isMac = navigator.appVersion.indexOf("Macintosh") !=-1;
var isIE = document.all;
var isIEPC = ((isIE) && (!(isMac)))
var Egale = '=';
var bo_several_checked=false;
// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
var old_id_menu = -1;
var bo_ferme = true; //booleen qui permet de fermer la bulle en cours.

function OuvreFenetre(URL,NomControle,Largeur,Hauteur,AffScrollBars)
{
	if (AffScrollBars!="no") AffScrollBars='yes';
	Top = screen.height/2-Hauteur/2 
	Gauche = screen.width/2-Largeur/2
	var popup = window.open(URL, NomControle, "toolbar=no,status=no,menubar=no,scrollbars=" + AffScrollBars + ",resizable=no,directories=no,location=no,width=" + Largeur + ",height=" + Hauteur +",top=" + Top + ",left=" + Gauche)
}

function Desactive_Bouton(theform,btn,texte_replace)
{
	if (document.all || document.getElementById)
	{
		btn.disabled = true;
		
		
		if (document.all)
		{
			if (eval(theform.id + ".bo_form_soumis"))
				{eval(theform.id + ".bo_form_soumis.value='true';");}
		}
		else
		{
			if (document.getElementById('bo_form_soumis'))
			{
				document.getElementById('bo_form_soumis').value='true';
			}
		}
		theform.submit();
	}
}

function HiLite(imgN,PathImage2,Extension)
{
		eval("document [imgN].src = \"/images/" + PathImage2 + imgN + "_" + Extension + ".gif\"");
}

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function




ValeurMax=-1;

if (isN6){	h=".left";	v=".top";	dS="document.getElementById('";	sD="').style";
	appComp = "true";
	Hauteur = "').offsetHeight";
	ECRIRE = "').innerHTML=";
	VISIBLE = ".visibility='visible'";	Unite_Pixel = "px";}else {	if (isNav)
	{		h=".left";		v=".top";
		dS="document.";		sD="";
		appComp = "true";
		Hauteur = ".document.height";		VISIBLE = ".visibility='show'";
		Unite_Pixel = "px";
	}	else	{
		h=".pixelLeft";		v=".pixelTop";
		dS="";		sD=".style";
		appComp = "true";
		Hauteur = ".offsetHeight";
		ECRIRE = ".innerHTML=";
		VISIBLE = ".visibility='visible'";		Unite_Pixel = "";	}}

function show_articles(id_menu,ctrl)
{
	if ((old_id_menu != -1) && (old_id_menu != id_menu))
	{
		AfficheLayer("bulle_" + old_id_menu,-500,-500);
		AfficheLayer("pointbulle",-500,-500);
	}
		
	AfficheLayer("bulle_" + id_menu,tempX + 43,tempY + 3);
	AfficheLayer("pointbulle",tempX + 15,tempY + 15);
		/*AfficheLayer("bulle_" + id_menu,findPosX(ctrl)+92,findPosY(ctrl)+15);
		AfficheLayer("pointbulle",findPosX(ctrl)+67,findPosY(ctrl)+23);*/
	old_id_menu=id_menu;
	
}

function hide_articles(id_menu)
{
	if (bo_ferme)
		if (old_id_menu==id_menu)
		{
			AfficheLayer("bulle_" + id_menu,-500,-500);
			AfficheLayer("pointbulle",-500,-500);
		}
}

function Declenche_Timer(id_menu)
{
	//document.getElementById("bulle_" + id_menu).innerHTML = "<font color='black'>on DECLENCHE</font><br>" + document.getElementById("bulle_" + id_menu).innerHTML;
	setTimeout("hide_articles("+id_menu+");","1500");	
}



function AfficheLayer(Layer,x,y)
{
	eval(dS+Layer+sD+v+Egale+y);
	eval(dS+Layer+sD+h+Egale+x);
}

function efface(text_defaut,ctrl)
{
	
	if (text_defaut.value==ctrl.value)
	{
		ctrl.value='';
		ctrl.focus();
	}
}

// If NS -- that is, !IE -- then set up for mouse capture
if (!isIE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;



// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (isIE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  return true
}


function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}



function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


/* fonctions qui aident dans la vie */
function isArray(a) {
    return isObject(a) && a.constructor == Array;
}

function isBoolean(a) {
    return typeof a == 'boolean';
}

function isEmpty(o) {
    var i, v;
    if (isObject(o)) {
        for (i in o) {
            v = o[i];
            if (isUndefined(v) && isFunction(v)) {
                return false;
            }
        }
    }
    return true;
}

function isFunction(a) {
    return typeof a == 'function';
}

function isNull(a) {
    return typeof a == 'object' && !a;
}

function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}

function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
}

function isString(a) {
    return typeof a == 'string';
}

function isUndefined(a) {
    return typeof a == 'undefined';
} 

