function afficheTabUser(idTab){

		var nbronglet = 4;
	var i;
  var OngletTabUser=new Array();
 	OngletTabUser[1] = "UserTabCompte";
 	OngletTabUser[2] = "UserTabAlertes";
 	OngletTabUser[3] = "UserTabDossier";

 	for(i=1; i < nbronglet; i++) {
		if(i==idTab){
			document.getElementById(OngletTabUser[i]).style.display='block';
			if(idTab==1){
				waitUserPage();
				AfficheDivCompte();
			}
			else if(idTab==2){
				waitUserPage();
				GetSurveillance();
			}
			else if(idTab==3){
				waitUserPage();
				getDossier();
			}
		}else{
			document.getElementById(OngletTabUser[i]).style.display='none';
		}
	}
}

function waitUserPage(){
	var mainuserpage = document.getElementById("mainUserPage");
	mainuserpage.innerHTML='<img src="/img/sablier.gif" alt="Recheche en cours" title="Recheche en cours"/>';
}

function ActionAjax(rpcUrl,todo){

	dojo.io.bind({
		url :rpcUrl,
		mimetype :"text/json",
		load: function(type,datas,Evt) {
			if(todo == "compte")
				DivCompte(datas);

			},
		error: function(type, error){
//alert("Probleme technique");
}
		});
}

function DivCompte(datas){
	var UserPage = document.getElementById("mainUserPage");
	UserPage.innerHTML = datas;
}


function AfficheDivCompte(){
	var rpcUrl = '../fun/comptesclient.php';
	ActionAjax(rpcUrl,"compte");
}


/***
* Exécuter une recherche Presse
**/
function recherchePresse(rechNomen){
	var chaine_tmp="";
	var chaine_outspace="";
	var newchaine="";
	var c_title = "";
	var c_texte = "";
	var c_auteur = "";
	var T_option="";
	if(document.FormPresse.motcle.value == ""){
		alert("Vous devez saisir un mot clé dans la zone de recherche");
		document.FormPresse.motcle.focus();
		return;
	}
	else
	{
		chaine_outspace = filtreEspaceobs(document.FormPresse.motcle.value);
		chaine_tmp = filtre_accent(chaine_outspace);

    for(var i=0; i<chaine_tmp.length; i++)
    	newchaine=newchaine+filtreCar(chaine_tmp.charAt(i));

     chaine_tmp = newchaine;
			if(rechNomen)
				chaine_tmp = rechNomen;
   		var isNumerique = verif_numeric(chaine_tmp);
			if(isNumerique == true){
				if(!VerifSiren(chaine_tmp)) {
					alert("Le Numéro de siren '"+chaine_tmp+"' n'est pas valide");
					//return ;
				}else{
					var reg = new RegExp(" ", "g");
					chaine_tmp = chaine_tmp.replace(reg,"");
					T_option = "rcs";
				}
			}
		document.FormPresse.motcle.value = chaine_tmp;
		lastsearch = chaine_tmp;
	}


//	chaine_tmp = "("+chaine_tmp+") AND dav >= "+convDate(document.FormPresse.date_debut.value)+" AND dav <= "+convDate(document.FormPresse.date_fin.value);
	ongletRechPresse(chaine_tmp,document.FormPresse.date_debut.value,document.FormPresse.date_fin.value,document.FormPresse.listesources.value,T_option);

}
/***
* Navigation par page
**/
function goPage(UlrPage,numdossier) {
	ongletGopage(UlrPage,numdossier);
}

/***
* Visualisation d'un acticle
**/
function goArticle(docId,docTitre,provenance) {
	var str=docTitre
	docTitre = str.substring(0,15)+'...';
	ongletVisuDoc(docId,docTitre,provenance);
}
/***
* Visualisation d'un acticle ou plusieurs articles
**/
function goArticles() {
	var tabfilteringr = dojo.widget.getWidgetById("tableResult");
		var selecttab = tabfilteringr.getSelectedData();

	//	foreach

		//ongletVisuDoc(docId,docTitre,provenance);
		alert(dump(selecttab));
	if ( tabfilteringr!="" ) {
				ongletVisuDocs(selecttab,interfaceActuel);
		}else{
    		alert('Selectionner au moins un article à visualiser');
		}
}

/**
* vérifie des cases a checkbox sont cochés ou pas
**/
function Tstchecked(aForm,aCheck) {
	var i = 0;
	//if Sélection dans la page courante
	while(eval('document.'+aForm+'.elements['+i+']')) {
		if( eval('document.'+aForm+'.elements['+i+'].name') == aCheck)
			if(eval('document.'+aForm+'.elements['+i+'].checked') == true)
				return true;
		i++;
	}
	return false; //rien n'est sélectionné
}

/**
* renvoi un variable avec les identifiant des elément d'une check liste selectionné
**/
function whosChecked(aForm,aCheck) {
	var i = 0;
	var ListeSelected = "";

	while(eval('document.'+aForm+'.elements['+i+']')) {
		if( eval('document.'+aForm+'.elements['+i+'].name') == aCheck)
			if(eval('document.'+aForm+'.elements['+i+'].checked') == true){
				if(ListeSelected == "")
					ListeSelected = eval('document.'+aForm+'.elements[i].value');
				else
				   ListeSelected = ListeSelected + ";;" + eval('document.'+aForm+'.elements[i].value');
			}
	i++;
	}
	return ListeSelected;
}



/***
* Permet de fermer l'onglet en cours
**/
function tabClose(){
	 ongletClose();
}
/**
* Les dossiers
**/
function SuppDossier(page){
		if ( TstSelDos() ) {
				var i = 0;
				var ListeSelected = "";

				while(eval('document.f_dossier.elements['+i+']')) {
					if( eval('document.f_dossier.elements['+i+'].name') == 'c_dossier[]')
						if(eval('document.f_dossier.elements['+i+'].checked') == true){
							if(ListeSelected == "")
								ListeSelected = document.f_dossier.elements[i].value;
							else
							   ListeSelected = ListeSelected + ";;" + document.f_dossier.elements[i].value;
						}
					i++;
				}

				ongletSuppDossier(ListeSelected,page);
		/*	document.f_dossier.to_do_dossier.value = "supp_doss";
			document.f_dossier.action = 'resultprof.php';
			document.f_dossier.submit();*/
		}else{
    		alert('Selectionner au moins un dossier a supprimer');
		}
}

/***
* Exécuter une recherche Balo
**/
function rechercheBalo(){
	var chaine_tmp="";
	var chaine_outspace="";
	var newchaine="";
	var T_option="";
	if(document.FormBalo.motcle.value == ""){
		alert("Vous devez saisir un mot clé dans la zone de recherche");
		document.FormBalo.motcle.focus();
		return;
	}
	else
	{
		chaine_outspace = filtreEspaceobs(document.FormBalo.motcle.value);
		chaine_tmp = filtre_accent(chaine_outspace);

    for(var i=0; i<chaine_tmp.length; i++)
    	newchaine=newchaine+filtreCar(chaine_tmp.charAt(i));

     chaine_tmp = newchaine;

			document.FormBalo.motcle.value = chaine_tmp;
			lastsearch = chaine_tmp;
			var radiobuttoncheck  = whosChecked('FormBalo','typrech');
		/*	if(radiobuttoncheck == "ent"){
				chaine_tmp = "denomination="+chaine_tmp;
			}
			if(radiobuttoncheck == "mot"){
				chaine_tmp = "SI_DEFAULT="+chaine_tmp;
			}
			if(radiobuttoncheck == "rcs"){
			chaine_tmp = "sir="+chaine_tmp;
			}*/

			if(radiobuttoncheck == "rcs"){
				if(!VerifSiren(chaine_tmp)) {
					alert("Le Numéro de siren '"+chaine_tmp+"' n'est pas valide");
					return ;
				}else{
					var reg = new RegExp(" ", "g");
					chaine_tmp = chaine_tmp.replace(reg,"");
				}
			}else{
				var isNumerique = verif_numeric(chaine_tmp);
				if(isNumerique == true){
					if(!VerifSiren(chaine_tmp)) {
						alert("Le Numéro de siren '"+chaine_tmp+"' n'est pas valide");
						//return ;
					}else{
						var reg = new RegExp(" ", "g");
						chaine_tmp = chaine_tmp.replace(reg,"");
						T_option = "rcs";
					}
				}
			}
		//	ongletRechBalo(chaine_tmp,document.FormBalo.date_debut.value,document.FormBalo.date_fin.value,'BALO',radiobuttoncheck,T_option);
				ongletRechBalo(chaine_tmp,'','','BALO',radiobuttoncheck,T_option);
	}

	//rafraichissement de la pub
	//refreshPub();
}
/***
* Visualisation d'une fiche
**/
/*
function ongletVisuFiche(siren,ent,provenance) {
		var str=ent
	docTitre = str.substring(0,10)+'...';
	ongletVisuFiche(siren,docTitre,provenance);
}
*/


/***
* Exécuter une recherche Bodacc
**/
function rechercheBodacc(typReche){
	var chaine_tmp="";
	var chaine_outspace="";
	var newchaine="";
	var c_title = "";
	var c_texte = "";
	var c_auteur = "";
	if(document.FormBodacc.motcle.value == ""){
		alert("Vous devez saisir un mot clé dans la zone de recherche");
		document.FormBodacc.motcle.focus();
		return;
	}
	else
	{
		chaine_outspace = filtreEspaceobs(document.FormBodacc.motcle.value);
		chaine_tmp = filtre_accent(chaine_outspace);

    for(var i=0; i<chaine_tmp.length; i++)
    	newchaine=newchaine+filtreCar(chaine_tmp.charAt(i));

     chaine_tmp = newchaine;

			document.FormBodacc.motcle.value = chaine_tmp;
			//dernière recherche
			lastsearch = chaine_tmp;
			var radiobuttoncheck  = whosChecked('FormBodacc','typrech');
			if(typReche)
				radiobuttoncheck = "rcs";
			if(radiobuttoncheck == "rcs"){
				if(!VerifSiren(chaine_tmp)) {
					alert("Le Numéro de siren '"+chaine_tmp+"' n'est pas valide");
					return;
				}else{
					var reg = new RegExp(" ", "g");
					chaine_tmp = chaine_tmp.replace(reg,"");
				}
			}

			//ongletRechBodacc(chaine_tmp,document.FormBodacc.date_debut.value,document.FormBodacc.date_fin.value,'BODACC',radiobuttoncheck);
			ongletRechBodacc(chaine_tmp,'','','BODACC',radiobuttoncheck);
	}
	//rafraichissement de la pub
//	refreshPub();
}


/***
* Exécuter une recherche Entreprise
**/
function rechercheEntreprise(){
	var chaine_tmp="";
	var chaine_outspace="";
	var newchaine="";
	var valdepet="";
	var checkdirigeant="";
	var isRechSiren="";
	var isNumerique = false;
//	document.location = "../";
	
	if(Js_Trim(document.FormEntreprise.motcle.value) == ""){
		alert("Vous devez saisir un mot clé dans la zone de recherche");
		document.FormEntreprise.motcle.focus();
		return;
	}
	else
	{
		if(proveanceFicheStatic == 1){
			proveanceFicheStatic = 0;
			//document.location="../motcle="+document.FormEntreprise.motcle.value+"&dept="+document.FormEntreprise.dept.value+"&provenance=ent";
			document.Formrecharge.motcle.value = document.FormEntreprise.motcle.value;
			document.Formrecharge.dept.value = document.FormEntreprise.dept.value;
			document.Formrecharge.provenance.value = "ent";
			document.Formrecharge.submit();
			return;
		}

		if(document.FormEntreprise.motcle.value !=""){
			chaine_outspace = filtreEspaceobs(document.FormEntreprise.motcle.value);
			chaine_tmp = filtre_accent(chaine_outspace);

	    for(var i=0; i<chaine_tmp.length; i++)
	    	newchaine=newchaine+filtreCar(chaine_tmp.charAt(i));

	      chaine_tmp = Js_Trim(newchaine);
	     if(chaine_tmp.length >= 9 && chaine_tmp.length <= 11)
				 isNumerique = verif_numeric(chaine_tmp);
			if(isNumerique == true){
				if(!VerifSiren(chaine_tmp)) {
					alert("Le Numéro de siren '"+chaine_tmp+"' n'est pas valide");
				//	return ;
				}else{
					var reg = new RegExp(" ", "g");
					chaine_tmp = chaine_tmp.replace(reg,"");
					isRechSiren = "ok";
					ongletVisuFiche(chaine_tmp, chaine_tmp, "Fiche");
				}
			}
	     document.FormEntreprise.motcle.value = chaine_tmp;
	     lastsearch = chaine_tmp;
	  //  chaine_tmp = "record="+chaine_tmp;
	  }
		if(isRechSiren == ""){
			if(document.FormEntreprise.dirig.checked == true)
				checkdirigeant = document.FormEntreprise.dirig.value;


			if(document.FormEntreprise.dept.value != "")
				valdepet = document.FormEntreprise.dept.value;

			ongletRechEntreprise(chaine_tmp,valdepet,'',checkdirigeant);
		}
	}
	//rafraichissement de la pub
	//refreshPub();
}

/***
* Exécuter une recherche Comptes Annuel
**/
function rechercheComptes(){
	var chaine_tmp="";
	var chaine_outspace="";
	var newchaine="";
	var valdepet="";
	var modeRech="";
	if(document.FormComptes.motcle.value == "" ){
		alert("Vous devez saisir un mot clé dans la zone de recherche");
		document.FormComptes.motcle.focus();
		return;
	}
	else
	{
		if(document.FormComptes.motcle.value !=""){
			chaine_outspace = filtreEspaceobs(document.FormComptes.motcle.value);
			chaine_tmp = filtre_accent(chaine_outspace);

	    for(var i=0; i<chaine_tmp.length; i++)
	    	newchaine=newchaine+filtreCar(chaine_tmp.charAt(i));

	     chaine_tmp = newchaine;
	     document.FormComptes.motcle.value = chaine_tmp;
	     lastsearch = chaine_tmp;
			var isNumerique = verif_numeric(chaine_tmp);
			if(isNumerique == true){
				if(!VerifSiren(chaine_tmp)) {
					alert("Le Numéro de siren '"+chaine_tmp+"' n'est pas valide");
					return ;
				}else{
					var reg = new RegExp(" ", "g");
					chaine_tmp = chaine_tmp.replace(reg,"");
					modeRech = "siren";
				}
			}

	  }
		if(document.FormComptes.dept.value != "")
			valdepet = "depet="+document.FormComptes.dept.value;

		if(document.FormComptes.dirig.checked == true)
			checkdirigeant = document.FormComptes.dirig.value;

		ongletRechComptes(chaine_tmp,valdepet,modeRech);
	}
	//rafraichissement de la pub
	//refreshPub();
}

function VisuCompte(typcmpt,siren,millesime,iddiv){
	if(iddiv != "")
		closeDivCompte(iddiv);
	ongletVisuCompte(typcmpt,siren,millesime);
	refreshXiti('comptes_annuels');
}


function goExtrait(iddoc,motcle) {
  w = window.open( '../presse/visuExtrait.php?iddoc='+iddoc+'&motcle='+motcle , 'displayWindow', 'width=350,height=250,resizable=no,directories=no,location=no,scrollbars=yes,status=no,toolbar=no,menubar=no' );
  w.focus();
}
function OpenWindowAlerte(destination) {
  w = window.open( destination , 'displayWindow', 'width=550,height=550,resizable=yes,directories=no,location=no,scrollbars=yes,status=no,toolbar=no,menubar=no' );
  w.focus();
}

function veiller(siren,denomination){
		OpenWindowAlerte('../veilles/formVeilles.php?siren='+siren+'&denomination='+denomination);
	//ongletVeiller(siren,denomination);
}

function listerVeiller(){
	w = window.open( '../veilles/getVeilles.php' , 'displayWindow', 'width=550,height=550,resizable=yes,directories=no,location=no,scrollbars=yes,status=no,toolbar=no,menubar=no' );
  w.focus();
}

function GetSurveillance(){
	ongletGetSurveillance();
}

function SuppSurveillance(){
		if ( Tstchecked("FormSurveillance","c_Surveillance[]") ) {
				var ListeSelected = whosChecked("FormSurveillance","c_Surveillance[]");
			ongletSuppSurveillance(ListeSelected);
		}else{
    		alert('Selectionner au moins un dossier a supprimer');
		}
}

function visuMentions(){
	OngletVisuMentions();
}
function visuContact(){
	OngletVisuContact();
}
function lanceRecherche(provenance){
	var i = document.ApproxSelect.menuApprox.selectedIndex;
	motcle = document.ApproxSelect.menuApprox.options[i].value;
	if (provenance == 'Entreprise')
		ongletRechEntreprise(motcle,'');
	else if (provenance == 'Bodacc')
		ongletRechBodacc(motcle,'','','','');
	else if (provenance == 'Balo')
		ongletRechBalo(motcle,'','','','');
 	else if (provenance == 'Presse')
		ongletRechPresse(motcle,document.FormPresse.date_debut.value,document.FormPresse.date_fin.value,'ALL');


}

function visuAccueil(){
	OngletVisuAccueil();
}
function visuAlert(){
	OngletVisuAlert();
}
function verif_numeric(variable){
	var reg = new RegExp(" ", "g");
	variable = variable.replace(reg,"");
	var exp = new RegExp("^[0-9]+$","g");
	return exp.test(variable);
}

function SessionEnd(){
//	alert('Votre session a expiré.\n \nMerci de vous reconnecter');
	window.top.document.location=host_site;
}

function selectIdxTable(idxToSelect){
	var tabfilteringr = dojo.widget.getWidgetById("tableResult");
	tabfilteringr.selectByIndex(idxToSelect);
}

function selectInput(unInput){
	if(flagSelect == 0){
		unInput.select();
		flagSelect = 1;
	}
//	else
	//	flagSelect = 0;
}

function viewDivCompteComplet(idDivCompte){
	var nbrDiv = 13;
	var i;
	var DivCompteTitle = new Array();
 	var DivCompte = new Array();
 	var LabelXiti = new Array();

	DivCompte[0] = "actif";
 	DivCompte[1] = "passif";
 	DivCompte[2] = "compte_result_liste";
	DivCompte[3] = "compte_result_exe_suite";
	DivCompte[4] = "immobilisation_A";
	DivCompte[5] = "immobilisation_B";
	DivCompte[6] = "amortissements_A";
	DivCompte[7] = "amortissements_B";
	DivCompte[8] = "amortissements_D";
	DivCompte[9] = "provisions";
	DivCompte[10] = "etat_A";
	DivCompte[11] = "etat_B";
	DivCompte[12] = "tableau_affectation";

	DivCompteTitle[0] = "actif_title";
	DivCompteTitle[1] = "passif_title";
	DivCompteTitle[2] = "compte_result_liste_title";
	DivCompteTitle[3] = "compte_result_exe_suite_title";
	DivCompteTitle[4] = "immobilisation_title";
	DivCompteTitle[5] = "immobilisation_title";
	DivCompteTitle[6] = "amortissements_title";
	DivCompteTitle[7] = "amortissements_title";
	DivCompteTitle[8] = "amortissements_title";
	DivCompteTitle[9] = "provisions_title";
	DivCompteTitle[10] = "etat_title";
	DivCompteTitle[11] = "etat_title";
	DivCompteTitle[12] = "tableau_affectation_title";

	//->label des page pour xiti

	LabelXiti[0] = "actif";
	LabelXiti[1] = "passif";
	LabelXiti[2] = "compte_result_liste";
	LabelXiti[3] = "compte_result_suite";
	LabelXiti[4] = "immobilisation_A";
	LabelXiti[5] = "immobilisation_B";
	LabelXiti[6] = "amortissements_A";
	LabelXiti[7] = "amortissements_B";
	LabelXiti[8] = "amortissements_D";
	LabelXiti[9] = "provisions";
	LabelXiti[10] = "etat_creances";
	LabelXiti[11] = "etat_dettes";
	LabelXiti[12] = "tableau_affectation";


 	for(i=0; i < nbrDiv; i++) {
		if(i==idDivCompte){
			document.getElementById(DivCompte[i]).style.display='block';
			document.getElementById(DivCompteTitle[i]).style.display='block';
		}else{
			document.getElementById(DivCompte[i]).style.display='none';
			document.getElementById(DivCompteTitle[i]).style.display='none';
		}
	}
	refreshPub();
	refreshXiti('comptes_annuels::'+LabelXiti[idDivCompte]);

}
function viewDivCompteSimplifie(idDivCompte){
	var nbrDiv = 3;
	var i;
	var DivCompteTitle = new Array();
  	var DivCompte = new Array();
	var LabelXiti = new Array();


	DivCompte[0] = "actif_simple";
 	DivCompte[1] = "compte_result_simple";


	DivCompteTitle[0] = "actif_simple_title";
	DivCompteTitle[1] = "compte_result_simple_title";

	//->label des page pour xiti

	LabelXiti[0] = "bilan_simple";
	LabelXiti[1] = "compte_result_simple";


 	for(i=0; i < nbrDiv; i++) {
		if(i==idDivCompte){
			document.getElementById(DivCompte[i]).style.display='block';
			document.getElementById(DivCompteTitle[i]).style.display='block';
		}else{
			document.getElementById(DivCompte[i]).style.display='none';
			document.getElementById(DivCompteTitle[i]).style.display='none';
		}
	}
	refreshPub();
	refreshXiti('comptes_annuels_simple::'+LabelXiti[idDivCompte]);
}
function viewDivCompteConsolide(idDivCompte){
	var nbrDiv = 3;
	var i;
	var DivCompteTitle = new Array();
  	var DivCompte = new Array();
	var LabelXiti = new Array();

	DivCompte[0] = "actif_cons";
 	DivCompte[1] = "passif_cons";
 	DivCompte[2] = "compte_result_cons";


	DivCompteTitle[0] = "actif_cons_title";
	DivCompteTitle[1] = "passif_cons_title";
	DivCompteTitle[2] = "compte_result_cons_title";

	//->label des page pour xiti

	LabelXiti[0] = "actif_consolide";
	LabelXiti[1] = "passif_consolide";
	LabelXiti[2] = "compte_result_consolide";


 	for(i=0; i < nbrDiv; i++) {
		if(i==idDivCompte){
			document.getElementById(DivCompte[i]).style.display='block';
			document.getElementById(DivCompteTitle[i]).style.display='block';
		}else{
			document.getElementById(DivCompte[i]).style.display='none';
			document.getElementById(DivCompteTitle[i]).style.display='none';
		}
	}
	refreshPub();
	refreshXiti('comptes_annuels_consolide::'+LabelXiti[idDivCompte]);
}

function OpenWindow(destination) {
  w = window.open( destination , 'displayWindow', 'width=750,height=650,resizable=no,directories=no,location=no,scrollbars=yes,status=no,toolbar=no,menubar=no' );
  w.focus();
}
function paye(destination,numdoc,UrlReformat,divid,comeFrom,provenance){
	OpenWindow(destination);
	//document.getElementById("mainContentPage").innerHTML="<a href=\"javascript:ongletVisuDoc('"+UrlReformat+"?num="+numdoc+"','titre','Bodacc');onCloseButtonClick();\">Une fois payé cliquer ici pour voir votre article</a>";
	document.getElementById("mainContentPage"+divid).innerHTML="<p class=\"textPaie\"><a href=\"javascript:ViewDocPaye('"+UrlReformat+"','"+divid+"','"+provenance+"');\">Si vous avez annulé la transaction,<br /> cliquez sur l'onglet Résultats pour revenir à la liste. <br />Si vous venez d'effectuer le paiement,<br /> cliquez ici pour lire l'annonce que vous venez d'acheter</a></p>";
	/*var tabfilteringr = dojo.widget.getWidgetById("tableResult");
	tabfilteringr.selectByIndex(idxToSelect);	*/


}

function payecb(destination,numdoc,UrlReformat,divid,comeFrom,provenance){
		if(document.getElementById('cb'+divid).facture.checked==true){
				destination = "../payer/cb/paiement_1.php"+destination;
		}
		else{
			destination = "../payer/cb/paiement_2.php"+destination;
		}
/*	if (document.payecb.facture.checked==true){
		destination = "../payer/cb/paiement_1.php"+destination;
	}
	else{
		destination = "../payer/cb/paiement_2.php"+destination;
	}*/
	paye(destination,numdoc,UrlReformat,divid,comeFrom,provenance);
}
function OpenWindow(destination,divid) {
  w = window.open( destination , 'displayWindow', 'width=750,height=650,resizable=no,directories=no,location=no,scrollbars=yes,status=no,toolbar=no,menubar=no' );
  w.focus();
}

function ViewDocPaye(urldoc,divid,provenance){
	var BindUrl = '../fun/visudoc.php?to_do=visuDoc&url='+urldoc+'&provenance='+provenance+'&divid='+divid;
	//var provenance = "Bodacc";
	dojo.io.bind({
		url: BindUrl,
		mimetype :"text/json",
		load: function(type,datas,Evt) {
			var div = document.getElementById(divid);
			if(datas["facture"]=="OK"){
			//var BindUrltmp =BindUrl+"&mode=print&provenance="+provenance;
				div.innerHTML = "<div id=\"table"+provenance+"\">"+datas["doc"]+"</div>";
			}
			else
				div.innerHTML = "Probleme de facturation, Impossible de visualiser ce document";
			tabContainer.selectChild(tabContainer.children[tabContainer.children.length-1]);
		}
	});
}

/**
 * Rafraichissement des pub disponibles
 * Si l'id de l'iframe est dans le dom on recharge la source avec un numero aleatoire dans l'url
 */
function refreshPub(){
	//Ajout des id des iframes de pub
	var iframeIds = new Array();

	iframeIds.push('pub-indextop');
	iframeIds.push('pub-indexbottom');

	iframeIds.push('pub-pagerbas');

	iframeIds.push('pub-accueil1');
	iframeIds.push('pub-accueil2');

	iframeIds.push('pub-right1');
	iframeIds.push('pub-right2');
	iframeIds.push('pub-right3');
	iframeIds.push('pub-right4');

	iframeIds.push('pub-fiche1');
	iframeIds.push('pub-fiche2');

	iframeIds.push('pub-divhaut');
	iframeIds.push('pub-divbas');

	iframeIds.push('pub-divhautbodac');
	iframeIds.push('pub-divbasbodac');

	iframeIds.push('pub-divhautbalo');
	iframeIds.push('pub-divbasbalo');

	iframeIds.push('pub-bc');
	iframeIds.push('pub-ca-c');
	iframeIds.push('pub-ca-s');
	iframeIds.push('pub-prinratios')

	iframeIds.push('pub-ratios');
	iframeIds.push('pub-sig');


	///console.log(iframeIds.length);

	var theIframe;
	var theSrc;
	var randomNum;
	for(var iii = 0;iii<iframeIds.length;iii++){
		theIframe = document.getElementById(iframeIds[iii]);
		if(theIframe) {
			randomNum = randomNumber();

			theSrc = theIframe.src;
			//alert('1 : '+theSrc);
			var pattern = /pme-pmi\.htm\/1.+@/gi;
			theSrc = theSrc.replace(pattern,'pme-pmi.htm/1'+randomNum+'@');

			theIframe.src = theSrc;
			//alert('2 : '+theSrc);
			//console.log('Pub Id modified :'+iframeIds[iii]);
		}

	}

}

function refreshXiti(page){

	var idXiti = 'imgXiti';
	var src = 'http://logc26.xiti.com/hit.xiti?s=282961&s2=19&p=pme-pmi::[type-page]&di=&aleatoire=[random]';
	var imgXiti = document.getElementById(idXiti);

	var patternPage = /\[type-page\]/gi;
	var patternRandom = /\[random\]/gi;
	src = src.replace(patternPage,page);
	src = src.replace(patternRandom,randomNumber());

	imgXiti.src = src;

}

function randomNumber(){
	//return Math.random().toString().substr(3,9);
	var d = new Date();
	return d.getTime()+''+d.getUTCMilliseconds();
}

