/*******************Gestion de transparance********************/
// JavaScript Document
// PNG fix
$(document).ready(function() {

	if( $.browser.msie && ($.browser.version == "6.0") ) {
		DD_belatedPNG.fix('#header h1, .bloc-reperes, .list-onglets-pictos li a img, #sidebar-left-in h2, .bloc-v-avez-projet li a img, form .recherche-aide img, .list-aide-result-left img');
	}

	if( $(".reduire a").length && $(".agrandir a").length){
		// Cookie
		var reload = $.cookie("reload");
		// Calling cookie
		if(reload) {
			document.getElementById("content-page").style.fontSize = reload;
		}
		var Ech = new Array("0%", "10%", "25%", "40%", "55%", "70%", "85%", "100%", "115%", "130%", "145%", "160%", "175%", "190%", "220%");
		if(reload)
			Cpt = $.inArray(reload, Ech);
		else
			Cpt = 4;
		$(".reduire a").click(function(){
			if(Cpt > 0) {
				Cpt--;
					document.getElementById("content-page").style.fontSize = Ech[Cpt];
			}
			$.cookie("reload",Ech[Cpt]);

			return(false);
		});
		$(".agrandir a").click(function(){
			if(Cpt < (Ech.length-1)) {
				Cpt++;
					document.getElementById("content-page").style.fontSize = Ech[Cpt];
			}
			$.cookie("reload",Ech[Cpt]);
			return(false);
		});
	}

});
/**********************System onglets************************/
$(function(){
    $(".switch_onglets .content_onglet").hide();
    $(".switch_onglets .content_onglet:eq(0)").show();
});

$(function(){
    $(".switch_onglets ul a").click(function(){ 
		$('".switch_onglets ul li a').removeClass('activated');
		$(this).addClass('activated');
        $(".switch_onglets .content_onglet").hide();
        $("."+this.rel).show();
		this.blur();
        return false;
    });
	/*****POPIN*****/
	$(".link-popin").popin ({
		width:621,
		height:450,
		opacity:.6,
		className:'searchPopin'
	});
	
	/***********menu_gauche************/

	$("ul.menu-left ul:not('.menu-open-at-load')").hide();
	/*$("li.toggle-sub-menu span").each( function () {
		var TexteSpan = $(this).text();
		$(this).replaceWith('<a href="" title="Afficher le sous-menu" class="link-menu-contact">' + TexteSpan + '</a>') ;
	} ) ;*/
	$('.menu-open-at-load').prev("a").attr("title", "Masquer le sous-menu");
	$("li.toggle-sub-menu > a").click( function () {
		if ($(this).next("ul.menu-left ul:visible").length != 0) {
			$(this).next("ul.menu-left ul").slideUp("slow", function() {
				$(this).parent().removeClass("menu-open");
				//$(this).prev("a").attr("title", "Afficher le sous-menu");
			});
			$(".menu-open a").attr("title", "Masquer le sous-menu");
		}
		else {
			$("ul.menu-left ul").slideUp("slow", function () { 
			$(this).parent().removeClass("menu-open") } );
			$(this).next("ul.menu-left ul").slideDown("slow", function () {
				$(this).parent().addClass("menu-open");
				$(this).prev("a").attr("title", "Masquer le sous-menu");
			});
			//$(".menu-open a").attr("title", "Afficher le sous-menu");
		}
		return false;
	});
	/***********************************************************************/
	$("div.list-axes ul li div.content-s-list:not('.menu-open-at-load')").hide();
	/*$("li.toggle-sub-menu span").each( function () {
		var TexteSpan = $(this).text();
		$(this).replaceWith('<a href="" title="Afficher le sous-menu" class="link-menu-contact">' + TexteSpan + '</a>') ;
	} ) ;*/
	$('.menu-open-at-load').prev("div.header-axes").children("a").attr("title", "Masquer le sous-menu");
	$("li.toggle-sub-menu > div.header-axes > a").click( function () {
		if ($(this).parent('div.header-axes').next("div.list-axes ul div.content-s-list:visible").length != 0) {
			$(this).parent('div.header-axes').next("div.list-axes ul div.content-s-list").slideUp("fast", function() {
				$(this).parent().removeClass("menu-open");
				//$(this).prev("a").attr("title", "Afficher le sous-menu");
			});
			$(".menu-open a").attr("title", "Masquer le sous-menu");
		}
		else {
			$("div.list-axes ul div.content-s-list").slideUp("fast", function () { 
			$(this).parent().removeClass("menu-open") } );
			$(this).parent('div.header-axes').next("div.list-axes ul div.content-s-list").slideDown("fast", function () {
				$(this).parent().addClass("menu-open");
				$(this).prev("div.header-axes").children("a").attr("title", "Masquer le sous-menu");
			});
			//$(".menu-open a").attr("title", "Afficher le sous-menu");
		}
		return false;
	});
});



