$(function() {
	var current = $('#top .section a').filter(function() { return location.href.indexOf(this.href) != -1; });
	
	if (current.size()) {
		current.addClass('current');		

		if (current.hasClass('subSection')) current.prevAll('.head').addClass('current');

		if (current.attr('href').indexOf('services') != -1 || current.attr('href') == 'societe.php') {
			current.parents('.section').next('.section').children('.head').addClass('current');
		
		} else if (current.attr('href').indexOf('societe') != -1) {
			current.parents('.section').prev('.section').children('.head').addClass('current');
		
		}		
	}
	
	$('#top #navigation .section a').hover(
		function() { 
			$(this).prevAll('.head').addClass('hover');
			
			if ($(this).attr('href').indexOf('services') != -1 || $(this).attr('href') == 'societe.php') {
				$(this).parents('.section').next('.section').children('.head').addClass('hover');
			
			} else if ($(this).attr('href').indexOf('societe') != -1 || $(this).attr('href') == '#') {
				$(this).parents('.section').prev('.section').children('.head').addClass('hover');
			
			}
		}, 
		function() { 
			$(this).prevAll('.head').removeClass('hover');
			
			if ($(this).attr('href').indexOf('services') != -1 || $(this).attr('href') == 'societe.php') {
	  		$(this).parents('.section').next('.section').children('.head').removeClass('hover');
	  	
	  	} else if ($(this).attr('href').indexOf('societe') != -1 || $(this).attr('href') == '#') {
	  		$(this).parents('.section').prev('.section').children('.head').removeClass('hover');
	  	
			}			
		});
});