Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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