


var AUTHREP = cibip();

// JavaScript Document
// AJOUT AV POUR identification N°1
var n_uri = self.location.href.toString() ; 
if ( n_uri.indexOf("/sommaire/") != -1 ){
// on est dans sommaire 
   if (document.cookie.indexOf("webanesth") == -1) window.top.location.href="/site/AUTO/identification.htm";
}



var ident=false;
var cook = document.cookie
if(cook.indexOf("user=") != -1)
{
	ident = true;
}
//ident=true;

function getUser(){
var dc = document.cookie;
dc = unescape(dc);
var p = dc.indexOf("user=");
    if (p!=-1){
	   var p2 = dc.indexOf("#",p);
	   if (p2 != -1){
	     var info = new Array();
	     info = dc.substring(p+5,p2).split("|");
		 if (document.getElementById("logged")){
		 var init = document.getElementById("logged").innerHTML;
		// document.getElementById("logged").innerHTML = "Vous êtes identifié en tant que <font color=\"red\">"+info[0]+"&nbsp;"+info[1]+"</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "+init;
		 hideIdentFields(info);
		 }
	  }// fin if p2
	}
}

getUser();

function hideIdentFields(info){
         var z1 = document.getElementById("email");
		  var pz1;
		  if(z1){
		if (window.ActiveXObject) pz1 = z1.parentElement; else pz1 = z1.parentNode;    
		  pz1.className="titrenoir";
		  pz1.innerHTML = " Bienvenue ";
		  var z2 = document.getElementById("password");
		  var pz2 ;
		if (window.ActiveXObject) pz2 = z2.parentElement; else pz2 = z2.parentNode;   
		 if (AUTHREP.indexOf("true") == -1)
		   pz2.innerHTML = "<font color=\"red\">"+info[0]+"&nbsp;"+info[1]+"&nbsp;<a href=\"/STH/maj_infoperso.jsp\"><img src=\"/images/info.gif\" alt=\"Accéder à mes informations personnelles\" border=\"0\"></font></A>";
		else
		    pz2.innerHTML = "<font color=\"red\">"+info[0]+"&nbsp;"+info[1]+"</font>";
		  var pz3 = document.getElementsByTagName("IMG");
		    for (var i=0 ; i < pz3.length ; i++){
			  if (pz3[i].src.indexOf("/btn_ok") != -1){
			  
			     if (window.ActiveXObject) pz3[i].parentElement.innerHTML="&nbsp;"; else pz3[i].parentNode.innerHTML="&nbsp;";   
			  
			      break; // on s'en va 
			  }
		    } // fin for 
		  }
}

function Centrer(page,name,largeur,hauteur,options) {
  var haut=(screen.height-hauteur)/2;
  var gauche=(screen.width-largeur)/2;
  window.open(page,name,"top="+haut+",left="+gauche+",width="+largeur+",height="+hauteur+","+options);
}

function findPWD(){
Centrer("/site/AUTO/ask_email.htm","Recherche",280,170,"resizeable=no, scrollbar=auto");
}

function specialEscape(myChaine){
// codage pour safari
var HexCode = new Array("22","26","3C","3E","A0","A1","A2","A3","A4","A5",
			"A6","A7","A8","A9","AA","AB","AC","AD","AE","AF",
			"B0","B1","B2","B3","B4","B5","B6","B7","B8","B9",
			"BA","BB","BC","BD","BE","BF","C0","C1","C2","C3",
			"C4","C5","C6","C7","C8","C9","CA","CB","CC","CD",
			"CE","CF","D0","D1","D2","D3","D4","D5","D6","D7",
			"D8","D9","DA","DB","DC","DD","DE","DF","E0","E1",
			"E2","E3","E4","E5","E6","E7","E8","E9","EA","EB",
			"EC","ED","EE","EF","F0","F1","F2","F3","F4","F5",
			"F6","F7","F8","F9","FA","FB","FC","FD","FE","FF");

var hex_array = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
var newChaine = "";
     for (i=0;i<myChaine.length;i++){
       var code = myChaine.charCodeAt(i);// code decimal
       var hex = hex_array[parseInt(code/16)]+""+hex_array[code%16];// code hexadecimal
	   var found = false;
	    for (h = 0; h< HexCode.length;h++){
		  if (hex == HexCode[h]){
		   newChaine+="%"+hex;
		   found=true;
		   break;
		  }		  
		}// fin for h
	  if (!found)
	   newChaine+=myChaine.charAt(i);	
     }
return newChaine;
}

function send_search()
	{
	// patch av 12 11 07
	//ident = true;
	if(ident == true)
	{
		if(document.getElementById("txtsearch").value == "" || document.getElementById("txtsearch").value == "Rechercher dans le site")
		{
			alert("Merci d'indiquer l'objet de votre recherche");
			document.getElementById("txtsearch").focus();
			return false;
		}
		if(document.getElementById("txtsearch").value.length < 3 )
		{
			alert("Le nombre de caractères recherchés ne peut être inférieur à 3");
			document.getElementById("txtsearch").focus();
			return false;
		}
	var str_recherche = document.getElementById("txtsearch").value.replace("+","2B");
	// ajout av 10 12 04
	// on fait un codage particulier pour safari
	 if (navigator.userAgent.toLowerCase().indexOf("safari")!=-1)
	 the_url = '/mdr/attente.htm?nbelement=10&txtsearch='+specialEscape(str_recherche)+'&lang='+document.getElementById("lang").value;
	else {
	  the_url = '/mdr/attente.htm?nbelement=10&txtsearch='+escape(str_recherche)+'&lang='+document.getElementById("lang").value;
	 }
	// patch JCG 121207 suppresion du call centrer
	//Centrer(the_url,"Recherche",300,240,"resizeable=auto, scrollbar=auto");
		var largeur = 300;
		var hauteur = 320;
        var haut=150;
  		var gauche=50;
		//var opts="top="+haut+",left="+gauche+",width="+largeur+",height="+hauteur+",scrollbars=auto";
		var opts="\"width="+largeur+", height="+hauteur+", resizable=1, scrollbars=1\"";
		var win_res = window.open(the_url,"Recherche",opts);
		win_res.moveTo(150,50);
		win_res.resizeTo(300,320);
		//} on remonte l'accolade sinon ça marche jamais sur safari
}else{
		alert("Message de Webanesthésie : vous devez être identifié pour accéder à ce module");
	}
	}
function get_keycode(e)
{
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		if(event.keyCode == 13)
			send_search();
	}
	if(navigator.appName == "Netscape")
	{
		if(e.which == 13)
			send_search();
	}
	
}
function Centrer(page,name,largeur,hauteur,options) {
  var haut=(screen.height-hauteur)/2;
  var gauche=(screen.width-largeur)/2;
  window.open(page,name,"top="+haut+",left="+gauche+",width="+largeur+",height="+hauteur+","+options);
}
function clear_txt(id){
	document.getElementById(id).value="";
}




function cibip(){ 
var REPONSE="null";
 var xmlHTTP = (window.ActiveXObject) ? new ActiveXObject("MICROSOFT.XMLHTTP") : new XMLHttpRequest();/*OBJET HTTPRequest*/
 if (xmlHTTP){
               xmlHTTP.onreadystatechange = function(){
			   //window.status = xmlHTTP.status;
			   if ( (xmlHTTP.readyState==4) && (xmlHTTP.status==200) ){REPONSE=xmlHTTP.responseText;}// fin if
      }// fin fn() event

   xmlHTTP.open("GET","/STH/AUTO/cibip.jsp",false);
   xmlHTTP.send(null); 
 }
 return REPONSE;
} // fin 
//________________________________________________________GESTION PUB________________________________________________


//____________________________________________________________________________________________________________________

var sas_tmstp=Math.round(Math.random()*10000000000); var sas_masterflag=1;
function SmartAdServer(sas_pageid,sas_formatid,sas_target) {
if (sas_masterflag==1) {sas_masterflag=0;sas_master='M';}
else {sas_master='S';}; 
document.write('<scr'+'ipt SRC="http://www.smartadserver.com/call/pubj/' + sas_pageid + '/' + sas_formatid + '/'+sas_master + '/' + sas_tmstp + '/' +escape(sas_target) + '?"></scr'+'ipt>');

}


function pubHaut(){

    if (ident){
	    sas_pageid='3909/25647';      //
		sas_formatid=940;             // emplacement du haut
		sas_target='';                // Targeting
		SmartAdServer(sas_pageid,sas_formatid,sas_target);
	
	}else{
	    sas_pageid='3909/25298';      //
		sas_formatid=940;             // emplacement du haut
		sas_target='';                // Targeting
		SmartAdServer(sas_pageid,sas_formatid,sas_target);
	}

}

function pubPave(){
    if (ident){
	    sas_pageid='3909/25647';      // Page :wolterskluwer/web-anesthesie/hp_identifie
		sas_formatid=947;             // pavé
		sas_target='';                // Targeting
		SmartAdServer(sas_pageid,sas_formatid,sas_target);
		
	}else{
	    sas_pageid='3909/25298';      //
		sas_formatid=947;             // Format : pavé
		sas_target='';                // Targeting
		SmartAdServer(sas_pageid,sas_formatid,sas_target);
	}


}


function pubCoteDroit(){

 if (ident){
	    sas_pageid='3909/25647';      //
		sas_formatid=1142;             // skyscraper
		sas_target='';                // Targeting
		SmartAdServer(sas_pageid,sas_formatid,sas_target);
	
	}else{
		sas_pageid='3909/25298';      // Page :wolterskluwer/web-anesthesie/hp_non_identifie
		sas_formatid=1142;             // skyscraper
		sas_target='';                // Targeting
		SmartAdServer(sas_pageid,sas_formatid,sas_target);
	}

}


function putPub(){
if(document.getElementById("PUBHAUT")){
var noeud    = document.getElementById("PUBHAUT");
var father = noeud.parentNode;//TD
var gfather = father.parentNode;//TR

var nav = navigator.appName;
//alert(gfather.childNodes.length);
   if (gfather.childNodes.length == 2){
      gfather.removeChild(gfather.childNodes[1]);
      gfather.childNodes[0].colSpan+=1; 
   }else{
    
	gfather.removeChild(gfather.childNodes[3]);
	  gfather.childNodes[1].colSpan+=1; 
   }	  

 }
}

///////////////_______________________XITI___________________///////////////////////////////
var xtpage =  "";
var the_uri = self.location.href.toString();
var rep = new Array();
rep = the_uri.split("/");
if (rep.length > 4){
 xtpage = rep[rep.length -2];// le dernier repertoire
}
 

xtnv =  document;        //parent.document or  top.document or document          
xtsd = "http://logi141";
xtsite = "325423";
xtn2 = "";         // level 2 site 
//xtpage =  "qualite";        //page name (with the use  of :: to create chapters)
xtdi = "";         //implication  degree

// debut xiti.js////









