function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
  if(name == 'print'){
  
  }
}

function AC(obj,lpath){

if(typeof(apcphpkod) == 'object'){
	lpath = apcphpkod.constantes.ICO_PATH;
} else{
	lpath = lpath+'themes/templates/lib/';
}
var etat = document.getElementById(obj);
	if(typeof(etat) == 'object')
		{
	etat = etat.style.display;
	if(etat == 'none' || etat == '' || etat == 'undefined'){ 
	document.getElementById(obj).style.display="block";
	document.getElementById(obj+'_img').src=lpath+'small/red.png';
	}
	else { 
	document.getElementById(obj).style.display="none";
	document.getElementById(obj+'_img').src=lpath+'small/plus.png';
	}
		}
}
function ACB(obj,lpath){
	
	if(typeof(apcphpkod) == 'object'){
	lpath = apcphpkod.constantes.ICO_PATH;
	} else{
		lpath = lpath+'themes/templates/lib/';
	}
	var etat = document.getElementById(obj).style.display;
	if(etat == 'none'){ 
	document.getElementById(obj+'-top').className='topover';
	document.getElementById(obj).style.display="block";
	document.getElementById(obj+'_img').src=lpath+'li/dev.gif';
	}
	else { 
	document.getElementById(obj).style.display="none";
	document.getElementById(obj+'-top').className='top';
	}
}

function cacher(obj){
	document.getElementById(obj).style.display="none";
}
function ShowHide(id){
	cible=document.getElementById(id);
	if(cible.style.display == 'none'){ cible.style.display="block"; }
	else { cible.style.display="none"; }
}
function chk(name,url,la,ha){
	var top=(screen.height-ha)/2;
	var left=(screen.width-la)/2;
	na_open_window(name, url, top, left, la, ha, 0, 0, 0, 0, 0);
}

function centrePop(url,largeur,hauteur) { // centre le PopUp sur l'écran
      var gauche = (screen.width - largeur)/2;
      var haut =  (screen.height - hauteur)/2;
      return window.open(url,"","width="+largeur+",height="+hauteur+",left="+gauche+",top="+haut);
      }
     
function infos() {
      var adr = centrePop("",350,230);
      adr.document.write("<title>Infos</title><center><b>Vos paramètres par JavaScript</b></center><br>");
      adr.document.write("Résolution : "+screen.width+"x"+screen.height+"<br>");
      adr.document.write("Couleurs : "+screen.colorDepth+" bits<br>");
      adr.document.write("Navigateur : "+navigator.appName+"<br>");
      adr.document.write("Version : "+navigator.appVersion+"<br>");
      adr.document.write("Référent : "+document.referrer+"<br>");
      adr.document.write("<center><br><A href='javascript:window.close()'>Fermer le PopUp</A>");
      }

function refreshpage()
{
// puis on recharge la frame du bas
opener.top.body.location.reload(true);
opener.top.WIN_HISTO.location.reload(true);
// et enfin on ferme cette fenêtre de saisie
}

function namosw_goto_byselect(sel, targetstr)
{
  var index = sel.selectedIndex;
  if (sel.options[index].value != '') {
     if (targetstr == 'blank') {
       window.open(sel.options[index].value, 'win1');
     } else {
       var frameobj;
       if (targetstr == '') targetstr = 'self';
       if ((frameobj = eval(targetstr)) != null)
         frameobj.location = sel.options[index].value;
     }
  }
}


var display_url=1 
function showmenu(){ 
var rightedge=document.body.clientWidth-event.clientX 
var bottomedge=document.body.clientHeight-event.clientY 
  
if (rightedge<menu.offsetWidth) 
menu.style.left=document.body.scrollLeft+event.clientX-menu.offsetWidth 
else 
menu.style.left=document.body.scrollLeft+event.clientX 
  
if (bottomedge<menu.offsetHeight) 
menu.style.top=document.body.scrollTop+event.clientY-menu.offsetHeight 
else 
menu.style.top=document.body.scrollTop+event.clientY 
  
menu.style.visibility="visible" 
return false 
} 
  
function hidemenu(){ 
menu.style.visibility="hidden" 
} 
  
function over(){ 
if (event.srcElement.className=="menuitems"){ 
event.srcElement.style.backgroundColor="highlight" 
event.srcElement.style.color="yellow" 
if (display_url==1) 
window.status=event.srcElement.url 
} 
} 
  
function out(){ 
if (event.srcElement.className=="menuitems"){ 
event.srcElement.style.backgroundColor="" 
event.srcElement.style.color="black" 
window.status='' 
} 
} 
  
function linkTo(){ 
if (event.srcElement.className=="menuitems") 
window.location=event.srcElement.url 
}
/*
function namosw_goto_byselect(sel, targetstr)
{
  var index = sel.selectedIndex;
  if (sel.options[index].value != '') {
     if (targetstr == 'blank') {
       window.open(sel.options[index].value, 'win1');
     } else {
       var frameobj;
       if (targetstr == '') targetstr = 'self';
       if ((frameobj = eval(targetstr)) != null)
         frameobj.location = sel.options[index].value;
     }
  }
}
function afficher(obj){
    if(isNav){
        document.getElementById(obj).style.display = "";
    }
    else{
        document.getElementById(obj).style.visibility = "visible";
    }
}

function cacher(obj){
    if(isNav){
        document.getElementById(obj).style.display = "none";
    }
    else{
        document.getElementById(obj).style.visibility = "hidden";
   }
}
*/
function detectversion(cookie,pageprov) { // début de la fonction de détection
/*
var OuAller = ""; // vide la variable OuAller
var NomNav = navigator.appName; // place le nom du navigateur dans la variable NomNav 
var VersNav = navigator.appVersion; // place la version du navigateur dans la variable VersNav 
var NumVers = parseFloat(VersNav); // transforme en numérique flottant 

if (NumVers >= 4 && NomNav == "Netscape") { // teste si NS et >= à 4 
OuAller = ("http://www.tlefrance.com/V3/move_nav.php?nav=Mozilla&page_prov="+pageprov); // met la bonne page dans OuAller

} 
if (NumVers >= 4 && NomNav == "Microsoft Internet Explorer") { // MIE et >= à 4 
//OuAller = ("Pagemie4.htm"); // met la bonne page dans OuAller 
} 

if (NumVers < 4 && NomNav == "Netscape") { // teste si NS et < à 4 
OuAller = ("http://www.tlefrance.com/V3/nopage.php"); // met la bonne page dans OuAller
}

if (NumVers < 4 && NomNav == "Microsoft Internet Explorer") { // si MIE et < à 4 
//OuAller = ("Pagemie3.htm"); // met la bonne page dans OuAller
OuAller = ("http://www.tlefrance.com/nopage.php"); // met la bonne page dans OuAller
} 
if (OuAller == "" && (NumVers < 4 && NomNav != "Microsoft Internet Explorer")) { // si autre, rien de tout ça 
OuAller = ("http://www.tlefrance.com/V3/move_nav.php?nav=Mozilla&page_prov="+pageprov); // met la bonne page dans OuAller 

}

//alert(cookie+OuAller); 
if(OuAller != "" && cookie == ""){
document.location = OuAller 
}
*/
} 


/*- Detecxtion de la versoin 
* Windows NT: Navigator 4, Navigator 3, and Navigator 2; Internet Explorer 5; Internet Explorer 3; Opera 3
* Windows 98: Netscape 6;Navigator 4.76; Internet Explorer 4; Internet Explorer 5; Internet Explorer 5.5; Opera 5; HotJava 3
* Macintosh: Navigator 4, Internet Explorer 3.01, Internet Explorer 4.02
* RedHat Linux 6.2: Navigator 4.6; Netscape 6
* SunOS5: Navigator 3
*/

//<!--
// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999-2001. Permission granted to reuse and distribute.
// Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
// Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
// also added support for IE5.5 Opera4&5 HotJava3 AOLTV
// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4,
// correct Opera 5 detection
// add support for winME and win2k
// synch with browser-type-oo.js
// Revised 26 Mar 01 to correct Opera detection
// Revised 02 Oct 01 to add IE6 detection

// Everything you always wanted to know about your JavaScript client
// but were afraid to ask. Creates "is_" variables indicating:
// (1) browser vendor:
// is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
// (2) browser version number:
// is_major (integer indicating major version number: 2, 3, 4 ...)
// is_minor (float indicating full version number: 2.02, 3.01, 4.04 ...)
// (3) browser vendor AND major version number
// is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
// is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_ie6, is_ie6up, is_hotjava3, is_hotjava3up,
// is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
// (4) JavaScript version number:
// is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
// (5) OS platform and version:
// is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
// is_os2
// is_mac, is_mac68k, is_macppc
// is_unix
// is_sun, is_sun4, is_sun5, is_suni86
// is_irix, is_irix5, is_irix6
// is_hpux, is_hpux9, is_hpux10
// is_aix, is_aix1, is_aix2, is_aix3, is_aix4
// is_linux, is_sco, is_unixware, is_mpras, is_reliant
// is_dec, is_sinix, is_freebsd, is_bsd
// is_vms
//
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
// for detailed lists of userAgent strings.
//
// Note: you don't want your Nav4 or IE4 code to "turn off" or
// stop working when new versions of browsers are released, so
// in conditional code forks, use is_ie5up ("IE 5.0 or greater")
// is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
// to check version in code which you want to work on future
// versions.




function validate(msg,adress){
b = confirm (msg);
if(b){
window.location.replace(adress);
}
else {
return false;
}
}

function checkTr(laTr,leChk,i,style,colChk){
	var tr = document.getElementById(laTr);
	var Chk=document.getElementById(leChk+i);
	

	if(Chk.checked == false){
	Chk.checked=true;
	tr.style.backgroundColor=colChk;
	} else {
	Chk.checked=false;
	tr.style.backgroundColor="";
	}
	return true;

}

function lightTr(laTr,style,styleChk){
	var tr = document.getElementById(laTr);
	if(tr.style.backgroundColor="#59A9F9"){
	tr.style.backgroundColor="";
	} else {
	tr.style.backgroundColor="#59A9F9"
	}
	return true;

}

function lightTrTab(tr){
	
	if($(tr).hasClassName('focus'))
		$(tr).removeClassName('focus');
	else
		$(tr).addClassName('focus');

}

function SelectAll(laTr,leChk,deb,fin,style,styleChk){

	var i = deb;
	var laTrb;
	var LeChkb;
	while(i<fin){
		laTrb=laTr+i;
		checkTr(laTrb,leChk,i,style,styleChk);
		i++;
		
	}
}
function checker(id){
	//alert(id);
	var chk = document.getElementById(id);
	
	if(chk.checked == false)
		chk.checked = true;
	else
		chk.checked = false;
	
}


function highlight(event){
	this.style.background = '#D0E3F0';
}

function outlight(event){
	this.style.background = '';
}

function replace_l(champ,letter,convert) {
	var tmp = ''; 
	var a = document.getElementById(champ).value; 
	
	for(var i = 0; i < a.length; i++) 
	{ 
	  
		if (a.charAt(i) == letter) 
		{ 
		tmp = tmp + a.charAt(i).replace(letter,convert); 
		} 
		else {
		tmp = tmp + a.charAt(i); 
		}
	} 
	  
	document.getElementById(champ).value=tmp;

}
function mkButton(name,onclick,id){
	
	if(typeof(apcphpkod) != 'object'){ alert('Unable to create button. apcphpkod class not found.'); return false; }
	var myTplPath =  apcphpkod.constantes.HTTP_TPL_PATH;
	var o='<a href="javascript:void(0);" onclick="'+onclick+'">';
	o += '<img name="'+name+'" src="'+myTplPath+'buttons/'+name+'.png"';
	o += ' onmouseover="javascript:this.src=\''+myTplPath+'buttons/'+name+'_over.png\';"';
	o += ' onmouseout="javascript:this.src=\''+myTplPath+'buttons/'+name+'.png\';"';
	o += ' javascript:desactivate(this);"';
	//if(!isNaN(id))
		o+= ' id="'+id+'"';
	o += ' border="0" />';
	return o;
	
	
}

function getExt( fileName )
{
	var extension = "";
	var indicSlash = fileName.lastIndexOf("\\");
	var tabDecomp = fileName.substring(indicSlash+1).split(".");	
	extension = tabDecomp[tabDecomp.length-1];   
	return extension;
} 

function desactivate(elem){
	
	var CPATH = apcphpkod.constantes.HTTP_TPL_PATH;
	if(getExt(elem.attributes.src.value) == 'png')
		elem.attributes.src.value = CPATH+'buttons/'+elem.name+'_disabled.png';
	else
		elem.attributes.src.value = CPATH+'buttons/'+elem.name+'_disabled.gif';

	elem.removeAttribute('onmouseover');
	elem.removeAttribute('onmouseout');
	elem.removeAttribute('onclick');


}

function check(element_id){
	
	var element = document.getElementById(element_id);
	
	if(element.checked == true)
		element.checked = false;
	else
		element.checked = 'checked';
	
	return true;
	
}

function selection_champs(champs,champs_affiche){
   //on récupère l'endroit sélectionner dans le select source
    selection = champs.selectedIndex;
    if(selection != -1){
        //on déselectionne tous les champs du select de destination où va être placer le(s) champ(s) selectionner
        while(champs_affiche.selectedIndex != -1){
            champs_affiche.options[champs_affiche.selectedIndex].selected = false;
        }

        while(champs.selectedIndex > -1){
            if(champs.options[champs.selectedIndex].value == "Id_type_bien"){
                champs.options[champs.selectedIndex] = null;
                champs.form.Id_categorie_bien.options[0].select= true;
            }else{
                //on cherche la place de notre champ
                for(place=0;place<champs_affiche.length;place++){
                    if(champs_affiche.options[place].text > champs.options[champs.selectedIndex].text){
                        break;
                    }
                }
                //on décale tous les champs
                for(i=champs_affiche.length;i>place;i--){
                    champs_affiche.options[i] = new Option(champs_affiche.options[(i-1)].text,champs_affiche.options[(i-1)].value);
                }

                //on insère le champ selectionner
                champs_affiche.options[place] = new Option(champs.options[champs.selectedIndex].text,champs.options[champs.selectedIndex].value);
                champs.options[champs.selectedIndex] = null;
                champs_affiche.options[place].selected = true;
            }
        }

        if(champs.length > 0){
            if(selection >= champs.length ){
                selection = champs.length-1;
            }
            champs.options[selection].selected = true;
        }
    }
}

function priorite_champ(selection,mode){
    if(selection.length < 2 ){return;}
    old_place = selection.selectedIndex;
    if(mode == 'up' && old_place > 0){
        new_place = old_place-1;
    }else if(mode == 'down' && old_place < selection.length-1){
        new_place = old_place+1;
    }
    
    tmp = new Option(selection.options[new_place].text,selection.options[new_place].value);
    selection.options[new_place] = new Option(selection.options[old_place].text,selection.options[old_place].value);
    selection.options[old_place] = new Option(tmp.text,tmp.value);
    selection.options[new_place].selected = true;
}

function select_all(frm){
    for(i=0;i<frm.length;i++){
        frm.options[i].selected = true;
    }

}
function release_btn(conteneur,id_btn){

	var el = document.getElementById(conteneur);
	if(typeof(el) != 'object')
		return false;
	
	el = el.getElementsByTagName('a');
	
	if(typeof(el) != 'object')
		return false;

	for(i=0;i<el.length;i++){		
		el[i].className = '';
	}

	document.getElementById(id_btn).className='over';

}
function display(id,display){

	el = document.getElementById(id);
	
	if(display == true)
		el.style.display = 'block';
	else if(display == false)
		el.style.display = 'none';
	else if(el.style.display == 'block')
		el.style.display = 'none';
	else
		el.style.display = 'block';

}

var ss=0;
var s=00;
var m='0'+0;
var h='0'+0;
var j=0;

function Chrono() {

	if (m==0) {m='00'}
	if(h==0) {h='00'}
	if (ss<10){ss='0'+ss;}
	if (s<10){s='0'+s;}

	document.getElementById('Chrono').innerHTML = h + ' : ' + m + ' : ' + s ;
	
	s++;
	ss++;
	if (h==24){h='0'+0;j++;}
	if (s==60){s=0;s=0; m++;if(m<10){m='0'+m;}}
	if (m==60){m='0'+0;h++;if(h<10){h='0'+h;}}
	chrono=window.setTimeout("Chrono();",1000);

}

function resetAndChrono(){

	s=0;m=0;j=0;h=0;ss=0;
	Chrono();

	
}
function autotab(elem,idnext,count){
	
	if(elem.value.length >= count) {
		document.getElementById(idnext).focus();
	}
	
}


// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();

// *** BROWSER VERSION ***
// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

// Note: Opera and WebTV spoof Navigator. We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) ||
(agt.indexOf("; nav") != -1)) );
var is_nav5 = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));
var is_nav6 = (is_nav && (is_major == 5));	//
var is_nav6up = (is_nav && (is_major >= 5));	// Pr bug ?
var is_gecko = (agt.indexOf('gecko') != -1);


var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
var is_ie7 = (is_ie && (is_major == 4) && (agt.indexOf("msie 7.")!=-1) );
var is_ie7up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5 && !is_ie6);

// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
// or if this is the first browser window opened. Thus the
// variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
var is_aol = (agt.indexOf("aol") != -1);
var is_aol3 = (is_aol && is_ie3);
var is_aol4 = (is_aol && is_ie4);
var is_aol5 = (agt.indexOf("aol 5") != -1);
var is_aol6 = (agt.indexOf("aol 6") != -1);

var is_opera = (agt.indexOf("opera") != -1);
var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

var is_webtv = (agt.indexOf("webtv") != -1);

var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1));
var is_AOLTV = is_TVNavigator;

var is_hotjava = (agt.indexOf("hotjava") != -1);
var is_hotjava3 = (is_hotjava && (is_major == 3));
var is_hotjava3up = (is_hotjava && (is_major >= 3));

// *** JAVASCRIPT VERSION CHECK ***
var is_js;
if (is_nav2 || is_ie3) is_js = 1.0;
else if (is_nav3) is_js = 1.1;
else if (is_opera5up) is_js = 1.3;
else if (is_opera) is_js = 1.1;
else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
else if (is_hotjava3up) is_js = 1.4;
else if (is_nav6 || is_gecko) is_js = 1.5;
// NOTE: In the future, update this code when newer versions of JS
// are released. For now, we try to provide some upward compatibility
// so that future versions of Nav and IE will show they are at
// *least* JS 1.x capable. Always check for JS version compatibility
// with > or >=.
else if (is_nav6up) is_js = 1.5;
// NOTE: ie5up on mac is 1.4
else if (is_ie5up) is_js = 1.3

// HACK: no idea for other browsers; always check for JS version with > or >=
else is_js = 0.0;

// *** PLATFORM ***
var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
// Win32, so you can't distinguish between Win95 and WinNT.
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

// is this a 16 bit compiled version?
var is_win16 = ((agt.indexOf("win16")!=-1) ||
(agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) ||
(agt.indexOf("windows 16-bit")!=-1) );

var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
(agt.indexOf("windows 16-bit")!=-1));

var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

// NOTE: Reliable detection of Win98 may not be possible. It appears that:
// - On Nav 4.x and before you'll get plain "Windows" in userAgent.
// - On Mercury client, the 32-bit version will return "Win98", but
// the 16-bit version running on Win98 will still return "Win95".
var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
var is_win32 = (is_win95 || is_winnt || is_win98 ||
((is_major >= 4) && (navigator.platform == "Win32")) ||
(agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

var is_os2 = ((agt.indexOf("os/2")!=-1) ||
(navigator.appVersion.indexOf("OS/2")!=-1) ||
(agt.indexOf("ibm-webexplorer")!=-1));

var is_mac = (agt.indexOf("mac")!=-1);
// hack ie5 js version for mac
if (is_mac && is_ie5up) is_js = 1.4;
var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) ||
(agt.indexOf("68000")!=-1)));
var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) ||
(agt.indexOf("powerpc")!=-1)));

var is_sun = (agt.indexOf("sunos")!=-1);
var is_sun4 = (agt.indexOf("sunos 4")!=-1);
var is_sun5 = (agt.indexOf("sunos 5")!=-1);
var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
var is_irix = (agt.indexOf("irix") !=-1); // SGI
var is_irix5 = (agt.indexOf("irix 5") !=-1);
var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
var is_hpux = (agt.indexOf("hp-ux")!=-1);
var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
var is_aix = (agt.indexOf("aix") !=-1); // IBM
var is_aix1 = (agt.indexOf("aix 1") !=-1);
var is_aix2 = (agt.indexOf("aix 2") !=-1);
var is_aix3 = (agt.indexOf("aix 3") !=-1);
var is_aix4 = (agt.indexOf("aix 4") !=-1);
var is_linux = (agt.indexOf("inux")!=-1);
var is_sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
var is_unixware = (agt.indexOf("unix_system_v")!=-1);
var is_mpras = (agt.indexOf("ncr")!=-1);
var is_reliant = (agt.indexOf("reliantunix")!=-1);
var is_dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) ||
(agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) ||
(agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1));
var is_sinix = (agt.indexOf("sinix")!=-1);
var is_freebsd = (agt.indexOf("freebsd")!=-1);
var is_bsd = (agt.indexOf("bsd")!=-1);
var is_unix = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux ||
is_sco ||is_unixware || is_mpras || is_reliant ||
is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

var is_vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));

//--> end hide JavaScript
function BrowserDetectLite() {
   var ua = navigator.userAgent.toLowerCase(); 

   // browser name
   this.isGecko     = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isMozilla   = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   this.isIE        = ( (ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) ); 
   this.isSafari    = (ua.indexOf('safari') != - 1);
   this.isOpera     = (ua.indexOf('opera') != -1); 
   this.isKonqueror = (ua.indexOf('konqueror') != -1 && !this.isSafari); 
   this.isIcab      = (ua.indexOf('icab') != -1); 
   this.isAol       = (ua.indexOf('aol') != -1); 
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isNS && this.isGecko) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
   }
   else if (this.isOpera) {
      if (ua.indexOf('opera/') != -1) {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
      }
      else {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
      }
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isIcab) {
      if (ua.indexOf('icab/') != -1) {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
      }
      else {
         this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
      }
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin   = (ua.indexOf('win') != -1);
   this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac   = (ua.indexOf('mac') != -1);
   this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   this.isIE7x = (this.isIE && this.versionMajor == 7);
   this.isIE7up = (this.isIE && this.versionMajor >= 7);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
}

var activeEditors = new Array()

function activateEditor(id) {
    activeEditors[activeEditors.length] = id
    toggleEditor(id)
}

function enableEditor(id){
    var elm = document.getElementById(id);

    if (tinyMCE.getInstanceById(id) == null)
        tinyMCE.execCommand('mceAddControl', false, id);

}

function deactivateEditors() {
    for(x=0;x<activeEditors.length;x++) {
        toggleEditor(activeEditors[x])
    }
    activeEditors.length = 0
}

// functions
function toggleEditor(id) {
    var elm = document.getElementById(id);

    if (tinyMCE.getInstanceById(id) == null)
        tinyMCE.execCommand('mceAddControl', false, id);
    else
        tinyMCE.execCommand('mceRemoveControl', false, id);
}

function update_src(element_id , src){

	element = document.getElementById(element_id);
	element.src = src;
	return false;

}

function open_a4_popup(url){
		
		return na_open_window('print', url, 10, 10, 690, 750, 0, 0, 0, 1, 0);
		
}

function addOnloadEvent(myfunction){
	
	if(typeof window.addEventListener != 'undefined')
	{
		//.. gecko, safari, konqueror and standard
		window.addEventListener('load', myfunction, false);
	}
	else if(typeof document.addEventListener != 'undefined')
	{
		//.. opera 7
		document.addEventListener('load', myfunction, false);
	}
	else if(typeof window.attachEvent != 'undefined')
	{
		//.. win/ie
		window.attachEvent('onload', myfunction);
	}
	
	//** remove this condition to degrade older browsers
	else
	{
		//.. mac/ie5 and anything else that gets this far
		
		//if there's an existing onload function
		if(typeof window.onload == 'function')
		{
			//store it
			var existing = onload;
			
			//add new onload handler
			window.onload = function()
			{
				//call existing onload function
				existing();
				//call generic onload function
				myfunction();
			};
		}
		else
		{
			//setup onload function
			window.onload = myfunction;
		}
	}

}

function toggleplus(id){

	el = document.getElementById(id);
	btn = document.getElementById(id+'btn');
	if(el.style.display == 'block'){
		el.style.display = 'none';
		btn.src = apcphpkod.constantes.ICO_PATH+'small/add.png';
	}else{
		el.style.display = 'block';
		btn.src = apcphpkod.constantes.ICO_PATH+'small/moins.png';
	}
	
}
function getsignet(){

	var matched = document.URL.match('#(.*)$');
	if(matched != null && matched[1] != null)
		return matched[1];
	else
		return null;

}
