
/*
 *
 * Pour le menu en haut dans IE6: émule :hover sur li
 *
 */
jQuery(function($) {
	if (!$.browser.msie || parseInt($.browser.version) > 6)
		return;

	// fix box model of #menu
	var w = $('#menu li li a:eq(0)').width(); // requires http://plugins.jquery.com/project/dimensions
	$('#menu li li a').css('width',w+'px');

	// fix box model of #recherche
	var w = $('#recherche li li a:eq(0)').width();
	$('#recherche li li a').css('width',w+'px');

	// was shown in IE6 only with CSS hack in stylesheet 
	// for the fix above to get accurate width
	$('#menu ul, #recherche ul').hide();

	// hover routine to show/hide menu
	$('#menu li, #recherche li').hover(
		function() { // in
			var from = $('a:first', this).attr('class');
			if (/quartiers/i.test(from)) {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul.quartiers').show();
					},
					function() { // out
						$('ul.quartiers').hide();
					}
				);
			}
			else if (/ponts/i.test(from)) {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul.ponts').show();
					},
					function() { // out
						$('ul.ponts').hide();
					}
				);
			}
			else if (/recherche/i.test(from)) {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul.recherche').show();
					},
					function() { // out
						$('ul.recherche').hide();
					}
				);
			}
			else {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul ul').hide();
					},
					function() { // out
						$('ul ul').hide();
					}
				);
			}
			$('ul',this).show();
		},
		function() { // out
			var from = $('a:first', this).attr('class');
			if (/quartiers/i.test(from)) {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul.quartiers').show();
					},
					function() { // out
						$('ul.quartiers').hide();
					}
				);
			}
			else if (/ponts/i.test(from)) {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul.ponts').show();
					},
					function() { // out
						$('ul.ponts').hide();
					}
				);
			}
			else if (/recherche/i.test(from)) {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul.recherche').show();
					},
					function() { // out
						$('ul.recherche').hide();
					}
				);
			}
			else {
				$('#conteneur > div.ligne-separateur').hover(
					function() { // in
						$('ul ul').hide();
					},
					function() { // out
						$('ul ul').hide();
					}
				);
			}
			$('ul',this).hide();
		}
	);

	// hover effect for #menu ul.quartiers li
	$('#menu ul.quartiers li').hover(
		function() { // in
			$(this).css('background-color','#8ea716');
		},
		function() { // out
			$(this).css('background-color','');
		}
	);

	// hover effect for #menu ul.ponts li
	$('#menu ul.ponts li').hover(
		function() { // in
			$(this).css('background-color','#254b71');
		},
		function() { // out
			$(this).css('background-color','');
		}
	);

	// hover effect for #recherche li li
	$('#recherche li li').hover(
		function() { // in
			$(this).css('background-color','#8ea716');
			var bg = $(this)
				.css('background-image')
				.replace(/fleche-droite/,'fleche-droite-blanche');
			$(this).css('background-image',bg);
		},
		function() { // out
			$(this).css('background-image','');
			$(this).css('background-color','');
		}
	);

	// fix multipleclasses bug http://www.quirksmode.org/css/multipleclasses.html
	$('#menu li a.quartiers.selected').css('background-color','#8ea716');
	$('#menu li a.visites.selected').css('background-color','#caaa2f');
	$('#menu li a.jeunesse.selected').css('background-color','#854fa3');
	$('#menu li a.ponts.selected').css('background-color','#254b71');
	$('#recherche li a.recherche.selected').css('background-color','#8ea716');

	// fix height bug
	$('#conteneur > div.ligne-separateur')
		.css({
			'position': 'relative',
			'top': '-3px'
		})
});

/* équivalents css


// fix height bug
.ligne-separateur {
	position: relative;
	top: -3px;
}


div#menu-principal ul#menu li:hover ul {
	display: block;
}
div#menu-principal ul#menu ul.quartiers li:hover {
	background-color: #8ea716;
}
div#menu-principal ul#menu ul.ponts li:hover {
	background-color: #254b71;
}

div#menu-principal #recherche li:hover ul {
	display: block;
}
div#menu-principal #recherche li li:hover {
	background-color: #8ea716;
	background-image: url(../images/fleche-droite-blanche.gif);
}


http://www.quirksmode.org/css/multipleclasses.html
div#menu-principal ul#menu li a.quartiers.selected {
	background-color: #8ea716;
}
div#menu-principal ul#menu li a.visites.selected {
	background-color: #caaa2f;
}
div#menu-principal ul#menu li a.jeunesse.selected {
	background-color: #854fa3;
}
div#menu-principal ul#menu li a.ponts.selected {
	background-color: #254b71;
}
div#top div#menu-principal ul#recherche li a.recherche.selected {
	background-color: #8ea716;
}


*/

