Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1584 Rev 1593
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').live('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').live('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').live('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').live('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').live('click', function() {
209
		deplierTout();
209
		deplierTout();
210
	});
210
	});
211
	$('.lien_tout_plier').live('click', function() {
211
	$('.lien_tout_plier').live('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').live('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').live('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
	initialiserOnglets();
-
 
261
 
-
 
262
	// TODO : devrait être .on() à la place de live()
260
	// TODO : devrait être .on() à la place de live()
263
	$('.lien_popup').live('click',function(event) {
261
	$('.lien_popup').live('click',function(event) {
264
		event.preventDefault();
262
		event.preventDefault();
265
		$.fancybox(this,{
263
		$.fancybox(this,{
266
			autoDimensions:false,
264
			autoDimensions:false,
267
			width:580
265
			width:580
268
		});
266
		});
269
	});
267
	});
270
	
268
	
271
	// TODO : devrait être .on() à la place de live()
269
	// TODO : devrait être .on() à la place de live()
272
	$('.lien_popup.lien_metadonnees').live('click',function(event) {
270
	$('.lien_popup.lien_metadonnees').live('click',function(event) {
273
		event.preventDefault();
271
		event.preventDefault();
274
		$.fancybox(this,{
272
		$.fancybox(this,{
275
			autoDimensions:true
273
			autoDimensions:true
276
		});
274
		});
277
	});
275
	});
278
		
276
		
279
	$('.lien-image-cel').live('click', param_popup_Cel , ouvrirPopUpImg);
277
	$('.lien-image-cel').live('click', param_popup_Cel , ouvrirPopUpImg);
280
	$('.lien-image-coste').live('click', param_popup_Coste , ouvrirPopUpImg);
278
	$('.lien-image-coste').live('click', param_popup_Coste , ouvrirPopUpImg);
281
	
-
 
282
	afficherOngletsPourNiveau();
-
 
283
 
279
	
284
	gererEvenementsWiki();
280
	gererEvenementsWiki();
285
	gererEvenementsPliage();
281
	gererEvenementsPliage();
286
	
282
	
287
	$('a.lien_retour_synthese').click(function(event) {
283
	$('a.lien_retour_synthese').click(function(event) {
288
		$('#onglet_synthese a').click();
284
		$('#onglet_synthese a').click();
289
		event.preventDefault();
285
		event.preventDefault();
290
	});
286
	});
291
	
287
	
292
	$(window).resize(function() {
288
	$(window).resize(function() {
293
		redimensionnerOnglets();
289
		redimensionnerOnglets();
294
	});
290
	});
295
	redimensionnerOnglets();
291
	redimensionnerOnglets();
296
	
292
	
297
	if($("#bloc-fiche").length > 0) {
293
	if($("#bloc-fiche").length > 0) {
298
		// initialisation de l'url avec l'onglet par défaut ou bien 
294
		// initialisation de l'url avec l'onglet par défaut ou bien 
299
		// celui qui a été explicitement demandé
295
		// celui qui a été explicitement demandé
300
		mettreAJourUrl(permalienNumNom+"-"+onglet, onglet);
296
		mettreAJourUrl(permalienNumNom+"-"+onglet, onglet);
301
	}
297
	}
302
	gererInteractionsPermaliens();
298
	gererInteractionsPermaliens();
303
});
299
});
304
 
300
 
305
function ajouterEvenement(elementHtml, nomEvenement, functionCallBack) {  
301
function ajouterEvenement(elementHtml, nomEvenement, functionCallBack) {  
306
	if(!!elementHtml && elementHtml != null) {	
302
	if(!!elementHtml && elementHtml != null) {	
307
		if(elementHtml.attachEvent) {// Internet Explorer
303
		if(elementHtml.attachEvent) {// Internet Explorer
308
			elementHtml.attachEvent("on" + nomEvenement, function() {functionCallBack.call(elementHtml);}); 
304
			elementHtml.attachEvent("on" + nomEvenement, function() {functionCallBack.call(elementHtml);}); 
309
		} else if(elementHtml.addEventListener) { // Firefox & autres
305
		} else if(elementHtml.addEventListener) { // Firefox & autres
310
			elementHtml.addEventListener(nomEvenement, functionCallBack, false);
306
			elementHtml.addEventListener(nomEvenement, functionCallBack, false);
311
		}
307
		}
312
	}
308
	}
313
}
309
}
314
 
310
 
315
$(document).one('ongletRepartitionCharge', function() {
311
$(document).one('ongletRepartitionCharge', function() {
316
	var contRepObs = $(".conteneur_repartition_observations");
312
	var contRepObs = $(".conteneur_repartition_observations");
317
	contRepObs.addClass("chargement_repartition");
313
	contRepObs.addClass("chargement_repartition");
318
	// utilisation d'une fonction native car jQuery refuse d'ajouter un évènement load
314
	// utilisation d'une fonction native car jQuery refuse d'ajouter un évènement load
319
	// sur autre chose qu'une image
315
	// sur autre chose qu'une image
320
	$('#repartition_observations').ready(function() {
316
	$('#repartition_observations').ready(function() {
321
		ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
317
		ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
322
			contRepObs.removeClass("chargement_repartition");
318
			contRepObs.removeClass("chargement_repartition");
323
		});
319
		});
324
	});
320
	});
325
	// lien "recalculer la carte de moissonnage"
321
	// lien "recalculer la carte de moissonnage"
326
	$('#lien_recalculer_carte').click(function() {
322
	$('#lien_recalculer_carte').click(function() {
327
		var carteMoissonnageSvg = $('#repartition_observations'); // c'est plutôt "moissonnage" que "répartition" => squelette pourave power
323
		var carteMoissonnageSvg = $('#repartition_observations'); // c'est plutôt "moissonnage" que "répartition" => squelette pourave power
328
		var urlCarte = carteMoissonnageSvg.attr("data");
324
		var urlCarte = carteMoissonnageSvg.attr("data");
329
		urlCarte += '&recalculer=1';
325
		urlCarte += '&recalculer=1';
330
		contRepObs.addClass("chargement_repartition");
326
		contRepObs.addClass("chargement_repartition");
331
		carteMoissonnageSvg.attr("data", urlCarte);ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
327
		carteMoissonnageSvg.attr("data", urlCarte);ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
332
			contRepObs.removeClass("chargement_repartition");
328
			contRepObs.removeClass("chargement_repartition");
333
		});
329
		});
334
		return false;
330
		return false;
335
	});
331
	});
336
});
332
});
337
 
333
 
338
 
334
 
339
// À la fin du chargement de l'onglet Illustrations
335
// À la fin du chargement de l'onglet Illustrations
340
$(document).one('ongletIllustrationsCharge', function() {
336
$(document).one('ongletIllustrationsCharge', function() {
341
	$('a.lien-images-organes.fourni').live('click', afficherOngletOrgane);
337
	$('a.lien-images-organes.fourni').live('click', afficherOngletOrgane);
342
	$('a.lien-grande-image-organe').live('click', afficherGrandeImageOrgane);
338
	$('a.lien-grande-image-organe').live('click', afficherGrandeImageOrgane);
343
	// pour que la galerie soit ouverte par défaut sur le premier organe non vide
339
	// pour que la galerie soit ouverte par défaut sur le premier organe non vide
344
	var premier = $('a.lien-images-organes.fourni').first().data('tag');
340
	var premier = $('a.lien-images-organes.fourni').first().data('tag');
345
	afficherOngletOrgane(null, premier);
341
	afficherOngletOrgane(null, premier);
346
	
342
	
347
	$('a.lien_telechargement_image').live('click',function(e) {
343
	$('a.lien_telechargement_image').live('click',function(e) {
348
		if($(e.target).data('oneclicked')!='yes')
344
		if($(e.target).data('oneclicked')!='yes')
349
		{
345
		{
350
			$(e.target).data('oneclicked','yes');
346
			$(e.target).data('oneclicked','yes');
351
			$(this).fancybox({
347
			$(this).fancybox({
352
				"type" : "iframe",
348
				"type" : "iframe",
353
				"autoDimensions" : false,
349
				"autoDimensions" : false,
354
				"width" : 800,
350
				"width" : 800,
355
				"height" : 405,
351
				"height" : 405,
356
				"titleShow" : false
352
				"titleShow" : false
357
			}).click();
353
			}).click();
358
		}
354
		}
359
 
355
 
360
		e.preventDefault();
356
		e.preventDefault();
361
		return false;
357
		return false;
362
	});
358
	});
363
});
359
});
364
 
360
 
365
// Affiche les n images ayant le plus de votes, pour l'organe $tag
361
// Affiche les n images ayant le plus de votes, pour l'organe $tag
366
function afficherOngletOrgane(e, tag) {
362
function afficherOngletOrgane(e, tag) {
367
	var onglets = $('div.onglet-organe'),
363
	var onglets = $('div.onglet-organe'),
368
		contenu = $('#galerie-organes-contenu'),
364
		contenu = $('#galerie-organes-contenu'),
369
		organeOnglet;
365
		organeOnglet;
370
 
366
 
371
	if (tag === undefined) {
367
	if (tag === undefined) {
372
		tag = $(this).data('tag')
368
		tag = $(this).data('tag')
373
	}
369
	}
374
	if ($(this).parent().hasClass('active')) { // replier
370
	if ($(this).parent().hasClass('active')) { // replier
375
		$(this).parent().removeClass('active')
371
		$(this).parent().removeClass('active')
376
		contenu.hide();
372
		contenu.hide();
377
		return false;
373
		return false;
378
	}
374
	}
379
 
375
 
380
	onglets.each(function() {
376
	onglets.each(function() {
381
		organeOnglet = $(this).data('tag');
377
		organeOnglet = $(this).data('tag');
382
		var li = $('a.lien-images-organes[data-tag="' + organeOnglet + '"]').parent();
378
		var li = $('a.lien-images-organes[data-tag="' + organeOnglet + '"]').parent();
383
		if (organeOnglet == tag) {
379
		if (organeOnglet == tag) {
384
			$(this).show();
380
			$(this).show();
385
			li.addClass('active');
381
			li.addClass('active');
386
		} else {
382
		} else {
387
			$(this).hide();
383
			$(this).hide();
388
			li.removeClass('active');
384
			li.removeClass('active');
389
		}
385
		}
390
	});
386
	});
391
 
387
 
392
	contenu.show();
388
	contenu.show();
393
 
389
 
394
	var premierLienGrandeImage = $('div.onglet-organe:visible').find('a.lien-grande-image-organe').first(),
390
	var premierLienGrandeImage = $('div.onglet-organe:visible').find('a.lien-grande-image-organe').first(),
395
		grandeImage = $('#grande-image-organe').find('img');
391
		grandeImage = $('#grande-image-organe').find('img');
396
	premierLienGrandeImage.trigger('click');
392
	premierLienGrandeImage.trigger('click');
397
	grandeImage.show('fast');
393
	grandeImage.show('fast');
398
 
394
 
399
	return false;
395
	return false;
400
}
396
}
401
 
397
 
402
// Affiche en grand sous les miniatures l'image d'organe sur laquelle on a cliqué
398
// Affiche en grand sous les miniatures l'image d'organe sur laquelle on a cliqué
403
function afficherGrandeImageOrgane() {
399
function afficherGrandeImageOrgane() {
404
	if ($(this).data('id-image') === "") {
400
	if ($(this).data('id-image') === "") {
405
		return false;
401
		return false;
406
	}
402
	}
407
	var grandeImage = $('#grande-image-organe').find('img'),
403
	var grandeImage = $('#grande-image-organe').find('img'),
408
		source = $(this).find('img').attr('src');
404
		source = $(this).find('img').attr('src');
409
	source = obtenirUrlMoyenFormatIdImage($(this).data('id-image'));
405
	source = obtenirUrlMoyenFormatIdImage($(this).data('id-image'));
410
	// chargement image et lien popup
406
	// chargement image et lien popup
411
	grandeImage.attr('src', source);
407
	grandeImage.attr('src', source);
412
	// important pour Pinterest et cie.
408
	// important pour Pinterest et cie.
413
	grandeImage.attr('alt', $(this).data('auteur') + ' - ' + $(this).data('titre'));
409
	grandeImage.attr('alt', $(this).data('auteur') + ' - ' + $(this).data('titre'));
414
	grandeImage.parent().attr('href',obtenirUrlGrandFormatIdImage($(this).data('id-image')));
410
	grandeImage.parent().attr('href',obtenirUrlGrandFormatIdImage($(this).data('id-image')));
415
	// métadonnées
411
	// métadonnées
416
	var metadonnees = ['id-image', 'titre', 'description', 'localisation', 'auteur'],
412
	var metadonnees = ['id-image', 'titre', 'description', 'localisation', 'auteur'],
417
		clef;
413
		clef;
418
	for (var i = 0; i < metadonnees.length; i++) {
414
	for (var i = 0; i < metadonnees.length; i++) {
419
		clef = metadonnees[i];
415
		clef = metadonnees[i];
420
		var contenu = $(this).data(clef);
416
		var contenu = $(this).data(clef);
421
		if(clef == 'id-image') {
417
		if(clef == 'id-image') {
422
			contenu += 
418
			contenu += 
423
				'    <a title="T\xE9l\xE9charger cette image" class="lien_telechargement_image" href="'+urlBaseWidget+'telechargement?id_image='+$(this).data(clef)+'">'+
419
				'    <a title="T\xE9l\xE9charger cette image" class="lien_telechargement_image" href="'+urlBaseWidget+'telechargement?id_image='+$(this).data(clef)+'">'+
424
					'<img class="icone_action_ill" src="'+urlCssImages+'sauver.png" />'+
420
					'<img class="icone_action_ill" src="'+urlCssImages+'sauver.png" />'+
425
				'</a>    '+
421
				'</a>    '+
426
				'<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')+'">'+
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')+'">'+
427
					'<img class="icone_action_ill" src="'+urlCssImages+'infos_image.png" />'+
423
					'<img class="icone_action_ill" src="'+urlCssImages+'infos_image.png" />'+
428
				'</a>'+
424
				'</a>'+
429
				'<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">' +
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">' +
430
					'<img class="icone_action_ill" src="'+urlCssImages+'mauvaise_id.png">Signaler une mauvaise identification' +
426
					'<img class="icone_action_ill" src="'+urlCssImages+'mauvaise_id.png">Signaler une mauvaise identification' +
431
				'</a>';
427
				'</a>';
432
		}
428
		}
433
		$('#grande-image-legende-' + clef).html(contenu);
429
		$('#grande-image-legende-' + clef).html(contenu);
434
 
430
 
435
	}
431
	}
436
	// valeurs génériques
432
	// valeurs génériques
437
	$('#grande-image-legende-' + clef).html($(this).data(clef));
433
	$('#grande-image-legende-' + clef).html($(this).data(clef));
438
	$('#grande-image-legende-date').html(formaterDateVersFrancais($(this).data('date')));
434
	$('#grande-image-legende-date').html(formaterDateVersFrancais($(this).data('date')));
439
	$('#grande-image-legende-id-destinataire').attr('href', urlPopup+'?module=popup-contact&action=form&referentiel='+REFERENTIEL+'&id_destinataire=' +
435
	$('#grande-image-legende-id-destinataire').attr('href', urlPopup+'?module=popup-contact&action=form&referentiel='+REFERENTIEL+'&id_destinataire=' +
440
			$(this).data('id-destinataire') + '&id_img=' + $(this).data('id-image'));
436
			$(this).data('id-destinataire') + '&id_img=' + $(this).data('id-image'));
441
	$('#grande-image-legende-id-destinataire').attr('title', "Envoyer un message \xE0 l'auteur \xE0 propos de cette image (n\xE9cessite d'\xEAtre identifi\xE9)");
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)");
442
	$('#grande-image-legende-auteur').attr('href', 'http://tela-botanica.org/profil:' + $(this).data('id-destinataire'));
438
	$('#grande-image-legende-auteur').attr('href', 'http://tela-botanica.org/profil:' + $(this).data('id-destinataire'));
443
	$('#grande-image-legende-auteur').attr('target', '_blank');
439
	$('#grande-image-legende-auteur').attr('target', '_blank');
444
	$('#grande-image-legende-auteur').attr('title', "Voir le profil de cet utilisateur (n\xE9cessite d'\xEAtre identifi\xE9)");
440
	$('#grande-image-legende-auteur').attr('title', "Voir le profil de cet utilisateur (n\xE9cessite d'\xEAtre identifi\xE9)");
445
 
441
 
446
 
442
 
447
	$('#grande-image-legende-id-image a.lien_telechargement_image').unbind('click.fb').fancybox({
443
	$('#grande-image-legende-id-image a.lien_telechargement_image').unbind('click.fb').fancybox({
448
		"type" : "iframe",
444
		"type" : "iframe",
449
		"autoDimensions" : false,
445
		"autoDimensions" : false,
450
		"width" : 800,
446
		"width" : 800,
451
		"height" : 405,
447
		"height" : 405,
452
		"titleShow" : false
448
		"titleShow" : false
453
	});
449
	});
454
}
450
}
455
 
451
 
456
function obtenirUrlMoyenFormatIdImage(idImage) {
452
function obtenirUrlMoyenFormatIdImage(idImage) {
457
	idImage = remplirChaineDebut(idImage, "0", 9);
453
	idImage = remplirChaineDebut(idImage, "0", 9);
458
	return urlImagesOrganesMoyenFormatTpl.replace('{id_image}', idImage);
454
	return urlImagesOrganesMoyenFormatTpl.replace('{id_image}', idImage);
459
}
455
}
460
 
456
 
461
function obtenirUrlGrandFormatIdImage(idImage) {
457
function obtenirUrlGrandFormatIdImage(idImage) {
462
	idImage = remplirChaineDebut(idImage, "0", 9);
458
	idImage = remplirChaineDebut(idImage, "0", 9);
463
	return urlImagesOrganesGrandFormatTpl.replace('{id_image}', idImage);
459
	return urlImagesOrganesGrandFormatTpl.replace('{id_image}', idImage);
464
}
460
}
465
 
461
 
466
function remplirChaineDebut(chaine, remplissage, longueur) {
462
function remplirChaineDebut(chaine, remplissage, longueur) {
467
	while(chaine.toString().length < longueur) {
463
	while(chaine.toString().length < longueur) {
468
		chaine = remplissage.toString()+chaine.toString();
464
		chaine = remplissage.toString()+chaine.toString();
469
	}
465
	}
470
	return chaine;
466
	return chaine;
471
}
467
}
472
 
468
 
473
// transforme une date du type "2012-04-06" en "06 avril 2012"
469
// transforme une date du type "2012-04-06" en "06 avril 2012"
474
function formaterDateVersFrancais(date) {
470
function formaterDateVersFrancais(date) {
475
	var mois = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
471
	var mois = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
476
		amj_hms = date.split(' '),
472
		amj_hms = date.split(' '),
477
		amj = amj_hms[0].split('-');
473
		amj = amj_hms[0].split('-');
478
	return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0];
474
	return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0];
479
}
475
}
480
 
476
 
481
 
477
 
482
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse
478
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse
483
function gererClicIllustrationsFiche() {
479
function gererClicIllustrationsFiche() {
484
	$('.illustration_cel').live('click', function() {
480
	$('.illustration_cel').live('click', function() {
485
		var url_image = $(this).attr('src');
481
		var url_image = $(this).attr('src');
486
		var titre = $('.nomenclature').first().text();
482
		var titre = $('.nomenclature').first().text();
487
		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;
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;
488
		//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;
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;
489
		//alert(url);
485
		//alert(url);
490
		//return false;
486
		//return false;
491
		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));
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));
492
	}); 
488
	}); 
493
}
489
}
494
 
490
 
495
function ouvrirFenetreIllustrationFiche(url, titre, hauteur, largeur) {
491
function ouvrirFenetreIllustrationFiche(url, titre, hauteur, largeur) {
496
	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));
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));
497
	var tmp = fenetre.document;
493
	var tmp = fenetre.document;
498
	tmp.write('<html><head><title>'+titre+'</title>');
494
	tmp.write('<html><head><title>'+titre+'</title>');
499
	tmp.write('</head><body>');
495
	tmp.write('</head><body>');
500
	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>');
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>');
501
	tmp.write('</body></html>');
497
	tmp.write('</body></html>');
502
	tmp.close();
498
	tmp.close();
503
}
499
}
504
 
500
 
505
 
501
 
506
// met à jour l'url dans la barre du navigateur ainsi que dans le permalien en bas
502
// met à jour l'url dans la barre du navigateur ainsi que dans le permalien en bas
507
// de la fiche
503
// de la fiche
508
function mettreAJourUrl(nouvelleUrl, etat) {
504
function mettreAJourUrl(nouvelleUrl, etat) {
509
	$('#permalien_num_nom').val(nouvelleUrl);
505
	$('#permalien_num_nom').val(nouvelleUrl);
510
	if (!!(window.history && window.history.pushState)) {
506
	if (!!(window.history && window.history.pushState)) {
511
		var currentState = window.history.state;
507
		var currentState = window.history.state;
512
		if (currentState != nouvelleUrl && !!etat) {
508
		if (currentState != nouvelleUrl && !!etat) {
513
			window.history.pushState(etat, "", nouvelleUrl);
509
			window.history.pushState(etat, "", nouvelleUrl);
514
		}
510
		}
515
	}
511
	}
516
}
512
}
517
 
513
 
518
function gererInteractionsPermaliens() {	
514
function gererInteractionsPermaliens() {	
519
	$(".conteneur_permalien > a").each(function() {
515
	$(".conteneur_permalien > a").each(function() {
520
		var txt = '<input type="text" id="'+$(this).attr('id')+'" readonly="readonly" class="lien_externe" value="'+$(this).attr('href')+'">';
516
		var txt = '<input type="text" id="'+$(this).attr('id')+'" readonly="readonly" class="lien_externe" value="'+$(this).attr('href')+'">';
521
		$(this).replaceWith(txt);
517
		$(this).replaceWith(txt);
522
	});
518
	});
523
	$(".conteneur_permalien > input").each(function() {
519
	$(".conteneur_permalien > input").each(function() {
524
		$(this).attr('size', $(this).val().length - 7);
520
		$(this).attr('size', $(this).val().length - 7);
525
	});
521
	});
526
	$(".conteneur_permalien > input").hover(
522
	$(".conteneur_permalien > input").hover(
527
		function() {
523
		function() {
528
			 $(this).select();
524
			 $(this).select();
529
		}, function() {
525
		}, function() {
530
			// rien à faire sur le mouseout
526
			// rien à faire sur le mouseout
531
		}
527
		}
532
	);
528
	);
533
}
529
}
534
 
530
 
535
function gererTemplatesChargementALaDemande() {
531
function gererTemplatesChargementALaDemande() {
536
	$('.lien-ajax-tpl a.lien-ajax-tpl-chargement').on('click', function(e) {
532
	$('.lien-ajax-tpl a.lien-ajax-tpl-chargement').on('click', function(e) {
537
		if($(this).attr('data-loading') != "true") {
533
		if($(this).attr('data-loading') != "true") {
538
			$(this).attr('data-loading', "true");
534
			$(this).attr('data-loading', "true");
539
			e.preventDefault();
535
			e.preventDefault();
540
			urlTpl = $(this).attr('href');
536
			urlTpl = $(this).attr('href');
541
			$(this).hide();
537
			$(this).hide();
542
			thisElementParent = $(this).parent();
538
			thisElementParent = $(this).parent();
543
			thisElementParent.append("<div class='tab-chargement'>Chargement des informations...</div>");
539
			thisElementParent.append("<div class='tab-chargement'>Chargement des informations...</div>");
544
			$.get(urlTpl, function( data ) {
540
			$.get(urlTpl, function( data ) {
545
				thisElementParent.replaceWith( data );
541
				thisElementParent.replaceWith( data );
546
			});
542
			});
547
			return false;
543
			return false;
548
		}
544
		}
549
	});
545
	});
550
}
546
}
551
 
547
 
552
$(document).ready(function() {
548
$(document).ready(function() {
553
	gererChargementGraphiqueEcologie();
549
	gererChargementGraphiqueEcologie();
554
	gererAffichageLegendeEcologie();
550
	gererAffichageLegendeEcologie();
555
	gererTemplatesChargementALaDemande();
551
	gererTemplatesChargementALaDemande();
556
	if (document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') === false) {
552
	if (document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') === false) {
557
		$('.svg').each(function() {
553
		$('.svg').each(function() {
558
			var img = document.createElement('img');
554
			var img = document.createElement('img');
559
			img.src = $(this).attr('alt');
555
			img.src = $(this).attr('alt');
560
			$(this).replaceWith(img);
556
			$(this).replaceWith(img);
561
		});
557
		});
562
	}
558
	}
563
});
559
});
564
 
560