/* ----------------------------------------- Détection du navigateur  ----------------------------------------------- */
_ps=parseInt(navigator.productSub);
isIE=(document.all)?true:false;
isIE4=(!document.getElementById&&isIE)?true:false;
isIE5=(!isIE4&&isIE&&!window.createPopup)?true:false;
isIE55=(!isIE4&&isIE&&window.createPopup)?true:false;
isIE6=(isIE&&document.getElementById)?true:false;
isNS6=(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1)?true:false;
isKONQ=(navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1)?true:false;
isSAFARI=(navigator.userAgent.toLowerCase().indexOf("safari")!=-1)?true:false;
isMOZILLA=(navigator.userAgent.toLowerCase().indexOf("mozilla")!=-1)?true:false;
if(isKONQ||isSAFARI){_ps=0;isNS6=0;}
isNS4=(document.layers)?true:false;
isNS61=(_ps>=20010726)?true:false;
isNS7=(_ps>=20020823)?true:false;
isOPERA=(window.opera)?true:false;
if(isOPERA||isKONQ)isIE=0;
isOPERA5=(navigator.userAgent.toLowerCase().indexOf("opera 5")!=-1)?true:false;
isOPERA6=(navigator.userAgent.toLowerCase().indexOf("opera 6")!=-1)?true:false;
isOPERA7=(navigator.userAgent.toLowerCase().indexOf("opera 7")!=-1||navigator.userAgent.toLowerCase().indexOf("opera/7")!=-1)?true:false;
isMAC=(navigator.appVersion.toLowerCase().indexOf("mac")!=-1)?true:false;
isMAC45=(navigator.appVersion.toLowerCase().indexOf("msie 4.5")!=-1)?true:false;
if(isNS61||isNS4||isOPERA||isSAFARI)isMAC=false;
isNS60=false;
if(isNS6&&!isNS61)isNS60=true;
if(isOPERA7)isOPERA=false;
if(isOPERA)isIE55=false;

/* ----------------------------------------- Ouverture de popup  ----------------------------------------------- */
// Si x et y ne sont pas mentionnés, la popup est automatiquement centrée

function openPopup(url,nomPopup,myScroll,l,h,x,y,myResizable){
	var win;
	if (x == null) {
		x = screen.width/2 - l/2;
	}
	if (y == null){
		y = screen.height/2 - h/2;
	}
	if (myScroll != 'no'){
		myScroll = 'yes';
	}
	if (myResizable != 'yes'){
		myResizable = 'no';
	}
	win=open(url,nomPopup,'width=' + l + ',height=' + h + ',status=no,toolbar=no,menubar=no,location=no,resizable=' + myResizable + ',titlebar=no,scrollbars=' + myScroll + ',fullscreen=no,left=' + x + ',top=' + y);
	win.focus();
	return win;
}

// Si x et y ne sont pas mentionnés, la popup est automatiquement centrée
function openModalPopup (url,args,myScroll,l,h,x,y,myResizable){

	if (x == null) {
		x = screen.width/2 - l/2;
	}
	if (y == null){
		y = screen.height/2 - h/2;
	}
	if (myScroll != 'no'){
		myScroll = 'yes';
	}
	if (myResizable != 'yes'){
		myResizable = 'no';
	}
	
	var sSettings = "help:no;border:thin;status:no;toolbar:no;menubar:no;location:no;scrollbars:" + myScroll + ";resizable:" + myResizable + ";dialogHeight:" + h + "px;dialogWidth:" + l + "px;dialogTop:" + y + "px;dialogLeft:" + x + "px";
	return window.showModalDialog(url,args,sSettings);
}

/*
Pour retourner une valeur : window.returnValue="toto";
Pour la récuperer : maValeur = window.showModalDialog(url,args,sSettings);
*/


function openLink(URI, NewWin){
	if(NewWin == null || NewWin == false)
	{
		document.location.href = URI;
	}
	else {
		win = window.open(URI,"secWin");
		win.focus;
	}
}

// utiliser cette fonction pour récupérer un objet en fonction du navigateur
function getElem (nom) {
	
	var tmp = null;
	
	if (nom != ""){
		if (isNS4) {
			tmp = nav4FindLayer(document, nom);
		}
		else if (isNS6 || isIE6) {
			tmp = eval('document.getElementById("' + nom + '")');
		}
		else {
			tmp = eval('document.all.' + nom);
		}
	}

	return ((tmp!=null) ? tmp : false);
}

// utiliser cette fonction pour récupérer le style d'un objet en fonction du navigateur
function getElemStyle (nom) {
	var tmpElem = getElem (nom);
	
	return (isNS4) ? tmpElem : (tmpElem) ? tmpElem.style : false;
}


function nav4FindLayer(doc, id)
{
  var i;
  var subdoc;
  var obj;
  
  for (i = 0; i < doc.layers.length; ++i)
  {
    if (doc.layers[i].id && id == doc.layers[i].id)
      return doc.layers[i];
      
    subdoc = doc.layers[i].document;
    obj    = nav4FindLayer(subdoc, id);
    if (obj != null)
      return obj;
  }
  return null;
}


/* ----------------------------------------- Roll over sur les images  ----------------------------------------------- */
// les images de boutons qui possèdent un rollover doivent finir par
// --    "_on.ext" pour l'image affichée quand le pointeur se trouve sur le bouton
// --    "_off.ext" pour l'image affichée quand le pointeur sort du bouton
function rollOn (img){
var tmp;

tmp = img.src ;
img.src = tmp.replace("_off.","_on.");
}

function rollOff (img){
var tmp;

tmp = img.src ;
img.src = tmp.replace("_on.","_off.");
}


/* -------------------------------------- Roll over avec changement de feuille de style -------------------------------------------- */
function classOn(obj, newClass)
{
	obj.LastClass = obj.className;
	obj.className = newClass;
}

function classOff(obj)
{
	obj.className = obj.LastClass;
}

