/**
 * @author remi
 */

$(document).ready(function() { 
	
	/*
	// Sorter le tableau
	$("table#membres").tablesorter( {sortList: [[0,0]]} ); 
	
	// Filtre par domaine
	$('select[@name=domaines]').change(function() {
		if ($(this).val() != "Tous les domaines") {
			$('#membres tbody tr').hide().find('td ul:contains(' + $(this).val() + ')').parent().parent().show();
		} else {
			// on affiche tous les membres
			$('#membres tbody tr').show();
		}
	})
	
	// Lien sur toute la rangée
	
	$('table#membres td').mouseover(function() {
		try { jQuery = jQuery; } 
		catch (e) { alert(e); return false; }
		$(this).parent().addClass("over");
	}).mouseout(function() {
		try { jQuery = jQuery; } 
		catch (e) { return false; }
		$(this).parent().removeClass("over");
	}).click(function() {
		window.location = $(this).parent().find('td:first-child a').attr("href");
	});
	*/
	
	// PNG transparents
	$('img[@src$=.png]').ifixpng();
	
	// Meilleure gestion du bouton "Retour"
	$('div.retour a').each(function() {
		$(this).attr('href','javascript:history.back(-1)');
	});
	
	// Hauteur de la boite
	
	if ($('div#accueil').length > 0) {
		newH = $('div#accueil').height() - $('div.boite.mission h2.titre').height() - 42;
		$('div.boite.mission .contenu').height(newH);
	}
	
	// Tables des matières
	var compteurSection=1;
	if ($('a[@rel=table-des-matieres]').length > 0) {
		$($('a[@rel=table-des-matieres]')).after('<ul id="toc"></ul>');

		$('div.contenu-inner p').each(function() {
			if (
				($('*', this).length === 1 && $('strong', this).length === 1) ||
				($('strong.titre', this).length != 0)
			   ) {
				$(this).attr("id", "section-"+compteurSection);
				$('ul#toc').append('<li><a href="#section-'+compteurSection+'">'+$(this).text()+'</a></li>');
				compteurSection++;
			}
		})
	}
	
	$('#liste-membres > ul > li > a').click(function() {
		return false;
	});
	
});  