/*
 * custom.js
 * requiert jQuery - http://jquery.com
 */

$(document).ready(function() {
	
	// Appels de notes
	$('#docText a[@class=footnotecall]')
		.prepend('&nbsp;[').append(']')
		.bind('click', function() {
			$('a#' + $(this).attr('id').substr(4))
				.parent().addClass('noteHighlight')
				.siblings().removeClass('noteHighlight');
		});
	$('#docText a[@class=endnotecall]')
		.prepend('&nbsp;[').append(']')
		.bind('click', function() {
			$('a#' + $(this).attr('id').substr(4))
				.parent().addClass('noteHighlight')
				.siblings().removeClass('noteHighlight');
		});
		
	// Notes de bas de page
	$('#notes a[@class*=ootnote]')
		.prepend('[').append(']')
		.bind('click', function() {
			$(this).parent().removeClass('noteHighlight');
		});
	$('#note a[@class*=endnote]')
		.prepend('[').append(']')
		.bind('click', function() {
			$(this).parent().removeClass('noteHighlight');
		});
	
	// hauteur colonne actualités
	$('#news').height($('#lastIssueSummary').height());
	
	// Hauteur navigation
	/*
	var contentHeight = $('#content').height();
	if (contentHeight > $('#nav').height()) {
		$('#nav').css({'height': contentHeight}).append('<p>'+contentHeight+' / '+'</p>');
	}
	*/
	
	// Recherche
	var q = $('#search #q');
	var qvalue = q.val();
	q.focus(function(){
		if($(this).val() == qvalue) $(this).val('');
	}).blur(function(){
		if($(this).val() == '') $(this).val(qvalue);
	});
	
});
