
// ---------------------------------------
var droits= new TYPE_DROITS();


//------------------------
function afficher_titre(titre, image, afficher_icone_fermeture, largeur, mode)
{
	var s=document.getElementById("page_debut_nom_rubrique");
	if(s) s.innerHTML=titre;
	return;
}

//------------------------
function texte_lire(cle_code_texte){
	var txt="";

	try{
		txt=eval("TXT_" + cle_code_texte);
	}
	//si pas défini, on retourne la cle
	catch (e){
		// ET 15/10/2007, on essaie de récupérer le texte via hmlhttp
		if (typeof(addeo_envoyer_requete_xmlhttp)!='undefined'){
			var url = "../include/appli_bd_xml_http.asp?operation=TEXTE_LIRE&cle_code=" +cle_code_texte;
			txt=addeo_envoyer_requete_xmlhttp(url, "", "POST");
		}
		if (txt.length==0) 
			txt=cle_code_texte;
	}
	return(txt);
}

// ---------------------------------------
 function TYPE_DROITS()
{
	this.operation="";
	this.gerer=0;
	this.lister=0;
	this.voir=0;
	this.supprimer=0;
	this.ajouter=0;
	this.modifier=0;
	this.proposer=0;
	this.valider=0;
	this.classement_gerer=0;
	this.classement_ajouter=0;
	this.classement_modifier=0;
	this.classement_supprimer=0;
	this.horaire_modifier=0;
	this.planning_voir=0;
	this.parcours_ajouter=0;
}


//------------------------
function aide_afficher(cle)
{
if (!cle || cle.length==0 ) cle=page_aide_cle;
if (cle && cle.length>0 )
	fenetre_ouvrir("../aide/aide_afficher.asp?mode=FICHE&cle_aide=" + cle, "AIDE", 503, 300) ;
}


//------------------------
function site_fiche_ouvrir(id_site)
{
var fenetre;
fenetre = fenetre_ouvrir("../sites/site_fiche.asp?mode=FICHE&id_site=" + id_site, "FICHE_SITE", 503, 300) ;
return ;
}

//------------------------
function individu_fiche_ouvrir(id_individu)
{
var fenetre, url;
url="../individus/individu_modifier_menu.asp?mode=FICHE&id_individu=" + id_individu;
url += "&code=" + aleatoire();
fenetre = fenetre_ouvrir(url, "FICHE_INDIVIDU", 500, 480) ;
return;
}


//------------------------
function afficher_bouton_annuler(url)
{
var html;

html='<a href="' + url 

if (url_est_javascript(url) == false)
	{html+='&code='+ aleatoire() +'&operation=annuler' ;}

html+='">' ;

html+='<img src="../images/icones/icone_annuler.gif" border="0" alt="Annuler"></a>'

document.write(html);
}


//------------------------
function afficher_bouton_valider(url)
{
var html;

html='<a href="' + url 

if (url_est_javascript(url) == false)
	{html+='&code='+ aleatoire() +'&operation=valider';}

html+='">' ;
html+='<img src="../images/icones/icone_valider.gif" border="0" alt="Valider"></a>'

document.write(html);
}


//------------------------
function afficher_bouton_modifier(url, texte, alt)
{
document.write(bouton_modifier_html(url, texte, alt));
}

//------------------------
function bouton_modifier_html(url, texte, alt)
{
var html;

html='<a href="' + url 
html+='&code='+ aleatoire() +'&operation=modifier">'
html+='<img src="../images/icones/icone_modifier.gif"  align="absmiddle" border="0" ' ;
if (alt && alt.length>0)
	{
		html+=' alt="' + alt + '" ' ;
	}
	else
	{
		html+=' alt="Modifier" ' ;
	}
html+='>' ;

if (texte && texte.length>0)
	html+=" " + texte;
html+='</a>';
return(html) ;
}

//***************************
function afficher_bouton_supprimer(url, texte)
{
	var html;

	html='<a href="' + url + '">';
	html+='<img src="../images/icones/icone_supprimer.gif" border="0" align="absmiddle" alt="Supprimer">';
	if (texte && texte.length>0)
		html+=" " + texte;
	html+='</a>';
	document.write(html);
}

//***************************
function afficher_bouton_supprimer_param(nom_fonction, id, titre, id2,id3, texte)
{
document.write(bouton_supprimer_param_html(nom_fonction, id, titre, id2,id3, texte));
}

//---------------------------------------
function bouton_supprimer_param_html(nom_fonction, id, titre, id2,id3, texte)
{
	var html, url, fonction;

	if (nom_fonction!="")
		fonction=nom_fonction;
	else 
		fonction="confirmer_suppression";

	titre = chaine_js_param_preparer(titre);	
	url="javascript:" + fonction + "('" + id + "', '"  + titre + "'"; 

	if (id2 && id2.length>0)
	  url+=", '" + id2 + "'";

	if (id3 && id3.length>0)
	  url+=", '" + id3 + "'";

	url+=");"
	html='<a href="' + url + '">';
	html+='<img src="../images/icones/icone_supprimer.gif" border="0" alt="Supprimer" align="absmiddle">';
	if (texte && texte.length>0)
		html+=" " + texte;
	html+='</a>';
	return(html);
}

//------------------------
function afficher_pixel_trans(l, h)
{
	document.write(afficher_pixel_trans_html(l, h));
}

//------------------------
function afficher_pixel_trans_html(l, h)
{
	var html;

	html="";
	html+='<img src="../images/interface/interface_pixel_trans.gif" border="0" ';
	html+='width="' + l + '"'; 
	html+='height="' + h + '"';  
	html+='align="absmiddle">';
	return(html);
}


//------------------------
function actionbloc_haut()
{
var html;

html='<table cellpadding="0" cellspacing="0" border="1">';
html+='<tr><td width="4"><img src="../images/interface/actionbloc_coin_haut_gauche.gif" border="0" width="4" height="4"></td>';
html+='<td class="actionblocfond"><img src="../images/interface/interface_pixel_trans.gif" border="0"  width="300" height="4"></td>';
html+='<td width="4"><img src="../images/interface/actionbloc_coin_haut_droit.gif" border="0"  width="4" height="4"></td></tr>';
html+='<tr><td colspan="3">';

document.write(html);
}


//------------------------
function actionbloc_bas()
{
var html;

html="";
html+='</td></tr>';
html+='<tr><td width="4"><img src="../images/interface/actionbloc_coin_bas_gauche.gif" border="0" width="4" height="4"></td>';
html+='<td class="actionblocfond"><img src="../images/interface/interface_pixel_trans.gif" border="0" width="4" height="4"></td>';
html+='<td width="4"><img src="../images/interface/actionbloc_coin_bas_droit.gif" border="0" width="4" height="4"></td></tr>';
html+="</table>";
document.write(html);
}

//------------------------
function actionbloc_separation(l, h)
{
var html;

var html;

html="";
html+='<img src="../images/interface/actionbloc_separation.gif" border="0" ';
html+='width="' + l + '"'; 
html+='height="' + h + '"';  
html+='align="absmiddle">';
document.write(html);
}


//--------------------------------------------------------------
//ET 26/04/06
function resultat_entete_cellule_html(titre, ordre, largeur, tri_fonction_param)
{
	var t, tri_fonction;
	
	if  (tri_fonction_param && tri_fonction_param.length>0) 
		tri_fonction=tri_fonction_param;
	else
		tri_fonction="changer_ordre"
			
	t='';
	t+='<td';
	if (ordre) 
		t+=' onclick="'+ tri_fonction + '(\'' + ordre + '\')"'; 
	if (largeur && largeur.length >0) 
		t+=' width="' + largeur  + "";
	t+= '>';
	
	t+='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
	if (ordre)
	{
		t+='<tr><td valign="middle" class="entetecolonne" nowrap>';
		t+='<img id="ordre_' + ordre + '" class="titrecolonne" src="../images/interface/fleche_bleubas.gif"/>';
		t+='<span class="titrecolonne">';
	}
	else
	{
		t+='<tr><td valign="middle" class="entetecolonnesimple">';
		t+='<span class="titrecolonnesimple">';
	}
	if (!titre || titre.length==0) titre='&nbsp;';
	t=t + titre + '</span>';
	t+='</td>';
	t+=resultat_entete_separation_html();
	t+='</tr></table></td>';
	
	return(t);
}

//--------------------------------------------------------------
//ET 26/04/06
function resultat_entete_separation_html()
{
	var t;
	t='';
	t+='<td width="1"><div class="entete_colonne">';
	t+='<img src="../images/interface/tableau_separation.gif"/>';
	t+='</div></td>';
	return(t);
}



//------------------------
function reconnexion()
{
	if (window.name.indexOf("FICHE")>0 || opener)
	{
		self.close();
		if (opener)
		{
			opener.location.href="../accueil/accueil_login.asp"; 
			opener.focus();
		}	
	}
	location.href="../accueil/accueil_login.asp";
}


//-------------------------------
function classement_afficher(id_classement, modeaff, param){
	location.href="../ressources/ressources_gerer.asp?id_classement="+id_classement;
}
