Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1581 | Rev 1584 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1581 Rev 1582
1
//+----------------------------------------------------------------------------------------------------------+
1
//+----------------------------------------------------------------------------------------------------------+
2
// Onglets et Portlets
2
// Onglets et Portlets
3
/**
3
/**
4
 * Les variables suivantes ont été ajoutée par php
4
 * Les variables suivantes ont été ajoutée par php
5
 * 
5
 * 
6
 * var urlTexteBrutSectionWikiTpl : url pour obtenir le texte brut d'une section de wiki
6
 * var urlTexteBrutSectionWikiTpl : url pour obtenir le texte brut d'une section de wiki
7
 * var urlEditionSectionWikiTpl : url pour éditer une section du wiki 
7
 * var urlEditionSectionWikiTpl : url pour éditer une section du wiki 
8
 * var urlTexteFormateSectionWikiTpl : url pour obtenir le texte formaté en html d'une section de wiki
8
 * var urlTexteFormateSectionWikiTpl : url pour obtenir le texte formaté en html d'une section de wiki
9
 * var pageWikiTaxon : url pour obtenir le texte formaté en html d'une section de wiki
9
 * var pageWikiTaxon : url pour obtenir le texte formaté en html d'une section de wiki
10
 * var urlPopup = url de base pour les popup contenant du code un peu complexe
10
 * var urlPopup = url de base pour les popup contenant du code un peu complexe
11
 * 
11
 * 
12
*/
12
*/
13
 
13
 
14
/**
14
/**
15
 * Variables globales du script
15
 * Variables globales du script
16
 */
16
 */
17
var modules = Array();
17
var modules = Array();
18
var tableauOnglets = Array();
-
 
19
var nbOngletsInvisibles = 0;
-
 
20
var ongletSyntheseCharge = true;
-
 
21
var ongletIllustrationsCharge = false;
-
 
22
var REFERENTIEL = "<?php echo Registre::get('parametres.referentiel'); ?>";
18
var REFERENTIEL = "<?php echo Registre::get('parametres.referentiel'); ?>";
23
 
19
 
24
/** Classe Module
20
/** Classe Module
25
* Définit un module de type portlet
21
* Définit un module de type portlet
26
**/
22
**/
27
function Module(id, module, onglet, statique) {
23
function Module(id, module, onglet, statique) {
28
 
24
 
29
	// Variables de classe : identifiant, titre, et le HTML du résumé à afficher dans le contenu
25
	// Variables de classe : identifiant, titre, et le HTML du résumé à afficher dans le contenu
30
	this.id = id;
26
	this.id = id;
31
	this.titre;
27
	this.titre;
32
	this.htmlResume;
28
	this.htmlResume;
33
	this.statique = statique;
29
	this.statique = statique;
34
 
30
 
35
	
31
	
36
 
32
 
37
function getUrlVars() {
33
function getUrlVars() {
38
    var vars = [], hash;
34
    var vars = [], hash;
39
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
35
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
40
    for (var i = 0; i < hashes.length; i++) {
36
    for (var i = 0; i < hashes.length; i++) {
41
        hash = hashes[i].split('=');
37
        hash = hashes[i].split('=');
42
        vars.push(hash[0]);
38
        vars.push(hash[0]);
43
        vars[hash[0]] = hash[1];
39
        vars[hash[0]] = hash[1];
44
    }
40
    }
45
    return vars;
41
    return vars;
46
}
42
}
47
 
43
 
48
 
44
 
49
// remplace des liens directs vers les onglets par des liens permettant de ne charger
45
// remplace des liens directs vers les onglets par des liens permettant de ne charger
50
// que le contenu de l'onglet (pour le plugin tab)
46
// que le contenu de l'onglet (pour le plugin tab)
51
function remplacerUrlsOnglets() {
47
function remplacerUrlsOnglets() {
52
		$(".lien-onglet").each(function() {
48
		$(".lien-onglet").each(function() {
53
		var urlOnglet = $(this).attr('href');
49
		var urlOnglet = $(this).attr('href');
54
		var urlVars = urlOnglet.slice(urlOnglet.indexOf('?') + 1);
50
		var urlVars = urlOnglet.slice(urlOnglet.indexOf('?') + 1);
55
		urlBase = base_url_application_onglets+"?"+urlVars;
51
		urlBase = base_url_application_onglets+"?"+urlVars;
56
		urlOnglet = urlBase.replace('action=fiche','action=onglet');
52
		urlOnglet = urlBase.replace('action=fiche','action=onglet');
57
		$(this).attr('href', urlOnglet);
53
		$(this).attr('href', urlOnglet);
58
	});
54
	});
59
}
55
}
60
 
56
 
61
 
57
 
62
 
58
 
63
//+----------------------------------------------------------------------------------------------------------+
59
//+----------------------------------------------------------------------------------------------------------+
64
// Wikini Flora
60
// Wikini Flora
65
var htmlWikiOriginal = '';
61
var htmlWikiOriginal = '';
66
var objetContenuWiki = null;
62
var objetContenuWiki = null;
67
 
63
 
68
function getTemplateFormulaireEditionWiki(page, section, texte) {	
64
function getTemplateFormulaireEditionWiki(page, section, texte) {	
69
	var urlWebServiceWiki = getUrlEditionPourPageEtSection(page, section);
65
	var urlWebServiceWiki = getUrlEditionPourPageEtSection(page, section);
70
	var formulaire = 
66
	var formulaire = 
71
		'<form method="post" id="formulaire_edition_wiki" name="formulaire_edition_wiki" action="'+urlWebServiceWiki+'">'+
67
		'<form method="post" id="formulaire_edition_wiki" name="formulaire_edition_wiki" action="'+urlWebServiceWiki+'">'+
72
		  '<div>'+
68
		  '<div>'+
73
		  	'<textarea id="pageContenu" name="pageContenu" class="champ_edition_wiki">'+texte+'</textarea>'+
69
		  	'<textarea id="pageContenu" name="pageContenu" class="champ_edition_wiki">'+texte+'</textarea>'+
74
		  '</div>'+
70
		  '</div>'+
75
		  '<input type="hidden" name="pageSectionTitre" id="pageSectionTitre" value="'+section+'" />'+
71
		  '<input type="hidden" name="pageSectionTitre" id="pageSectionTitre" value="'+section+'" />'+
76
		  '<input type="submit" text="sauver" />'+
72
		  '<input type="submit" text="sauver" />'+
77
	  	  '<input class="bouton_annuler_edition" type="button" value="annuler" />';
73
	  	  '<input class="bouton_annuler_edition" type="button" value="annuler" />';
78
		'</form>';		
74
		'</form>';		
79
	return formulaire;
75
	return formulaire;
80
}
76
}
81
 
77
 
82
function getSection() {
78
function getSection() {
83
	return objetContenuWiki.attr("title");
79
	return objetContenuWiki.attr("title");
84
}
80
}
85
 
81
 
86
function getPageWikiTaxon() {
82
function getPageWikiTaxon() {
87
	return pageWikiTaxon;
83
	return pageWikiTaxon;
88
}
84
}
89
 
85
 
90
function getUrlEditionPourPageEtSection(page, section) {
86
function getUrlEditionPourPageEtSection(page, section) {
91
	var url = urlEditionSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
87
	var url = urlEditionSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
92
	return url;
88
	return url;
93
}
89
}
94
 
90
 
95
function getUrlTextePourPageSectionBrute(page, section) {
91
function getUrlTextePourPageSectionBrute(page, section) {
96
	return urlTexteBrutSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
92
	return urlTexteBrutSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
97
}
93
}
98
 
94
 
99
function getUrlTextePourPageSectionFormatee(page, section) {
95
function getUrlTextePourPageSectionFormatee(page, section) {
100
	return urlTexteFormateSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
96
	return urlTexteFormateSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
101
}
97
}
102
 
98
 
103
function remplacerContenuWikiParFormulaireEdition(objet_contenu) {
99
function remplacerContenuWikiParFormulaireEdition(objet_contenu) {
104
	objetContenuWiki = objet_contenu;
100
	objetContenuWiki = objet_contenu;
105
	var adresse = getUrlEditionPourPageEtSection(getPageWikiTaxon(), getSection());
101
	var adresse = getUrlEditionPourPageEtSection(getPageWikiTaxon(), getSection());
106
	htmlWikiOriginal = objet_contenu.html();
102
	htmlWikiOriginal = objet_contenu.html();
107
	$.getJSON(adresse, function(data) {
103
	$.getJSON(adresse, function(data) {
108
		$(objetContenuWiki).removeClass('editable_sur_clic').html(getTemplateFormulaireEditionWiki(getPageWikiTaxon(), getSection(), data.texte));
104
		$(objetContenuWiki).removeClass('editable_sur_clic').html(getTemplateFormulaireEditionWiki(getPageWikiTaxon(), getSection(), data.texte));
109
	});
105
	});
110
}
106
}
111
 
107
 
112
function gererEvenementsWiki() {
108
function gererEvenementsWiki() {
113
	//TODO: ajout automatique d'un lien ouvrant une page d'aide (un popup) au formatage des pages wikini
109
	//TODO: ajout automatique d'un lien ouvrant une page d'aide (un popup) au formatage des pages wikini
114
	$('.editable_sur_clic').live('dblclick',function(event) {
110
	$('.editable_sur_clic').live('dblclick',function(event) {
115
		remplacerContenuWikiParFormulaireEdition($(this));
111
		remplacerContenuWikiParFormulaireEdition($(this));
116
	});
112
	});
117
	
113
	
118
	$('#formulaire_edition_wiki').live('submit',function(event) {
114
	$('#formulaire_edition_wiki').live('submit',function(event) {
119
	    event.preventDefault(); 
115
	    event.preventDefault(); 
120
		var valeurs = $(this).serialize();
116
		var valeurs = $(this).serialize();
121
		$.post($(this).attr('action'), valeurs, function(data) {
117
		$.post($(this).attr('action'), valeurs, function(data) {
122
			var adresse = getUrlTextePourPageSectionFormatee(getPageWikiTaxon(), getSection());
118
			var adresse = getUrlTextePourPageSectionFormatee(getPageWikiTaxon(), getSection());
123
			$.getJSON(adresse, function(data) {
119
			$.getJSON(adresse, function(data) {
124
				$(objetContenuWiki).addClass('editable_sur_clic').html(data.texte);
120
				$(objetContenuWiki).addClass('editable_sur_clic').html(data.texte);
125
			});
121
			});
126
		});
122
		});
127
	});
123
	});
128
	
124
	
129
	$('.bouton_annuler_edition').live('click', function(event) {
125
	$('.bouton_annuler_edition').live('click', function(event) {
130
		event.preventDefault();
126
		event.preventDefault();
131
		$(objetContenuWiki).addClass('editable_sur_clic').html(htmlWikiOriginal);
127
		$(objetContenuWiki).addClass('editable_sur_clic').html(htmlWikiOriginal);
132
	});
128
	});
133
	
129
	
134
	rendreLienAffichableDansNouvelleFenetre('.contenu_editable');
130
	rendreLienAffichableDansNouvelleFenetre('.contenu_editable');
135
}
131
}
136
 
132
 
137
//+----------------------------------------------------------------------------------------------------------+
133
//+----------------------------------------------------------------------------------------------------------+
138
//Affichage dans une nouvelle fenetre
134
//Affichage dans une nouvelle fenetre
139
function rendreLienAffichableDansNouvelleFenetre(selecteur) {
135
function rendreLienAffichableDansNouvelleFenetre(selecteur) {
140
	$(selecteur).find('a').live('click', function(event) {
136
	$(selecteur).find('a').live('click', function(event) {
141
		window.open($(this).attr('href'));
137
		window.open($(this).attr('href'));
142
		event.preventDefault();
138
		event.preventDefault();
143
		return false;
139
		return false;
144
	});
140
	});
145
}
141
}
146
 
142
 
147
//+----------------------------------------------------------------------------------------------------------+
143
//+----------------------------------------------------------------------------------------------------------+
148
// Plier / déplier
144
// Plier / déplier
149
function plierTout() {
145
function plierTout() {
150
	$('.nom').children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
146
	$('.nom').children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
151
	$('.plus').css('display', 'none');
147
	$('.plus').css('display', 'none');
152
}
148
}
153
 
149
 
154
function deplierTout() {
150
function deplierTout() {
155
	$('.nom').children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
151
	$('.nom').children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
156
	$('.plus').css('display', 'inline');
152
	$('.plus').css('display', 'inline');
157
}
153
}
158
 
154
 
159
function gestionBiblio(parent) {
155
function gestionBiblio(parent) {
160
	$('.nom').each(function () {
156
	$('.nom').each(function () {
161
		if ($(this).children('.plus').length == 0) {
157
		if ($(this).children('.plus').length == 0) {
162
			html = $(this).html();
158
			html = $(this).html();
163
			
159
			
164
			// La partie biblio commence au premier crochet ouvrant
160
			// La partie biblio commence au premier crochet ouvrant
165
			// ou bien au span de la biblio à exclure
161
			// ou bien au span de la biblio à exclure
166
			posCrochetGauche = html.indexOf('[');
162
			posCrochetGauche = html.indexOf('[');
167
			posbiblioAExclure = html.indexOf('<span class="bib_excl">');
163
			posbiblioAExclure = html.indexOf('<span class="bib_excl">');
168
			
164
			
169
			if(posCrochetGauche < 0 || (posbiblioAExclure > 0 && posbiblioAExclure < posCrochetGauche)) {
165
			if(posCrochetGauche < 0 || (posbiblioAExclure > 0 && posbiblioAExclure < posCrochetGauche)) {
170
				posCrochetGauche = posbiblioAExclure;
166
				posCrochetGauche = posbiblioAExclure;
171
			}
167
			}
172
			
168
			
173
			// console.log(posCrochetGauche+" "+posbiblioAExclure);
169
			// console.log(posCrochetGauche+" "+posbiblioAExclure);
174
			
170
			
175
			
171
			
176
			if (posCrochetGauche > 0) {
172
			if (posCrochetGauche > 0) {
177
				nom = html.substr(0, posCrochetGauche);
173
				nom = html.substr(0, posCrochetGauche);
178
				biblio = html.substr(posCrochetGauche, html.length);
174
				biblio = html.substr(posCrochetGauche, html.length);
179
				$(this).html(nom);
175
				$(this).html(nom);
180
				
176
				
181
				imagettePlus = document.createElement('div');
177
				imagettePlus = document.createElement('div');
182
				$(imagettePlus).addClass('imagettePlus');
178
				$(imagettePlus).addClass('imagettePlus');
183
				$(this).prepend($(imagettePlus));
179
				$(this).prepend($(imagettePlus));
184
				
180
				
185
				plus = document.createElement('span');
181
				plus = document.createElement('span');
186
				$(plus).addClass('plus');
182
				$(plus).addClass('plus');
187
				$(plus).html(biblio);
183
				$(plus).html(biblio);
188
				$(plus).hide();
184
				$(plus).hide();
189
				
185
				
190
				$(this).click(function(e) {
186
				$(this).click(function(e) {
191
					// test pour ne réagir que sur le clic sur le + ou -
187
					// test pour ne réagir que sur le clic sur le + ou -
192
					// TODO: fusionner ce bout de code en doublon avec synthese.js
188
					// TODO: fusionner ce bout de code en doublon avec synthese.js
193
					if($(e.target).hasClass("imagettePlus") || $(e.target).hasClass("imagetteMoins")) {
189
					if($(e.target).hasClass("imagettePlus") || $(e.target).hasClass("imagetteMoins")) {
194
						if (!$(this).children('.plus').is(':visible')) {
190
						if (!$(this).children('.plus').is(':visible')) {
195
							$(this).children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
191
							$(this).children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
196
							$(this).children('.plus').css('display', 'inline');
192
							$(this).children('.plus').css('display', 'inline');
197
						} else {
193
						} else {
198
							$(this).children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
194
							$(this).children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
199
							$(this).children('.plus').css('display', 'none');
195
							$(this).children('.plus').css('display', 'none');
200
						}
196
						}
201
					}
197
					}
202
					
198
					
203
				});
199
				});
204
					
200
					
205
				$(this).append($(plus));
201
				$(this).append($(plus));
206
				
202
				
207
			}
203
			}
208
		}
204
		}
209
	});
205
	});
210
}
206
}
211
 
207
 
212
function gererEvenementsPliage() {
208
function gererEvenementsPliage() {
213
	$('.lien_tout_deplier').live('click', function() {
209
	$('.lien_tout_deplier').live('click', function() {
214
		deplierTout();
210
		deplierTout();
215
	});
211
	});
216
	$('.lien_tout_plier').live('click', function() {
212
	$('.lien_tout_plier').live('click', function() {
217
		plierTout();
213
		plierTout();
218
	});
214
	});
219
	gestionBiblio(document);
215
	gestionBiblio(document);
220
}
216
}
221
 
217
 
222
//+----------------------------------------------------------------------------------------------------------+
218
//+----------------------------------------------------------------------------------------------------------+
223
//Pop Up images
219
//Pop Up images
224
function ouvrirPopUpImg(event) {
220
function ouvrirPopUpImg(event) {
225
	event.preventDefault();
221
	event.preventDefault();
226
	window.open($(this).attr('href'),"Photo_"+$(this).children("img").attr("data-num-image"),
222
	window.open($(this).attr('href'),"Photo_"+$(this).children("img").attr("data-num-image"),
227
			'"'+'height='+event.data.h+',width='+event.data.w+',top='+event.data.t+',left='+event.data.l 
223
			'"'+'height='+event.data.h+',width='+event.data.w+',top='+event.data.t+',left='+event.data.l 
228
			+',toolbar='+event.data.toolbar+',menubar='+event.data.menubar +',location='
224
			+',toolbar='+event.data.toolbar+',menubar='+event.data.menubar +',location='
229
			+event.data.location+',resizable='+event.data.resizable+',scrollbars='+event.data.scrollbars 
225
			+event.data.location+',resizable='+event.data.resizable+',scrollbars='+event.data.scrollbars 
230
			+',status='+event.data.status+'"');
226
			+',status='+event.data.status+'"');
231
}
227
}
232
 
228
 
233
//+----------------------------------------------------------------------------------------------------------+
229
//+----------------------------------------------------------------------------------------------------------+
234
// Message de chargement pour les graphique écologie
230
// Message de chargement pour les graphique écologie
235
function gererChargementGraphiqueEcologie() {
231
function gererChargementGraphiqueEcologie() {
236
	$('.ecologie_svg').addClass('chargement');
232
	$('.ecologie_svg').addClass('chargement');
237
}
233
}
238
 
234
 
239
function gererAffichageLegendeEcologie() {
235
function gererAffichageLegendeEcologie() {
240
	$('.voir').live('click', function() {
236
	$('.voir').live('click', function() {
241
		$(this).siblings('.legende_graphique').show();
237
		$(this).siblings('.legende_graphique').show();
242
		$(this).siblings('.cacher').show();
238
		$(this).siblings('.cacher').show();
243
		$(this).hide();
239
		$(this).hide();
244
	});
240
	});
245
	
241
	
246
	$('.cacher').live('click', function() {
242
	$('.cacher').live('click', function() {
247
		$(this).siblings('.legende_graphique').hide();
243
		$(this).siblings('.legende_graphique').hide();
248
		$(this).siblings('.voir').show();
244
		$(this).siblings('.voir').show();
249
		$(this).hide();
245
		$(this).hide();
250
	});
246
	});
251
}
247
}
252
 
248
 
253
 
249
 
254
//+----------------------------------------------------------------------------------------------------------+
250
//+----------------------------------------------------------------------------------------------------------+
255
// Initialisation
251
// Initialisation
256
var fancyboxinitialise = false;
252
var fancyboxinitialise = false;
257
var param_popup_Coste = {h: 650, w: 550, t: 100, l: 100, 
253
var param_popup_Coste = {h: 650, w: 550, t: 100, l: 100, 
258
		toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
254
		toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
259
 
255
 
260
var param_popup_Cel = {h: 750, w: 630, t: 100, l: 100, 
256
var param_popup_Cel = {h: 750, w: 630, t: 100, l: 100, 
261
		toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
257
		toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
262
 
258
 
263
//Initialisation (uniquement sur la présence de la div bloc-fiche, qui contient la fiche eflore)
259
//Initialisation (uniquement sur la présence de la div bloc-fiche, qui contient la fiche eflore)
264
$(document).one('ficheSyntheseChargee', function() {
260
$(document).one('ficheSyntheseChargee', function() {
265
	initialiserOnglets();
261
	initialiserOnglets();
266
 
262
 
267
	// TODO : devrait être .on() à la place de live()
263
	// TODO : devrait être .on() à la place de live()
268
	$('.lien_popup').live('click',function(event) {
264
	$('.lien_popup').live('click',function(event) {
269
		event.preventDefault();
265
		event.preventDefault();
270
		$.fancybox(this,{
266
		$.fancybox(this,{
271
			autoDimensions:false,
267
			autoDimensions:false,
272
			width:580
268
			width:580
273
		});
269
		});
274
	});
270
	});
275
	
271
	
276
	// TODO : devrait être .on() à la place de live()
272
	// TODO : devrait être .on() à la place de live()
277
	$('.lien_popup.lien_metadonnees').live('click',function(event) {
273
	$('.lien_popup.lien_metadonnees').live('click',function(event) {
278
		event.preventDefault();
274
		event.preventDefault();
279
		$.fancybox(this,{
275
		$.fancybox(this,{
280
			autoDimensions:true
276
			autoDimensions:true
281
		});
277
		});
282
	});
278
	});
283
		
279
		
284
	$('.lien-image-cel').live('click', param_popup_Cel , ouvrirPopUpImg);
280
	$('.lien-image-cel').live('click', param_popup_Cel , ouvrirPopUpImg);
285
	$('.lien-image-coste').live('click', param_popup_Coste , ouvrirPopUpImg);
281
	$('.lien-image-coste').live('click', param_popup_Coste , ouvrirPopUpImg);
286
	
282
	
287
	afficherOngletsPourNiveau();
283
	afficherOngletsPourNiveau();
288
 
284
 
289
	gererEvenementsWiki();
285
	gererEvenementsWiki();
290
	gererEvenementsPliage();
286
	gererEvenementsPliage();
291
	
287
	
292
	$('a.lien_retour_synthese').click(function(event) {
288
	$('a.lien_retour_synthese').click(function(event) {
293
		$('#onglet_synthese a').click();
289
		$('#onglet_synthese a').click();
294
		event.preventDefault();
290
		event.preventDefault();
295
	});
291
	});
296
	
292
	
297
	$(window).resize(function() {
293
	$(window).resize(function() {
298
		redimensionnerOnglets();
294
		redimensionnerOnglets();
299
	});
295
	});
300
	redimensionnerOnglets();
296
	redimensionnerOnglets();
301
	
297
	
302
	if($("#bloc-fiche").length > 0) {
298
	if($("#bloc-fiche").length > 0) {
303
		// initialisation de l'url avec l'onglet par défaut ou bien 
299
		// initialisation de l'url avec l'onglet par défaut ou bien 
304
		// celui qui a été explicitement demandé
300
		// celui qui a été explicitement demandé
305
		mettreAJourUrl(permalienNumNom+"-"+onglet, onglet);
301
		mettreAJourUrl(permalienNumNom+"-"+onglet, onglet);
306
	}
302
	}
307
	gererInteractionsPermaliens();
303
	gererInteractionsPermaliens();
308
});
304
});
309
 
305
 
310
function ajouterEvenement(elementHtml, nomEvenement, functionCallBack) {  
306
function ajouterEvenement(elementHtml, nomEvenement, functionCallBack) {  
311
	if(!!elementHtml && elementHtml != null) {	
307
	if(!!elementHtml && elementHtml != null) {	
312
		if(elementHtml.attachEvent) {// Internet Explorer
308
		if(elementHtml.attachEvent) {// Internet Explorer
313
			elementHtml.attachEvent("on" + nomEvenement, function() {functionCallBack.call(elementHtml);}); 
309
			elementHtml.attachEvent("on" + nomEvenement, function() {functionCallBack.call(elementHtml);}); 
314
		} else if(elementHtml.addEventListener) { // Firefox & autres
310
		} else if(elementHtml.addEventListener) { // Firefox & autres
315
			elementHtml.addEventListener(nomEvenement, functionCallBack, false);
311
			elementHtml.addEventListener(nomEvenement, functionCallBack, false);
316
		}
312
		}
317
	}
313
	}
318
}
314
}
319
 
315
 
320
$(document).one('ongletRepartitionCharge', function() {
316
$(document).one('ongletRepartitionCharge', function() {
321
	var contRepObs = $(".conteneur_repartition_observations");
317
	var contRepObs = $(".conteneur_repartition_observations");
322
	contRepObs.addClass("chargement_repartition");
318
	contRepObs.addClass("chargement_repartition");
323
	// utilisation d'une fonction native car jQuery refuse d'ajouter un évènement load
319
	// utilisation d'une fonction native car jQuery refuse d'ajouter un évènement load
324
	// sur autre chose qu'une image
320
	// sur autre chose qu'une image
325
	$('#repartition_observations').ready(function() {
321
	$('#repartition_observations').ready(function() {
326
		ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
322
		ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
327
			contRepObs.removeClass("chargement_repartition");
323
			contRepObs.removeClass("chargement_repartition");
328
		});
324
		});
329
	});
325
	});
330
	// lien "recalculer la carte de moissonnage"
326
	// lien "recalculer la carte de moissonnage"
331
	$('#lien_recalculer_carte').click(function() {
327
	$('#lien_recalculer_carte').click(function() {
332
		var carteMoissonnageSvg = $('#repartition_observations'); // c'est plutôt "moissonnage" que "répartition" => squelette pourave power
328
		var carteMoissonnageSvg = $('#repartition_observations'); // c'est plutôt "moissonnage" que "répartition" => squelette pourave power
333
		var urlCarte = carteMoissonnageSvg.attr("data");
329
		var urlCarte = carteMoissonnageSvg.attr("data");
334
		urlCarte += '&recalculer=1';
330
		urlCarte += '&recalculer=1';
335
		contRepObs.addClass("chargement_repartition");
331
		contRepObs.addClass("chargement_repartition");
336
		carteMoissonnageSvg.attr("data", urlCarte);ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
332
		carteMoissonnageSvg.attr("data", urlCarte);ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
337
			contRepObs.removeClass("chargement_repartition");
333
			contRepObs.removeClass("chargement_repartition");
338
		});
334
		});
339
		return false;
335
		return false;
340
	});
336
	});
341
});
337
});
342
 
338
 
343
 
339
 
344
// À la fin du chargement de l'onglet Illustrations
340
// À la fin du chargement de l'onglet Illustrations
345
$(document).one('ongletIllustrationsCharge', function() {
341
$(document).one('ongletIllustrationsCharge', function() {
346
	$('a.lien-images-organes.fourni').live('click', afficherOngletOrgane);
342
	$('a.lien-images-organes.fourni').live('click', afficherOngletOrgane);
347
	$('a.lien-grande-image-organe').live('click', afficherGrandeImageOrgane);
343
	$('a.lien-grande-image-organe').live('click', afficherGrandeImageOrgane);
348
	// pour que la galerie soit ouverte par défaut sur le premier organe non vide
344
	// pour que la galerie soit ouverte par défaut sur le premier organe non vide
349
	var premier = $('a.lien-images-organes.fourni').first().data('tag');
345
	var premier = $('a.lien-images-organes.fourni').first().data('tag');
350
	afficherOngletOrgane(null, premier);
346
	afficherOngletOrgane(null, premier);
351
	
347
	
352
	$('a.lien_telechargement_image').live('click',function(e) {
348
	$('a.lien_telechargement_image').live('click',function(e) {
353
		if($(e.target).data('oneclicked')!='yes')
349
		if($(e.target).data('oneclicked')!='yes')
354
		{
350
		{
355
			$(e.target).data('oneclicked','yes');
351
			$(e.target).data('oneclicked','yes');
356
			$(this).fancybox({
352
			$(this).fancybox({
357
				"type" : "iframe",
353
				"type" : "iframe",
358
				"autoDimensions" : false,
354
				"autoDimensions" : false,
359
				"width" : 800,
355
				"width" : 800,
360
				"height" : 405,
356
				"height" : 405,
361
				"titleShow" : false
357
				"titleShow" : false
362
			}).click();
358
			}).click();
363
		}
359
		}
364
 
360
 
365
		e.preventDefault();
361
		e.preventDefault();
366
		return false;
362
		return false;
367
	});
363
	});
368
});
364
});
369
 
365
 
370
// Affiche les n images ayant le plus de votes, pour l'organe $tag
366
// Affiche les n images ayant le plus de votes, pour l'organe $tag
371
function afficherOngletOrgane(e, tag) {
367
function afficherOngletOrgane(e, tag) {
372
	var onglets = $('div.onglet-organe'),
368
	var onglets = $('div.onglet-organe'),
373
		contenu = $('#galerie-organes-contenu'),
369
		contenu = $('#galerie-organes-contenu'),
374
		organeOnglet;
370
		organeOnglet;
375
 
371
 
376
	if (tag === undefined) {
372
	if (tag === undefined) {
377
		tag = $(this).data('tag')
373
		tag = $(this).data('tag')
378
	}
374
	}
379
	if ($(this).parent().hasClass('active')) { // replier
375
	if ($(this).parent().hasClass('active')) { // replier
380
		$(this).parent().removeClass('active')
376
		$(this).parent().removeClass('active')
381
		contenu.hide();
377
		contenu.hide();
382
		return false;
378
		return false;
383
	}
379
	}
384
 
380
 
385
	onglets.each(function() {
381
	onglets.each(function() {
386
		organeOnglet = $(this).data('tag');
382
		organeOnglet = $(this).data('tag');
387
		var li = $('a.lien-images-organes[data-tag="' + organeOnglet + '"]').parent();
383
		var li = $('a.lien-images-organes[data-tag="' + organeOnglet + '"]').parent();
388
		if (organeOnglet == tag) {
384
		if (organeOnglet == tag) {
389
			$(this).show();
385
			$(this).show();
390
			li.addClass('active');
386
			li.addClass('active');
391
		} else {
387
		} else {
392
			$(this).hide();
388
			$(this).hide();
393
			li.removeClass('active');
389
			li.removeClass('active');
394
		}
390
		}
395
	});
391
	});
396
 
392
 
397
	contenu.show();
393
	contenu.show();
398
 
394
 
399
	var premierLienGrandeImage = $('div.onglet-organe:visible').find('a.lien-grande-image-organe').first(),
395
	var premierLienGrandeImage = $('div.onglet-organe:visible').find('a.lien-grande-image-organe').first(),
400
		grandeImage = $('#grande-image-organe').find('img');
396
		grandeImage = $('#grande-image-organe').find('img');
401
	premierLienGrandeImage.trigger('click');
397
	premierLienGrandeImage.trigger('click');
402
	grandeImage.show('fast');
398
	grandeImage.show('fast');
403
 
399
 
404
	return false;
400
	return false;
405
}
401
}
406
 
402
 
407
// Affiche en grand sous les miniatures l'image d'organe sur laquelle on a cliqué
403
// Affiche en grand sous les miniatures l'image d'organe sur laquelle on a cliqué
408
function afficherGrandeImageOrgane() {
404
function afficherGrandeImageOrgane() {
409
	if ($(this).data('id-image') === "") {
405
	if ($(this).data('id-image') === "") {
410
		return false;
406
		return false;
411
	}
407
	}
412
	var grandeImage = $('#grande-image-organe').find('img'),
408
	var grandeImage = $('#grande-image-organe').find('img'),
413
		source = $(this).find('img').attr('src');
409
		source = $(this).find('img').attr('src');
414
	source = obtenirUrlMoyenFormatIdImage($(this).data('id-image'));
410
	source = obtenirUrlMoyenFormatIdImage($(this).data('id-image'));
415
	// chargement image et lien popup
411
	// chargement image et lien popup
416
	grandeImage.attr('src', source);
412
	grandeImage.attr('src', source);
417
	// important pour Pinterest et cie.
413
	// important pour Pinterest et cie.
418
	grandeImage.attr('alt', $(this).data('auteur') + ' - ' + $(this).data('titre'));
414
	grandeImage.attr('alt', $(this).data('auteur') + ' - ' + $(this).data('titre'));
419
	grandeImage.parent().attr('href',obtenirUrlGrandFormatIdImage($(this).data('id-image')));
415
	grandeImage.parent().attr('href',obtenirUrlGrandFormatIdImage($(this).data('id-image')));
420
	// métadonnées
416
	// métadonnées
421
	var metadonnees = ['id-image', 'titre', 'description', 'localisation', 'auteur'],
417
	var metadonnees = ['id-image', 'titre', 'description', 'localisation', 'auteur'],
422
		clef;
418
		clef;
423
	for (var i = 0; i < metadonnees.length; i++) {
419
	for (var i = 0; i < metadonnees.length; i++) {
424
		clef = metadonnees[i];
420
		clef = metadonnees[i];
425
		var contenu = $(this).data(clef);
421
		var contenu = $(this).data(clef);
426
		if(clef == 'id-image') {
422
		if(clef == 'id-image') {
427
			contenu += 
423
			contenu += 
428
				'    <a title="T\xE9l\xE9charger cette image" class="lien_telechargement_image" href="'+urlBaseWidget+'telechargement?id_image='+$(this).data(clef)+'">'+
424
				'    <a title="T\xE9l\xE9charger cette image" class="lien_telechargement_image" href="'+urlBaseWidget+'telechargement?id_image='+$(this).data(clef)+'">'+
429
					'<img class="icone_action_ill" src="'+urlCssImages+'sauver.png" />'+
425
					'<img class="icone_action_ill" src="'+urlCssImages+'sauver.png" />'+
430
				'</a>    '+
426
				'</a>    '+
431
				'<a title="Voir plus d\'informations sur cette image (s\'ouvre dans un popup)" class="lien-image-cel" href="'+urlPopup+'?module=popup-illustrations&action=fiche&referentiel=bdtfx&id=' + $(this).data('id-image')+'">'+
427
				'<a title="Voir plus d\'informations sur cette image (s\'ouvre dans un popup)" class="lien-image-cel" href="'+urlPopup+'?module=popup-illustrations&action=fiche&referentiel=bdtfx&id=' + $(this).data('id-image')+'">'+
432
					'<img class="icone_action_ill" src="'+urlCssImages+'infos_image.png" />'+
428
					'<img class="icone_action_ill" src="'+urlCssImages+'infos_image.png" />'+
433
				'</a>'+
429
				'</a>'+
434
				'<a style="float:right" title="Signaler une mauvaise identification ou en proposer une autre via l\'outil identiplante" class="signaler-mauvaise-identification" href="' + $(this).data('url-mauvaise-ident') + '" target="_blank">' +
430
				'<a style="float:right" title="Signaler une mauvaise identification ou en proposer une autre via l\'outil identiplante" class="signaler-mauvaise-identification" href="' + $(this).data('url-mauvaise-ident') + '" target="_blank">' +
435
					'<img class="icone_action_ill" src="'+urlCssImages+'mauvaise_id.png">Signaler une mauvaise identification' +
431
					'<img class="icone_action_ill" src="'+urlCssImages+'mauvaise_id.png">Signaler une mauvaise identification' +
436
				'</a>';
432
				'</a>';
437
		}
433
		}
438
		$('#grande-image-legende-' + clef).html(contenu);
434
		$('#grande-image-legende-' + clef).html(contenu);
439
 
435
 
440
	}
436
	}
441
	// valeurs génériques
437
	// valeurs génériques
442
	$('#grande-image-legende-' + clef).html($(this).data(clef));
438
	$('#grande-image-legende-' + clef).html($(this).data(clef));
443
	$('#grande-image-legende-date').html(formaterDateVersFrancais($(this).data('date')));
439
	$('#grande-image-legende-date').html(formaterDateVersFrancais($(this).data('date')));
444
	$('#grande-image-legende-id-destinataire').attr('href', urlPopup+'?module=popup-contact&action=form&referentiel='+REFERENTIEL+'&id_destinataire=' +
440
	$('#grande-image-legende-id-destinataire').attr('href', urlPopup+'?module=popup-contact&action=form&referentiel='+REFERENTIEL+'&id_destinataire=' +
445
			$(this).data('id-destinataire') + '&id_img=' + $(this).data('id-image'));
441
			$(this).data('id-destinataire') + '&id_img=' + $(this).data('id-image'));
446
	$('#grande-image-legende-id-destinataire').attr('title', "Envoyer un message \xE0 l'auteur \xE0 propos de cette image (n\xE9cessite d'\xEAtre identifi\xE9)");
442
	$('#grande-image-legende-id-destinataire').attr('title', "Envoyer un message \xE0 l'auteur \xE0 propos de cette image (n\xE9cessite d'\xEAtre identifi\xE9)");
447
	$('#grande-image-legende-auteur').attr('href', 'http://tela-botanica.org/profil:' + $(this).data('id-destinataire'));
443
	$('#grande-image-legende-auteur').attr('href', 'http://tela-botanica.org/profil:' + $(this).data('id-destinataire'));
448
	$('#grande-image-legende-auteur').attr('target', '_blank');
444
	$('#grande-image-legende-auteur').attr('target', '_blank');
449
	$('#grande-image-legende-auteur').attr('title', "Voir le profil de cet utilisateur (n\xE9cessite d'\xEAtre identifi\xE9)");
445
	$('#grande-image-legende-auteur').attr('title', "Voir le profil de cet utilisateur (n\xE9cessite d'\xEAtre identifi\xE9)");
450
 
446
 
451
 
447
 
452
	$('#grande-image-legende-id-image a.lien_telechargement_image').unbind('click.fb').fancybox({
448
	$('#grande-image-legende-id-image a.lien_telechargement_image').unbind('click.fb').fancybox({
453
		"type" : "iframe",
449
		"type" : "iframe",
454
		"autoDimensions" : false,
450
		"autoDimensions" : false,
455
		"width" : 800,
451
		"width" : 800,
456
		"height" : 405,
452
		"height" : 405,
457
		"titleShow" : false
453
		"titleShow" : false
458
	});
454
	});
459
}
455
}
460
 
456
 
461
function obtenirUrlMoyenFormatIdImage(idImage) {
457
function obtenirUrlMoyenFormatIdImage(idImage) {
462
	idImage = remplirChaineDebut(idImage, "0", 9);
458
	idImage = remplirChaineDebut(idImage, "0", 9);
463
	return urlImagesOrganesMoyenFormatTpl.replace('{id_image}', idImage);
459
	return urlImagesOrganesMoyenFormatTpl.replace('{id_image}', idImage);
464
}
460
}
465
 
461
 
466
function obtenirUrlGrandFormatIdImage(idImage) {
462
function obtenirUrlGrandFormatIdImage(idImage) {
467
	idImage = remplirChaineDebut(idImage, "0", 9);
463
	idImage = remplirChaineDebut(idImage, "0", 9);
468
	return urlImagesOrganesGrandFormatTpl.replace('{id_image}', idImage);
464
	return urlImagesOrganesGrandFormatTpl.replace('{id_image}', idImage);
469
}
465
}
470
 
466
 
471
function remplirChaineDebut(chaine, remplissage, longueur) {
467
function remplirChaineDebut(chaine, remplissage, longueur) {
472
	while(chaine.toString().length < longueur) {
468
	while(chaine.toString().length < longueur) {
473
		chaine = remplissage.toString()+chaine.toString();
469
		chaine = remplissage.toString()+chaine.toString();
474
	}
470
	}
475
	return chaine;
471
	return chaine;
476
}
472
}
477
 
473
 
478
// transforme une date du type "2012-04-06" en "06 avril 2012"
474
// transforme une date du type "2012-04-06" en "06 avril 2012"
479
function formaterDateVersFrancais(date) {
475
function formaterDateVersFrancais(date) {
480
	var mois = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
476
	var mois = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
481
		amj_hms = date.split(' '),
477
		amj_hms = date.split(' '),
482
		amj = amj_hms[0].split('-');
478
		amj = amj_hms[0].split('-');
483
	return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0];
479
	return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0];
484
}
480
}
485
 
481
 
486
 
482
 
487
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse
483
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse
488
function gererClicIllustrationsFiche() {
484
function gererClicIllustrationsFiche() {
489
	$('.illustration_cel').live('click', function() {
485
	$('.illustration_cel').live('click', function() {
490
		var url_image = $(this).attr('src');
486
		var url_image = $(this).attr('src');
491
		var titre = $('.nomenclature').first().text();
487
		var titre = $('.nomenclature').first().text();
492
		var url = urlPopup+"?module=popup-galerie&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
488
		var url = urlPopup+"?module=popup-galerie&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
493
		//var url = urlPopup+"?module=popup-galerie-organes&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
489
		//var url = urlPopup+"?module=popup-galerie-organes&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
494
		//alert(url);
490
		//alert(url);
495
		//return false;
491
		//return false;
496
		window.open(url, $(this).attr('data-num-nom'), 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(375));
492
		window.open(url, $(this).attr('data-num-nom'), 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(375));
497
	}); 
493
	}); 
498
}
494
}
499
 
495
 
500
function ouvrirFenetreIllustrationFiche(url, titre, hauteur, largeur) {
496
function ouvrirFenetreIllustrationFiche(url, titre, hauteur, largeur) {
501
	var fenetre = window.open('_blank', '','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(largeur+17)+', height='+(hauteur+17));
497
	var fenetre = window.open('_blank', '','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(largeur+17)+', height='+(hauteur+17));
502
	var tmp = fenetre.document;
498
	var tmp = fenetre.document;
503
	tmp.write('<html><head><title>'+titre+'</title>');
499
	tmp.write('<html><head><title>'+titre+'</title>');
504
	tmp.write('</head><body>');
500
	tmp.write('</head><body>');
505
	tmp.write('<p style="height='+hauteur+'px;text-align:center;line-height='+hauteur+'px;"><img id="image_agrandie" height="'+hauteur+'" width="'+largeur+'" style="vertical-align:middle;" src="'+url+'" /></p>');
501
	tmp.write('<p style="height='+hauteur+'px;text-align:center;line-height='+hauteur+'px;"><img id="image_agrandie" height="'+hauteur+'" width="'+largeur+'" style="vertical-align:middle;" src="'+url+'" /></p>');
506
	tmp.write('</body></html>');
502
	tmp.write('</body></html>');
507
	tmp.close();
503
	tmp.close();
508
}
504
}
509
 
505
 
510
 
506
 
511
// met à jour l'url dans la barre du navigateur ainsi que dans le permalien en bas
507
// met à jour l'url dans la barre du navigateur ainsi que dans le permalien en bas
512
// de la fiche
508
// de la fiche
513
function mettreAJourUrl(nouvelleUrl, etat) {
509
function mettreAJourUrl(nouvelleUrl, etat) {
514
	$('#permalien_num_nom').val(nouvelleUrl);
510
	$('#permalien_num_nom').val(nouvelleUrl);
515
	if (!!(window.history && window.history.pushState)) {
511
	if (!!(window.history && window.history.pushState)) {
516
		var currentState = window.history.state;
512
		var currentState = window.history.state;
517
		if (currentState != nouvelleUrl && !!etat) {
513
		if (currentState != nouvelleUrl && !!etat) {
518
			window.history.pushState(etat, "", nouvelleUrl);
514
			window.history.pushState(etat, "", nouvelleUrl);
519
		}
515
		}
520
	}
516
	}
521
}
517
}
522
 
518
 
523
function gererInteractionsPermaliens() {	
519
function gererInteractionsPermaliens() {	
524
	$(".conteneur_permalien > a").each(function() {
520
	$(".conteneur_permalien > a").each(function() {
525
		var txt = '<input type="text" id="'+$(this).attr('id')+'" readonly="readonly" class="lien_externe" value="'+$(this).attr('href')+'">';
521
		var txt = '<input type="text" id="'+$(this).attr('id')+'" readonly="readonly" class="lien_externe" value="'+$(this).attr('href')+'">';
526
		$(this).replaceWith(txt);
522
		$(this).replaceWith(txt);
527
	});
523
	});
528
	$(".conteneur_permalien > input").each(function() {
524
	$(".conteneur_permalien > input").each(function() {
529
		$(this).attr('size', $(this).val().length - 7);
525
		$(this).attr('size', $(this).val().length - 7);
530
	});
526
	});
531
	$(".conteneur_permalien > input").hover(
527
	$(".conteneur_permalien > input").hover(
532
		function() {
528
		function() {
533
			 $(this).select();
529
			 $(this).select();
534
		}, function() {
530
		}, function() {
535
			// rien à faire sur le mouseout
531
			// rien à faire sur le mouseout
536
		}
532
		}
537
	);
533
	);
538
}
534
}
539
 
535
 
540
function gererTemplatesChargementALaDemande() {
536
function gererTemplatesChargementALaDemande() {
541
	$('.lien-ajax-tpl a.lien-ajax-tpl-chargement').on('click', function(e) {
537
	$('.lien-ajax-tpl a.lien-ajax-tpl-chargement').on('click', function(e) {
542
		if($(this).attr('data-loading') != "true") {
538
		if($(this).attr('data-loading') != "true") {
543
			$(this).attr('data-loading', "true");
539
			$(this).attr('data-loading', "true");
544
			e.preventDefault();
540
			e.preventDefault();
545
			urlTpl = $(this).attr('href');
541
			urlTpl = $(this).attr('href');
546
			$(this).hide();
542
			$(this).hide();
547
			thisElementParent = $(this).parent();
543
			thisElementParent = $(this).parent();
548
			thisElementParent.append("<div class='tab-chargement'>Chargement des informations...</div>");
544
			thisElementParent.append("<div class='tab-chargement'>Chargement des informations...</div>");
549
			$.get(urlTpl, function( data ) {
545
			$.get(urlTpl, function( data ) {
550
				thisElementParent.replaceWith( data );
546
				thisElementParent.replaceWith( data );
551
			});
547
			});
552
			return false;
548
			return false;
553
		}
549
		}
554
	});
550
	});
555
}
551
}
556
 
552
 
557
$(document).ready(function() {
553
$(document).ready(function() {
558
	gererChargementGraphiqueEcologie();
554
	gererChargementGraphiqueEcologie();
559
	gererAffichageLegendeEcologie();
555
	gererAffichageLegendeEcologie();
560
	gererTemplatesChargementALaDemande();
556
	gererTemplatesChargementALaDemande();
561
	if (document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') == false) {
557
	if (document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') == false) {
562
		$('.svg').each(function() {
558
		$('.svg').each(function() {
563
			alt = $(this).attr('alt');
559
			alt = $(this).attr('alt');
564
			img = document.createElement('img');
560
			img = document.createElement('img');
565
			img.src = alt;
561
			img.src = alt;
566
			$(this).replaceWith(img);
562
			$(this).replaceWith(img);
567
		});
563
		});
568
	}
564
	}
569
});
565
});
570
 
566