//function sniffBrowsers() {
	/*
	var ns4 = document.layers;
	var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1);
	var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1) ||(navigator.userAgent.indexOf("Opera/6")!=-1);
	var agt=navigator.userAgent.toLowerCase();
	var mac = (agt.indexOf("mac")!=-1);
	var ie = (agt.indexOf("msie") != -1); 
	var mac_ie = mac && ie;
	*/
//}

/*----------------------------------------------------------------------------------------------*/
// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
	{
	  var p, i, foundObj;
	  
	  if(!theDoc) theDoc = document;
	  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
	  {
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	  }
	  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
		foundObj = theDoc.forms[i][theObj];
	  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
		foundObj = findObj(theObj,theDoc.layers[i].document);
	  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
	  
	  return foundObj;
	}
		

/*----------------------------------------------------------------------------------------------*/
function position(e){
	if(e){
		if(navigator.appName.substring(0,3) == "Net"){ 
		x = e.pageX 
	}else{
		x = event.x+document.body.scrollLeft;
	}
	if(navigator.appName.substring(0,3) == "Net") {
		y = e.pageY
	}else{
		y = event.y+document.body.scrollTop;
	}
	window.status = "Souris X:"+x+" / Y:"+y;
		
	}else{
		x = 0;
		y = 0;
	}
}
	
if(navigator.appName.substring(0,3) == "Net"){
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = position;
	

/*----------------------------------------------------------------------------------------------*/
function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
		return getObjNN4(document,objectId);
    } else {
	return false;
    } 
} 
/*----------------------------------------------------------------------------------------------*/
function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId, document);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
} 
/*----------------------------------------------------------------------------------------------*/
function findImage(name, doc) {
	var i, img;
	for (i = 0; i < doc.images.length; i++) {
    	if (doc.images[i].name == name) {
			return doc.images[i];
		}
	}
	for (i = 0; i < doc.layers.length; i++) {
    	if ((img = findImage(name, doc.layers[i].document)) != null) {
			img.container = doc.layers[i];
			return img;
    	}
	}
	return null;
}
/*----------------------------------------------------------------------------------------------*/
function getImage(name) {
	if (document.layers) {
    	return findImage(name, document);
	}
	return null;
}
/*----------------------------------------------------------------------------------------------*/
function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}
/*----------------------------------------------------------------------------------------------*/
function getElementHeight(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.height;
	} else {
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) {
			xPos = elem.style.pixelHeight;
		} else {
			xPos = elem.offsetHeight;
		}
		return xPos;
	} 
}
/*----------------------------------------------------------------------------------------------*/
function getElementWidth(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.width;
	} else {
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) {
			xPos = elem.style.pixelWidth;
		} else {
			xPos = elem.offsetWidth;
		}
		return xPos;
	}
}
/*----------------------------------------------------------------------------------------------*/
function getElementLeft(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageX;
	} else {
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;
	}
}
/*----------------------------------------------------------------------------------------------*/
function getElementTop(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.pageY;
	} else {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
	}
}
/*----------------------------------------------------------------------------------------------*/
function getImageLeft(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
    	if (img.container != null)
			return img.container.pageX + img.x;
		else
			return img.x;
  	} else {
		return getElementLeft(myImage);
	}
	return -1;
}
/*----------------------------------------------------------------------------------------------*/
function getImageTop(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		if (img.container != null)
			return img.container.pageY + img.y;
		else
			return img.y;
	} else {
		return getElementTop(myImage);
	}
	return -1;
}
/*----------------------------------------------------------------------------------------------*/
function getImageWidth(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.width;
	} else {
		return getElementWidth(myImage);
	}
	return -1;
}
/*----------------------------------------------------------------------------------------------*/
function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}
/*----------------------------------------------------------------------------------------------*/
function moveXY(myObject, x, y) {
	obj = getStyleObject(myObject)
	if (ns4) {
		obj.top = y;
 		obj.left = x;
	} else {
		if (op5) {
			obj.pixelTop = y;
 			obj.pixelLeft = x;
		} else {
			obj.top = y + 'px';
 			obj.left = x + 'px';
		}	
	}
}
/*----------------------------------------------------------------------------------------------*/
function changeClass(Elem, myClass) {
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	elem.className = myClass;
}
/*----------------------------------------------------------------------------------------------*/
function changeImage(target, source) {
	var imageObj;
	
	if (ns4) {
		imageObj = getImage(target);
		if (imageObj) imageObj.src = eval(source).src; 
	} else {
		imageObj = eval('document.images.' + target);
		if (imageObj) imageObj.src = eval(source).src; 
	}
}
/*----------------------------------------------------------------------------------------------*/
function loadImage(target, source) {
	var imageObj;
	
	if (ns4) {
		imageObj = getImage(target);
		if (imageObj) imageObj.src = source; 
	} else {
		imageObj = eval('document.images.' + target);
		if (imageObj) imageObj.src = source; 
	}
}
/*----------------------------------------------------------------------------------------------*/
function changeBGColour(myObject, colour) {
	if (ns4) {
		var obj = getObjNN4(document, myObject);
		obj.bgColor=colour;
	} else {
		var obj = getStyleObject(myObject);
		if (op5) {
			obj.background = colour;	
		} else {
			obj.backgroundColor = colour;
		}	
	}
}
/*----------------------------------------------------------------------------------------------*/
function getBodyHeight(){
  //retourne le contenu du body seulement sans les barres de taches et ascenseur
  var myHeight = 0
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight  ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}
/*----------------------------------------------------------------------------------------------*/
function getBodyWidth(){
	
  //retourne le contenu du body seulement sans les barres de taches et ascenseur
  var myWidth = 0
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth  ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
	
}
/*----------------------------------------------------------------------------------------------*/
function getScreenAvaillableWidth(){
	return screen.availWidth; 
}
/*----------------------------------------------------------------------------------------------*/
function getSceenAvaillableHeight(){
	return screen.availHeight; 
}
/*----------------------------------------------------------------------------------------------*/
function setLang(value) {
	var href = window.location.href;
	
	href = href.replace('http://', '');
	
	if (href.indexOf('#') > 0)
		href = href.substr(0, href.indexOf('#'));
	
	if (href.indexOf('?') > 0)
		href = href.substr(0, href.indexOf('?'));
	
	var arHref = href.split('/');
	
	arHref[2] = value;
	
	//alert('http://' + arHref.join('/') + window.location.hash);
	window.location.href = 'http://' + arHref.join('/') + window.location.hash;
}
//setLang('fr');

/*----------------------------------------------------------------------------------------------*/
/*--------------------- Info bulle---------------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/

// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()"; 

/*
MOVE this to the <body>:
*/

var texte = "";
var timer;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
var ombreSTYLE="";

function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4){
        toolTipSTYLE = document.toolTipLayer;
        ombreSTYLE = document.toolTipLayer_ombre;
     }else if(ns6) {
        toolTipSTYLE = document.getElementById("toolTipLayer").style;
        ombreSTYLE = document.getElementById("toolTipLayer_ombre").style;
     }else if(ie4) {
        toolTipSTYLE = document.all.toolTipLayer.style;
        ombreSTYLE = document.all.toolTipLayer_ombre.style;
     }
     
    if(ns4){ 
        document.captureEvents(Event.MOUSEMOVE);
    }else{
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
      ombreSTYLE.visibility = "visible";
      ombreSTYLE.display = "none";
    }
    // supprimmer cause clignotement sur IE
   // document.onmousemove = moveToMouseLoc;
  }
}
function lanceAide(msg){
    //
	if(lanceAide.arguments.length > 0){
		texte = msg;
		timer = setTimeout("toolTip()", 1000);
	}else{
		texte = "";
		window.clearTimeout(timer);
		toolTip();
	}
}

function toolTip(msg, fg, bg)
{
  if(texte == "") // hidetoolTip.arguments.length < 1
  {
    if(ns4){
         toolTipSTYLE.visibility = "hidden";
         ombreSTYLE.visibility = "hidden";
     }else{
         toolTipSTYLE.display = "none";
         ombreSTYLE.display = "none";
     }
  }
  else // show
  {
  	msg = texte;
    if(!fg) fg = "#FF0000";
    if(!bg) bg = "#FFFFFF";
	
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" class="table_toolTypParent"><tr><td>' +
    '<table border="0" cellspacing="0" cellpadding="4" class="table_toolTyp">'+ 
    '<tr><td align="left" class="td_toolTyp"><img src="img/1px/1px_trans.gif" width="100" height="1" border="0"><br>' + msg +
    '</td></tr></table></td></tr></table>';
	//alert(content);
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
      ombreSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
      ombreSTYLE.display='block'
    }
     ombreSTYLE.width = getElementWidth("toolTipLayer") + "px";
     ombreSTYLE.height = getElementHeight("toolTipLayer") + "px";
  }
}
// fonction utilisée par la méthode object.js/divObject.prototype.onMouseOver_

function moveToMouseLoc(e)
{
	/*
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY ;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  */
  var xcoord, ycoord;
  if( !e ) { e = window.event; }
  if( !e ) { return; }
  if( typeof( e.pageX ) == 'number' ) {
	xcoord = e.pageX;
	ycoord = e.pageY;
  } else if( typeof( e.clientX ) == 'number' ) {
	xcoord = e.clientX;
	ycoord = e.clientY;
	if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	  xcoord += document.body.scrollLeft;
	  ycoord += document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	  xcoord += document.documentElement.scrollLeft;
	  ycoord += document.documentElement.scrollTop;
	}
  } else { return; }
  
  
  ejs_context_x = xcoord + offsetX;
  ejs_context_y = ycoord + offsetY;
  
  
  
  if(toolTipSTYLE.visibility == "visible"){
	 moveXY("toolTipLayer", (xcoord + offsetX), (ycoord + offsetY));
 	 moveXY("toolTipLayer_ombre", ((xcoord + offsetX) + 3), ((ycoord + offsetY) + 3));
 }
  window.status = 'move...'+ xcoord +' : '+ ycoord;
  return true;
}
