/****************************************************/
/* Trouve le navigateur courant.					*/
/****************************************************/
ns4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4);
ns5 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 5);
ie4 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4);
ie5 = (navigator.appVersion.indexOf('MSIE 5')>0);
ie6 = (navigator.appVersion.indexOf('MSIE 6')>0);
ElById = document.getElementById;

/****************************************************/
/* Trouve si une valeur est dans un objet.			*/
/****************************************************/
function IsInObject(Obj, val)
{
	var a;
	for(a=0;a<Obj.length;a++)
		if(Obj[a]==val)return true;
	return false;
}

/****************************************************/
/* Ecrit dans un élément (DIV ou Layer).			*/
/****************************************************/
function WriteInElem(ID_Name,Text)
{
	if(ns4)
	{
		var Layer = document.layers[ID_Name].document;
		Layer.write(Text);
		Layer.close();
		return;
	}
	if(ElById)
	{
		document.getElementById(ID_Name).innerHTML = Text;
		return;
	}
	if(ie4)
	{
		document.all(ID_Name).innerHTML = Text;
		return;
	}
}

/****************************************************/
/* Ecrit dans la barre de status.					*/
/****************************************************/
function SetStatus(Text)
{
	if(ns4 || ns5)window.statusbar=Text;
	if(ie4)window.status=Text;		
}

/****************************************************/
/* Ouvre un Popup.									*/
/****************************************************/
function PopUp(Name, SizeX, SizeY, Location)
{
	TmpTxt="resizable=yes,scrollbars=yes,location=no,menubar=no,width="+SizeX+",height="+SizeY;
	window.open(Location,Name,TmpTxt);
}

/****************************************************/
/* Change la couleur de fond d'une ligne de tableau	*/
/****************************************************/
function SetTrBgColor(Obj,zeColor)
{
	zeList=Obj.all.tags('TD');
	for(a=0;a<zeList.length;a++)
	{
		if(zeList[a].parentElement==Obj)
			zeList[a].style.background=zeColor;
	}
}

/****************************************/
/* SetCookie							*/
/****************************************/
function setCookie(name, value, expire, path) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
   + ((path == null) ? "" : ("; path=" + path));
}

/****************************************/
/* GetCookie							*/
/****************************************/
function getCookie(Name) {
   var search = Name + "=";
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search); 
      if (offset != -1) { // if cookie exists 
         offset += search.length; 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset);
         // set index of end of cookie value
         if (end == -1)
            end = document.cookie.length;
         return unescape(document.cookie.substring(offset, end))
      } 
   }
}

