Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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