//Fonctions permettant d'afficher les liens dans les layeurs
var hide  = true;

function showhide(obj)
{
	var x = new getObj('testP');
	hide = !hide;
	setLyr(obj,'testP');
	x.style.visibility = (hide) ? 'hidden' : 'visible';
}

function setLyr(obj,lyr)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	// x.style.top = newY-2;
	x.style.top = newY+2;
	x.style.left = newX-2;
}

function findPosX(obj)
{
	var curleft = 15;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (document.layers)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 20;
	//var printstring = '';
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			//printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (document.layers)
		curtop += obj.y;
	//window.status = printstring;
	return curtop;
}


function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

//fonction qui change la page cible à partir liste déroulante
function chgpage(formulaire)
{
if (formulaire.strLangue.selectedIndex != 0)
{
location.href = formulaire.strLangue.options[formulaire.strLangue.selectedIndex].value;
}
}

// fonction qui ouvre une alerte
function OuvreAlert(strUrl, strTypeMsg, strLng)
{
var strMsg;
var strUrlAlerte;
	switch (strTypeMsg)
	{
		 case 'Info' :  
		 				switch (strLng)
						{
							case 'EN' : 
										strMsg = 'The information on this page is intended for use only by health care specialists.\nIf you choose to continue please acknowledge that some of the terms used may be difficult to understand.';
										break;
							case 'FR' : 
										strMsg = 'L\'information contenue sur cette page est destinée à des spécialistes.';
										break;
																				
							default   : break;
							
						};
						break;
						

		default : break;
		 
		 
	}
	//if (confirm(strMsg))
	//{
	//	window.location.href = strUrl;
	//}
//	open("intro.asp","new_window", "width=500,height=300,toolbar=no,userbar=no,location=no,status=yes,menubar=no,screenX=100,screenY=100,scrollbars=no");

	strUrlAlerte = '/lib/avertissement.asp?strUrl=' + escape(strUrl) + '&strTypeMsg=' + strTypeMsg + '&strLng=' + strLng;
	window.open(strUrlAlerte,"new_window", "width=500,height=260,toolbar=no,userbar=no,location=no,status=yes,menubar=no,screenX=100,screenY=100,scrollbars=no");

}

function OuvreRef(strRepertoire, strTypeReference)
{
var strUrlAlerte;


strUrlAlerte = '/lib/references.asp?strRepertoire=' + strRepertoire + '&strTypeReference=' + strTypeReference;
window.open(strUrlAlerte,"new_window", "width=500,height=315,toolbar=no,userbar=no,location=no,status=yes,menubar=no,screenX=100,screenY=100,scrollbars=no");

}
function AlertAccueil(strRepertoire, strTypeReference)
{
var strUrlAlerte;


strUrlAlerte = '/lib/references.asp?strRepertoire=' + strRepertoire + '&strTypeReference=' + strTypeReference;
window.open(strUrlAlerte,"new_window", "width=500,height=430,toolbar=no,userbar=no,location=no,status=yes,menubar=no,screenX=100,screenY=100,scrollbars=no");

}


function msieversion()
{
    var ua   = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE");
    if (msie>0)
        return parseInt(ua.substring(msie+5, ua.indexOf(".", msie)));
    else
        return 0;
}



function NAF(szUrl, szQuery)
{	var newwin;
    if (msieversion() >= 5)
	{
		//window.external.NavigateAndFind(szUrl, szQuery, '');
		var newwin = window.open(szUrl, 'newwin', '');
		FD983r={
		x:function()
		{	var r,i,s=newwin.selection.createRange().text;
			s = szQuery;
			if(s){r=newwin.body.createTextRange();
			for(i=0;r.findText(s);i++)
				{r.execCommand('BackColor','','yellow');
				 r.collapse(false)};
				 //alert(i)
				 }
		}
		};
		FD983r.x();
	}
    else
        //window.navigate(szUrl, target="vide");
        // pour NN4
        var w = window.open(szUrl, 'w', '');
		w.find (szQuery);
}