var fhTimerMD=null;
var fhMenuDroitCourant=null;

var val_recherche='';
var timer=null;var timer_info=null;

var affTemp=new Array();
var _compteur_=0;
var _compteur_limite=10;
var _compteur_pas=1;
var _compteur_fonction="";
var _compteur_encours=false;
var _compteur_interval="";
var _compteur_timeout=""

var _compteur_2=0;
var _compteur_limite2=10;
var _compteur_pas2=1;
var _compteur_fonction2="";
var _compteur_encours2=false;
var _compteur_interval2="";
var _compteur_timeout2=""

var _enregistre_auto_="";

var _mdsh_=new Array();
var _mdsho_=new Array();

/* Fonctions de recherche dans l'annuaire */
function affiche_info_recherche(info){
	if(ajaxRecherche.termine){
		clearInterval(timer_info);
		if(info==undefined)info='info_recherche';
		$(info).innerHTML='';
	}
}
function test_avant_lance_recherche(rech,numpage,fonction,info,resultat_ou){
	if(fonction==undefined) {fonction=repRacJS+'./ajx_recherche_annuaire.php';}else{fonction=repRacJS+fonction;}
	if(info==undefined)info='info_recherche';
	if(resultat_ou==undefined)resultat_ou='resultat_recherche';
		var x=null;
		if($(resultat_ou)==null){
			x=document.createElement("div");
			x.id=resultat_ou;
			$('contenu').insertBefore(x,$('contenu').firstChild);
		}
		if($(info)==null){
			x=document.createElement("div");
			x.id=info;
			$('conteneur').appendChild(x,$('contenu').firstChild);
		}

		$(info).innerHTML="<img class=\"sansbord\" src=\""+repRacJS+"./include/editeur/btn/attente1.gif\">&nbsp;Recherche '"+rech+"' en cours";
		timer_info=setInterval('affiche_info_recherche("'+info+'")',500);
		var wherenum="";
		if(numpage!=undefined){
			wherenum="&multipage="+numpage;
		}
		var ajaxRecherche = new fhMajParAjax(resultat_ou, fonction, {data: 'limit=5'+wherenum+'&recherche='+rech+'&repRacJS='+repRacJS});
//	}
}
/* Fin de fonction de recherche dans l'annuaire */

var fhMenuDroit={
	afficher:true,
	ajouter:function(coordSouris,div,type,theme,cmtheme,id){
		fhMenuDroit.supprimer();
		fhMenuDroit.courant=$el.ajouter();
		cmDraw(fhMenuDroit.courant,div,type,cmtheme,theme);
		fhMenuDroit.courant.style.position='absolute';
		fhMenuDroit.courant.style.textAlign='left';
		$el.repositionneDansFenetre(fhMenuDroit.courant,id);
		setTimeout(function(){
			fhObjet.etendre(document.body,fhEvenement);
			document.body.ajouterEvenement('click',fhMenuDroit.supprimer)
		},500);
		return true;
	},
	affecteDown:function(div,id_,longtemps){
		if($(div)){
			var o=$(div);fhObjet.etendre(o,fhEvenement);o.idSh=id_;o.ajouterEvenement('mousedown',fhMenuDroit.sourisAppuie(o,longtemps));
			if(longtemps){
				o.ajouterEvenement('mouseup',function(){if(fhTimerMD)fhTimerMD.arreter();})
			}
		}
		if((typeof div)=="string"){
			getElementsByClassName(div,document.body,fhMenuDroit.affecteDown,id_,longtemps);
		}
	},
	affecteMove:function(div,id_,longtemps){
		if($(div)){
			var o=$(div);fhObjet.etendre(o,fhEvenement);o.idSh=id_;o.ajouterEvenement('mousemove',fhMenuDroit.sourisDeplace(o));
			if(longtemps){
				o.ajouterEvenement('mouseup',function(){if(fhTimerMD)fhTimerMD.arreter();})
			}
		}
		if((typeof div)=="string"){
			getElementsByClassName(div,document.body,fhMenuDroit.affecteMove,id_,longtemps);
		}
	},
	supprimer:function(){
		try{document.body.removeChild(fhMenuDroit.courant);}catch(e){};
		fhMenuDroit.courant=null;
		fhObjet.etendre(document.body,fhEvenement);
		document.body.enleverEvenement('click',fhMenuDroit.supprimer);
	},
	sourisAppuie:function(o,longtemps){
		return function(event){
			if(fhMenuDroit.afficher){
				if(o.id){var id=o.id;}else{var id=o.idSh;}
				if(longtemps){
					event=fhEvenement(event);
					if(_mdsh_[id].length==1){
						if(_mdsh_[id][0]==" ,") return false;
					}
				 	if(fhTimerMD)fhTimerMD.arreter();
					var coordSouris={x:fhSouris.x(event),y:fhSouris.y(event)};
					fhObjet.etendre(o,fhEvenement);
					fhTimerMD=new fhTimer({
						fonction:function() {
							fhMenuDroit.ajouter(coordSouris,_mdsh_[id],'vbr','ThemeOffice',cmThemeOffice);
							var XY=Fenetres.ScrollXY(id,true);
							if(fhTimerMD)fhTimerMD.arreter();
						},
						duree:500
					});
					o.ajouterEvenement('mouseup',fhTimerMD.arreter);
					fhEvenement.arreter(event);
				}else{
					event=fhEvenement(event);
					var coordSouris={x:fhSouris.x(event),y:fhSouris.y(event)};
					if(_mdsh_[id].length==1){
						if(_mdsh_[id][0]==" ,") return false;
					}
					fhMenuDroit.ajouter(coordSouris,_mdsh_[id],'vbr','ThemeOffice',cmThemeOffice);
					fhEvenement.arreter(event);
				}
			}
			return true;
		}
	},
	sourisDeplace:function(o){
		return function(event){
			if(fhMenuDroit.afficher){
				if(o.id){var id=o.id;}else{var id=o.id_;}
				event=fhEvenement(event);
				if(_mdsho_[id].length==1){
					if(_mdsho_[id][0]==" ,") return false;
				}
			 	if(fhTimerMD)fhTimerMD.arreter();
				var coordSouris={x:fhSouris.x(event),y:fhSouris.y(event)};
				fhObjet.etendre(o,fhEvenement);
				fhTimerMD=new fhTimer({
					fonction:function(){
						fhMenuDroit.ajouter(coordSouris,_mdsho_[id],'vbr','ThemeOffice',cmThemeOffice,id);
						var XY=Fenetres.ScrollXY(_mdsho_[id],true);
						fhMenuDroit.courant.style.left=fhPx(fhMenuDroit.courant.offsetLeft+XY[0]);
						fhMenuDroit.courant.style.top=fhPx(fhMenuDroit.courant.offsetTop+XY[1]);
						var LH=Fenetres.LH();
						if(XY[0]+LH[0]<fhMenuDroit.courant.offsetLeft-5+fhMenuDroit.courant.offsetWidth){
							fhMenuDroit.courant.style.left=fhPx(XY[0]+LH[0]-fhMenuDroit.courant.offsetWidth);
						}
						if(XY[1]+LH[1]<fhMenuDroit.courant.offsetTop-5+fhMenuDroit.courant.offsetHeight){
							fhMenuDroit.courant.style.top=fhPx(XY[1]+LH[1]-fhMenuDroit.courant.offsetHeight);
						}
						if(fhTimerMD)fhTimerMD.arreter();
					},
					duree:50
				});
				o.ajouterEvenement('mouseup',fhTimerMD.arreter);
				o.ajouterEvenement('mouseout',fhTimerMD.arreter);
				fhEvenement.arreter(event);
			}
		return false;
		}
	}
}

function fhPx(s){
	return s+"px";
}
function creeAjax(){
	if(window.XMLHttpRequest) return new XMLHttpRequest(); else if(window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");   else {return null; }
}
function e_sql(data,page,nepasrafraichir){
	var xhr_object=creeAjax();
	xhr_object.open("POST", repRacJS+'./maj_sql.php', true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			if(nepasrafraichir==undefined){
				if((page==undefined)||(page=='')){
					window.location.reload();
				}else{
					window.location.href=page;
				}
			}
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr_object.send(HechapS(data));
}
function e_sql2(data,page,nepasrafraichir){
	var xhr_object=creeAjax();
	xhr_object.open("POST", repRacJS+'./maj_sql2.php', true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			if(nepasrafraichir==undefined){
				if((page==undefined)||(page=='')){
					//window.location.href=repRacJS+'./'+xhr_object.responseText+'.html';
					window.location.reload();
				}else{
					window.location.href=page;
				}
			}
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr_object.send(HechapS(data));
}
function e_creepage(data,page,nombre,fonction){
	if(nombre===null)return false;
	if(nombre==undefined)nombre=1;
	if(nombre==-1){
		new fhFenetreInput({message:'Veuillez entrer le nombre de pages a creer',defaut:1,fonction:function(nb){e_creepage(data,page,nb)}});
		return false;
	}
	var xhr_object=creeAjax();
	xhr_object.open("POST", repRacJS+'./ajout_page.php', true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			if(nombre==1){
				if(fonction){
					fonction(xhr_object);
				}
				if((page==undefined)||(page=='')){
					window.location.href=xhr_object.responseText;
				}else{
					window.location.href=page;
				}
			}else{
				e_creepage(data,page,nombre-1);
			}
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr_object.send(HechapS(data));
}
function e_connection(data,page){
	var xhr_object=creeAjax();
	xhr_object.open("POST", repRacJS+'./connection.php', true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			if((page==undefined)||(page=='')){
				window.location.reload();
			}else{
				window.location.href=page;
			}
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr_object.send(HechapS(data));
}

function dialogue_php2(id_form,lien,arg,data,execute_code,script_depart){
	dialogue_php(id_form,lien,arg,data,execute_code,script_depart,true);
}
function dialogue_php(id_form,lien,arg,data,execute_code,script_depart,saisie,titre){
	var xhr_object = creeAjax(); 
	id_dialog=id_form;
	var acentrer=false;
	if(saisie==undefined)saisie=false;
	if($(id_form+"Conteneur"))document.body.removeChild($(id_form+"Conteneur"));
	if($("boite_dialogue"+id_dialog)!=null){
		$("boite_dialogue"+id_dialog).parentNode.removeChild($("boite_dialogue"+id_dialog));
	}
	if(saisie){
		boite_dialogue=creeDialogueSaisie(id_form,'Veuillez patienter...',script_depart);
	}else{
		if($(id_form))return;
		boite_dialogue=creeDialogue(id_form,'Veuillez patienter...',script_depart,false,titre);
		if(boite_dialogue.milieu){
			$el.centrer(boite_dialogue.conteneur.conteneur.balise);
		}else{
			$el.centrer(boite_dialogue);
		}
	}
	if(boite_dialogue.milieu){
		contenu_dialogue=boite_dialogue.milieu.conteneur.balise;
	}else{
		boite_dialogue.style.display="";
		contenu_dialogue=$('dialogue_contenu'+id_form);
	}
	if((data==undefined)||(data==""))data="";else data="="+data;
	xhr_object.open("POST", lien+"?repRacJS="+repRacJS+"&rep="+rep_+"&_site="+codeSite, true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 0) {
			contenu_dialogue.innerHTML=attente("Veuillez patienter...");
		}
		if(xhr_object.readyState == 1) {
			contenu_dialogue.innerHTML=attente("Chargement en cours...");
		}
		if(xhr_object.readyState == 2) {
			contenu_dialogue.innerHTML=attente("Chargement terminé...");
		}
		if(xhr_object.readyState == 3) {
			contenu_dialogue.innerHTML=attente("Analyse en cours...");
		}
		if(xhr_object.readyState == 4) {
			contenu_dialogue.innerHTML=xhr_object.responseText;
			if(!document.all){
				var largeur=contenu_dialogue.offsetParent.offsetWidth;
				//contenu_dialogue.offsetParent.style.position='fixed';
				//contenu_dialogue.style.position='fixed';
				/*var els=contenu_dialogue.getElementsByTagName('input');
				for(var i=0;i<els.length;i++){
					els[i].style.position='fixed';
				}
				contenu_dialogue.offsetParent.style.width=largeur;*/
			}
			if(execute_code!=undefined) {
				if(execute_code=="recharger"){
					window.location.reload();
				}else{
					eval(execute_code);
				}
			}
			if(!saisie){
				if(!boite_dialogue.milieu){
					$el.centrer(boite_dialogue);
				}else{
					boite_dialogue.centrer();
				}
			}
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr_object.send(HechapS(arg+data));
}
//
function attente(s){
	var imageEtat="<img class=\"sansbord\" src=\""+repRacJS+"./include/editeur/btn/attente1.gif\">";
	return "<div style=\"text-align:center;font-family:verdana;font-size:14pt;\">"+s+imageEtat+"</div>";
}
function supprimeDialogue(dialogue,el,vrainom){
	if(!el){
		el=document.body;
	}
	if(typeof(dialogue)=="object"){
		el.removeChild(dialogue);
	}else{
		if(_(vrainom)){
			if(_($(dialogue))) el.removeChild($(dialogue));
		}else{
			if(_($("boite_dialogue"+dialogue))) {
				try{
					el.removeChild($("boite_dialogue"+dialogue));
					fh_cache_modal();
				}catch(e){
					try{
						$('shConteneur').removeChild($("boite_dialogue"+dialogue));
						fh_cache_modal();
					}catch(e){}
				}
			}
		}
	}
	if(Fenetres.aSupprimer!=null) {
		var id=Fenetres.aSupprimer.id;
		Fenetres.aSupprimer=null;
		supprimeDialogue(id,$('shConteneur'),true);
	}
}
function creeDialogue(id_dialog,contenu,script,renvoicontenu,titre){
	if(titre==undefined)titre='Fractalweb Technology';
	var fen=fhFenetres.ajouter({titre:titre,id:id_dialog});
	return fen;
return;
	var html='';
	if(script==undefined)script='';
	if(renvoicontenu==undefined)renvoicontenu=false;
	boite_dialogue=$el.ajouter("boite_dialogue"+id_dialog,"boite_dialogue","position:absolute;display:none;z-index:"+(++Fenetres.zIndex)+";filter:progid:DXImageTransform.Microsoft.Shadow(color=#BDC3BD, Direction=135, Strength=4);","shConteneur");
	html+='<table cellspacing=0 cellspadding=0 style="background:#ffffff;padding:0;margin:0;border:1px outset #3f6e97;">';	
	html+='<tr><td class=dToolbar style="background:#3f6e97;padding:0;margin:0"></td><td id="tddrag_'+id_dialog+'" class="dialogue" style="background:url(\''+repJS+'editeur/btn/fwt.gif\') top left no-repeat;width:200px;"></td><td class="dialogue" style="text-align:right;">'+"<SPAN class=ToolButtons><IMG class=ToolButtons  onClick=\""+script+"supprimeDialogue('"+id_dialog+"',$('shConteneur'));\" onmousemove=\"this.className='ToolButtonsHover';Fenetres.bDrag=false;document.body.style.cursor = 'default';\" onmousedown=\"this.className='ToolButtonsDown'\" onmouseout=\"this.className='ToolButtons'\" onmouseup=\"this.className='ToolButtons'\" title=Fermer style=\"CURSOR: pointer\" height=20 src=\""+repRacJS+"./admin/defaut/icone/active/fermer.jpg\" width=20></SPAN></td></tr>";
	html+='<tr><td style="background:#3f6e97;"></td><td colspan=2 style="padding:10px;margin:0px;"><div id="dialogue_contenu'+id_dialog+'" ></div></td><td style="background:#3f6e97;"></td></tr>';
	html+='<tr style="background:#3f6e97;"><td colspan=5></td></tr>';
	html+='</table>';
	fh_affiche_modal();
	


	boite_dialogue.innerHTML=html;
	boite_dialogue.onclick=function(){this.style.zIndex=++Fenetres.zIndex;};
	new fhDragDrop('tddrag_'+id_dialog,"boite_dialogue"+id_dialog);
	if(renvoicontenu){
		return boite_dialogue.childNodes[0].childNodes[0].childNodes[1].childNodes[1].childNodes[0];
	}else{
		return boite_dialogue;
	}
}
function fh_affiche_modal(){
	var div_=$('fond_modal');
	if(div_){
		div_.style.display='';
	}
}
function fh_cache_modal(){
	var div_=$('fond_modal');
	if(div_){
		div_.style.display='none';
	}
}
function creeDialogueSaisie(id,contenu,script){
	var html='';
	Fenetres.supprimerDialogueSaisie();
	if(script==undefined)script='';
	var dialogue=$el.ajouter("boite_dialogue"+id,"boite_dialogue","position:absolute;display:none;z-index:"+(++Fenetres.zIndex)+";filter:progid:DXImageTransform.Microsoft.Shadow(color=#BDC3BD, Direction=135, Strength=1);");
	html+='<iframe style="width:1000px;height:1000px;position:absolute;top:0;left:0;border:none;z-index:-5;"></iframe><table cellspacing=0 cellspadding=0 style="background:#ffffff;padding:0;margin:0;border:0px outset #3f6e97;z-index:'+(++Fenetres.zIndex)+';">';	
	html+='<tr><td style="background:#3f6e97;"></td><td colspan=2><div id="dialogue_contenu'+id+'" ></div></td><td style="background:#3f6e97;"></td></tr>';
	html+='<tr style="background:#3f6e97;"><td colspan=5></td></tr>';
	html+='</table>';

	dialogue.innerHTML=html;
	if(!isNaN(fhSouris.yCourant)) dialogue.style.top=fhSouris.yCourant+"px";
	if(!isNaN(fhSouris.xCourant)) dialogue.style.left=fhSouris.xCourant+"px";

	Fenetres.aSupprimer=dialogue;
	fhObjet.etendre(document.body,fhEvenement);
	document.body.ajouterEvenement('click',Fenetres.supprimerDialogueSaisie,false);
	dialogue.style.display='';
return dialogue;
}

function enregistre_param(data,idform){
	var xhr_object = creeAjax();
	xhr_object.open("POST", repRacJS+"./maj.php", false);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 1){}
		if(xhr_object.readyState == 4){
			if((idform!="undefined")&&(idform!="")){
				try{
					fhFenetres.courant(idform).fermer();
				}catch(e){
					try{
						supprimeDialogue(idform,$('shConteneur'));
					}catch(e){}
				}
			}
			traitementReponseAjax(xhr_object.responseText);
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	data=HechapS(data);
	xhr_object.send(HRemplaceInverseS(data));
}
function enregistre_editeur(data,idform,fonction,nePasTraiterReponse){
	var xhr_object = creeAjax();
	xhr_object.open("POST", repRacJS+"./"+fonction+".php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 1){}
		if(xhr_object.readyState == 4){
			if(nePasTraiterReponse){
			}else{
				traitementReponseAjax(xhr_object.responseText);
			}
			if((idform!="undefined")&&(idform!="")){
				supprimeDialogue(idform,$('shConteneur'));
			}
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	data=HechapS(data);
	xhr_object.send(HRemplaceInverseS(data));
}
function enregistre_formulaire(idform,page){
var form_ = $(idform);
var data='';
var champspasse='';
	for (var champ=0; champ < form_.elements.length; champ++) {
		if(form_.elements[champ].type=='password'){
			data+='&____'+form_.elements[champ].name+'='+HechapEtS(form_.elements[champ].value);
		}else{
			data+='&'+form_.elements[champ].name+'='+HechapEtS(form_.elements[champ].value);
		}
	}
	var xhr_object = creeAjax();
	xhr_object.open("POST", repRacJS+"./ajx_enregistre_form.php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 1){}
		if(xhr_object.readyState == 4){
			/*traitementReponseAjax(xhr_object.responseText);
			if((idform!="undefined")&&(idform!="")){
				supprimeDialogue(idform,$('shConteneur'));
			}*/
			window.location.href=page;
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	data=HechapS(data);
	xhr_object.send(HRemplaceInverseS(data));
}
function enregistre_contenu(data,fonction,auto){
	if(fonction==undefined)fonction="maj_contenu.php";
	new fhAjax(repRacJS+"./"+fonction,{
		fonction:function(){
			if(this.ajax.readyState == 4){
				if(auto==undefined) window.location.reload();else if(auto)auto();
			}
		},data:HRemplaceInverseS(HechapS(data))
	});
}
function traitementReponseAjax(reponse){
	if((reponse.indexOf('recharger')>=0)&&(reponse.indexOf('recharger')<=2)){
		window.location.reload();
	}
	if((reponse.indexOf('id=')>=0)&&(reponse.indexOf('id=')<=2)){
		var depart=reponse.indexOf('id=')+3;
		var fin=reponse.indexOf('*!!-!!*');
		var fin_reponse=reponse.indexOf('!!!===!!!');
		$(reponse.substring(depart,fin)).innerHTML=reponse.substring(fin+7,fin_reponse);
	return;
	}
	if((reponse.indexOf('src=')>=0)&&(reponse.indexOf('src=')<=2)){
		var depart=reponse.indexOf('src=')+4;
		var fin=reponse.indexOf('*!!-!!*');
		var fin_reponse=reponse.indexOf('!!!===!!!');
		$("img_"+reponse.substring(depart,fin)).src=reponse.substring(fin+7,fin_reponse);
	return;
	}
	if((reponse.indexOf('http://')>=0)&&(reponse.indexOf('http://')<=10)){
		var depart=reponse.indexOf('http://');
		var fin=reponse.indexOf('*!!-!!*');
		var fin_reponse=reponse.indexOf('!!!===!!!');
		var _contenu_=reponse.substring(fin+7,fin_reponse);
		var _chemin_=reponse.substring(depart,fin);
		if(_contenu_!='') window.location.href=_chemin_.replace('[contenu]',_contenu_);
	return;
	}
	if((reponse.indexOf('codejs')>=0)&&(reponse.indexOf('codejs')<=10)){
		var depart=reponse.indexOf('codejs');
		var fin=reponse.indexOf('*!!-!!*');
		var fin_reponse=reponse.indexOf('!!!===!!!');
		var _contenu_=reponse.substring(fin+7,fin_reponse);
		var _chemin_=reponse.substring(depart,fin);
		if(_contenu_!='') eval(reponse.substring(fin+7,fin_reponse)+';');
	return;
	}
	if((reponse.indexOf('href=')>=0)&&(reponse.indexOf('href=')>=0)){
		var depart=reponse.indexOf('href=')+5;
		var fin=reponse.indexOf('*!!-!!*');
		var fin_reponse=reponse.indexOf('!!!===!!!');
		window.location.href=reponse.substring(fin+7,fin_reponse);
	return;
	}
}
function execute_ajax(url,data){
	var xhr_object = creeAjax();
	xhr_object.open("POST", url, true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4){
			traitementReponseAjax(xhr_object.responseText);
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	data=HechapS(data);
	xhr_object.send(HRemplaceInverseS(data));
}
function HechapEtS(data){
	try{data = data.replace(/&/gi, "%26");data = data.replace(/[+]/gi, "%2B");data = data.replace(/'/gi, "%27");data = data.replace(/"/gi, "%22");  }catch(e){}
return data;
}
function HechapS(data) {  
       data = data.replace(/[+]/gi, "%2B");
      data = data.replace(/"/gi, "%22");
       data = data.replace(/ /gi, "+");	   
return data;  
}  


function val_champ(data){
	var xhr_object = creeAjax(); 
	fonction="val_champ.php";
	xhr_object.open("POST", repRacJS+"./"+fonction, false);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4){
			return xhr_object.responseText;
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send(HechapS(data));
return xhr_object.responseText;
}


function maj_panier(id_succes,id_valeur,uri){
	//clearTimeout(_compteur_timeout);
	var myAjax = new fhMajParAjax(id_succes, repRacJS+'./ajout_panier.php', {data: encodeURI(uri+'&qte='+$F(id_valeur))});
}
/*
function sh_init_compteur(pas,limit,intervalle){
	_compteur_=0;
	_compteur_limite=limit;
	_compteur_pas=pas;
	if(_compteur_encours==false){
		_compteur_encours=true;
		_compteur_interval = window.setInterval("sh_inc_compteur()",intervalle); 
	}
}
function sh_inc_compteur(){
	_compteur_=_compteur_+_compteur_pas;
	if(_compteur_>=_compteur_limite) {
		clearInterval(_compteur_interval);
		_compteur_timeout = window.setTimeout(_compteur_fonction,10); 
		_compteur_encours=false;
	}
}
function sh_init_compteur2(pas,limit,intervalle){
	_compteur_2=0;
	_compteur_limite2=limit;
	_compteur_pas2=pas;
	if(_compteur_encours2==false){
		_compteur_encours2=true;
		_compteur_interval2 = window.setInterval("sh_inc_compteur2()",intervalle); 
	}
}
function sh_inc_compteur2(){
	_compteur_2=_compteur_2+_compteur_pas2;
	if(_compteur_2>=_compteur_limite2) {
		clearInterval(_compteur_interval2);
		_compteur_timeout2 = window.setTimeout(_compteur_fonction2,10); 
		_compteur_encours2=false;
	}
}*/
function is_array(variable) {
   var source = variable.toSource();
   return (source.search(/^\[([^,]*,)+[^,]*\]/) != -1);
}

function recupChoix(choix){
	for(i=0;i<choix.length;i++){
		if (choix[i].checked) return i;
	}
return -1;
}

var menucache=null;
function fh_gestion_menu_cache(id,t_){
return;
	var amenucache=menucache;
	if((amenucache&&(amenucache.id==id))) return;
	menucache=$(id);
	if(menucache&&menucache.style){
			if((amenucache&&amenucache.id!=id)){
				amenucache.style.display='none';
			}
			menucache.style.display='';
			var t__=$(t_);
			menucache.style.top=fhPx(t__.cY()+t__.offsetHeight);
			menucache.style.left=fhPx(t__.cX());
	}
}

function fh_upload_ajax(id,param){
	if($(id+'_upload_fichier').value!=''){
		$('img_chargement').style.visibility='visible';
		$(id+'_form_upload_fichier').target=id+'_frame_pour_upload';
		$('affiche_etat_chargement').innerHTML='';
		$('affiche_etat_chargement').style.display='';
		etat_chargement = new fhMajPeriodiqueParAjax(
		'affiche_etat_chargement',repRacJS+'./ajx_attente.php?etat=upload&var=etat_chargement&resultat=fichier', 
		{ 	intervalle:300,
			evalScript:true,
			fonctionTermine:function(request){
				$('img_chargement').style.visibility='hidden';
				if(upload_fichier!=''){
					var myAjax = new fhMajParAjax($('fhGaleriesImages_'), repRacJS+'./sh_gestion_images.php', 
					{ data: param+'&repRacJS='+repRacJS+'&trouve_fichier='+upload_fichier}
					);
					new fhTimer({"fonction":function(){$('affiche_etat_chargement').innerHTML='Chargement termin\351e';},"duree":300,"demarre":true});
					$('fhOnglet_fen_galerie_').onclick();
				}else{
					$('btnImporter').style.display='';
				}
				etat_chargement=null;
			}
		});
		//return true;
	}else{
		//return false;
	};
}


