$(document).ready(function()
{	
	//over top ten
	$('.containerBlokTopTen').children('h6').children('a').mouseover(function(e)
	{
		var titre = $(this).children('span').html();
		var posX = e.pageX+5;
		var posY = e.pageY+5;
		$('#container_titreTopTen').children('p').html(titre);
		$('#container_titreTopTen').css({ 'left': posX+'px', 'top': posY+'px' }).show();
	});
	$('.containerBlokTopTen').children('h6').children('a').mousemove(function(e)
	{
		var posX = e.pageX+5;
		var posY = e.pageY+5;
		$('#container_titreTopTen').css({ 'left': posX+'px', 'top': posY+'px' }).show();
	});
	$('.containerBlokTopTen').children('h6').children('a').mouseout(function(e)
	{
		$('#container_titreTopTen').children('p').html("");
		$('#container_titreTopTen').hide();
	});
	
	//Champ de recherche
	$('.find').focus(function()
	{
		if($(this).val() == "Rechercher")
			$(this).val("");
	});
	
	$('.find').blur(function()
	{
		if($(this).val() == "")
			$(this).val("Rechercher");
	});
	
	
	//Fil d'ariane
	$("#breadCrumb").jBreadCrumb();
	
	//Reseaux sociaux + print + mail
	$('#sociauxContainerAllPage').melodySocial();
	
	var p = $("input[name='page']").val();
	
	//Menu
	$('.onglet_top').children('a').mouseover(function()
	{
		if($(this).attr('class') == 'followLink')
		{
			var recupId = $(this).attr('id').replace('gotop','');
			if(recupId != p)
				$(this).parent('.onglet_top').css('backgroundPosition', '0 0px');
		}
		else
		{
			if($(this).parent('.onglet_top').parent('.onglets').children('.sous_menu').css('display') == 'none')
				$(this).parent('.onglet_top').css('backgroundPosition', '0 0px');
		}
	});
	
	$('.onglet_top').children('a').mouseout(function()
	{
		if($(this).attr('class') == 'followLink')
		{
			var recupId = $(this).attr('id').replace('gotop','');
			if(recupId != p)
				$(this).parent('.onglet_top').css('backgroundPosition', '0 -67px');
		}
		else
		{
			if($(this).parent('.onglet_top').parent('.onglets').children('.sous_menu').css('display') == 'none')
				$(this).parent('.onglet_top').css('backgroundPosition', '0 -67px');
		}
	});
	
	$('.open_sousCat').click(function()
	{
		if($(this).parent('.onglet_top').parent('.onglets').children('.sous_menu').css('display') == 'none')
		{
			$('.sous_menu').slideUp(400);
			$(this).parent('.onglet_top').parent('.onglets').children('.sous_menu').slideDown(400);
		}
		else
		{
			$('.sous_menu').slideUp(400);
			$(this).parent('.onglet_top').css('backgroundPosition', '0 -67px');
		}
		return false;
	});
	
	$('.ssMenu_bg').children('a').mouseover(function()
	{
		$(this).css('color', '#000000');
	});
	$('.ssMenu_bg').children('a').mouseout(function()
	{
		$(this).css('color', '#535353');
	});
	
	$('.lettre_dinformation').click(function()
	{
		if($('#ssMenuLettre').css('display') == "none")
			$('#ssMenuLettre').slideDown(300);
		else
			$('#ssMenuLettre').slideUp(300);
		
		return false;
	});
});
