(function($) {
$(document).ready(function() {
	var fMenu = $(".sousTitreBlock .sousTitreGhe");
	fMenu.find(".btnSousTitreGheCont")
		.mouseenter(showCheminMenu)
		.mouseleave(hideCheminMenu)
		.dblclick(open);
});

function showCheminMenu() {
	var self = $(this);
	if (self.css('overflow') == "hidden") {
		self.css('overflow', 'visible').find(".btnSousTitrePop").prepend('<div class="absolute"></div>'); // IE7 fix
		if ($(this).hasClass('firstMenu')) $(".sousTitreBlock .coin3Titre").hide();
	} else {
		hideCheminMenu.apply(this);
	}
}

function hideCheminMenu() {
	var self = $(this);
	self.css('overflow', 'hidden');
	self.find(".btnSousTitrePop div.absolute").remove();
	if ($(this).hasClass('firstMenu')) $(".sousTitreBlock .coin3Titre").show();
}

function open(e) {
	e.preventDefault();
	e.stopPropagation();
	var fButton = $(e.target).closest('p.btnSousTitreGhe');
	if (fButton.length == 0) return;
	var fHref = fButton.attr('title');
	if (fHref.length == 0) fHref = '/';
	if (fHref.charAt(fHref.length-1) == '/') fHref = fHref.substr(0, fHref.length-1);
	document.location = '/livescore/' + pHref;
}
})(jQuery);

