$(document).ready(function(){ 
	
	//elever l'icon PDF quand il y a une image dans le lien
	$("a[href$='.pdf'] img").parents("a").css({background:"none",padding:"0px"})
	
	//anime logo						
	$("#logo > img")
		.css({top:"-100px"})
		.animate({top:"-5px"}, 800).animate({top:"-9px"}, 100);
	
	//hover logo
		$("#logo a img").hover(
		function(){
			$(this).stop(true,true).animate({top:"-7px"}, 100);
		}, function(){
            $(this).animate({top:"-9px"}, 100);
        });

	

	//ANIMATION FLECHE
	$(".flecheDroite")
	.css({backgroundPosition: "0px 3px"})
	.hover(function(){
		$(this).stop().animate({backgroundPosition: "3px 3px"}, 200);
	}, function() {
		$(this).stop().animate({backgroundPosition: "0px 3px"}, 200);
	});
	
	$("#inscription .flecheDroite")
	.css({backgroundPosition: "15px 3px"})
	.hover(function(){
		$(this).stop().animate({backgroundPosition: "18px 3px"}, 200);
	}, function() {
		$(this).stop().animate({backgroundPosition: "15px 3px"}, 200);
	});
	
	$("#menuNational .flecheDroite")
	.css({backgroundPosition: "10px 11px"})
	.hover(function(){
		$(this).stop().animate({backgroundPosition: "13px 11px"}, 200);
	}, function() {
		$(this).stop().animate({backgroundPosition: "10px 11px"}, 200);
	});
	
	//ANIMATION MENU
	$("#menu a").not(".current").css({backgroundPosition: "0px 0px"});
	$("#menu a").not(".current").hover(function(){
		$(this).animate({backgroundPosition: "0px 8px"}, 200);
	}, function() {
		$(this).stop(true,true).animate({backgroundPosition: "0px 0px"}, 200);
	});


	//ANIMATION MENU SEC
	$("#menuSec a").not("#menuSec li.current a")
	.hover(
        function(){
            $(this).stop(true,true).animate({marginTop:"0px"}, 200);
        }, function(){
            $(this).animate({marginTop:"3px"}, 200);
        }
    );
	
	
	//ANIMATION BOITEBLEU et BOUTONSBLEU 
	//pour ie6
	$("#boiteBleu a img + img, #boutonsBleu a img + img, #servicesCont a img + img, #menuNational a > img + img, .overFade img + img").css({
	position:"absolute",
	top:"0px",
	left:"0px"
	})
	
    $("#boiteBleu a, #boutonsBleu a, #servicesCont a, #menuNational a, .overFade")
	.css({position:"relative"})
	.hover(
        function(){
            $(this).find("img").next("img")
			.fadeIn(200);
			
        }, function(){
            $(this).find("img").next("img").css({display:"none"});
        }
    );
	
	
	//ANIMATION boiteDyn
	$("#actualites h3 > span, #emplois h3 > span, #evenements h3 > span")
	.hover(
        function(){
            $(this).stop(true,true).animate({marginTop:"-3px"}, 200);
        }, function(){
            $(this).animate({marginTop:"0px", marginTop:"0px"}, 200);
        }
    );
	
	
	//ANIMATION Partager
	$("#partager a")
	.hover(
        function(){
            $(this).stop(true,true).animate({marginTop:"0px"}, 200);
        }, function(){
            $(this).animate({marginTop:"2px"}, 200);
        }
    );
	

	//CARTE DE NAVIGATION  
	
	//Générer la liste d'ID
	$("#carte area, #overMap img, #carteBottom li a").attr("id", function (arr) {
		return arr;
    })

	
	//Actions sur la carte
	$("#carte area")
	.hover(function(){
		var areaName = $(this).attr("id");
		var overId = $("#carte area").length + parseInt(areaName);

		$("#overMap img").not("#"+overId).css({display:"none"});
		$("#"+overId).css({display:"block"});

	}, function(){
		var areaName = $(this).attr("id");
		var overId = $("#carte area").length + parseInt(areaName);
		
		$("#overMap img").css({display:"none"});

	});

	//Action sur la liste
	$("#carteBottom li a").hover(function(){
		var linkId = $(this).attr("id");
		var overId = parseInt(linkId) - $("#carte area").length;

		$("#overMap img").not("#"+overId).css({display:"none"});
		$("#"+overId).css({display:"block"});
		/*$(this).css({
			textDecoration:"underline",
			color:"#005596"
		});*/
		
	}, function(){
		var linkId = $(this).attr("id");
		var overId = parseInt(linkId) - $("#carte area").length;
		
		$("#overMap img").css({display:"none"});
		/*$(this).css({
			textDecoration:"none",
			color:"#333"
		});*/
	});
	
		//Tips
	$("#carteNav area").not("#national #carteNav area, #special #carteNav area, #carteNav area.noTip").each(function(){
      $(this).qtip({
         content: {
			title: $(this).attr("mrc"),
			text: "> " + $(this).attr("ville")
			},
         style:{
         	name: 'light',
			tip: 'topLeft'
         },
		 position: {
			target: 'mouse',
   			adjust: {  x:3, y:5, screen: true }
		 },
		 show:{effect:{type:'grow'}}
      });
   });
	
	$("#carteQuebecNav area, #national #carteNav area, #special #carteNav area").each(function(){
      $(this).qtip({
         content: $(this).attr("region"),
         style:{
         	name: 'light',
			tip: 'topLeft',
			fontWeight: 'bold'
         },
		 position: {
			target: 'mouse',
   			adjust: {  x:3, y:5, screen: true }
		 },
		 show:{effect:{type:'grow'}}
      });
   });
   	
	
		
	$(".tip").qtip({
         style:{
         	name: 'light',
			tip: 'topLeft',
			fontWeight:'bold'
			
         },
		 position: {
			target: 'mouse',
   			adjust: {  x:3, y:5, screen: true }
		 },
		 show:{effect:{type:'grow'}}
      });
	
	
	//guestbook

    $("#laisserTem").hide()                           
    $("#Form_commentaire h3").toggle(function(){
        $("#laisserTem").slideDown(200);
        $(this).find(".moinsPlus").addClass("moins");
    }, function(){
        $("#laisserTem").slideUp(200);
        $(this).find(".moinsPlus").removeClass("moins");
    });

	
	//sejour sexploratoires
	//selectBox 
	$("#datesLieux > div").not(".editBox #datesLieux > div").hide();
	
	$(".editBox").prev('#choixRegion').css({visibility:"hidden"});
	
	$("#choixRegion").change(function(){
		var idRegionVar = "#" + this.value;
		
		$("#datesLieux > div").not(idRegionVar).hide();
		$(idRegionVar).fadeIn(400);
	});

	
	//slideShow
	$('#slideShow').cycle({ 
		fx:     'fade', 
		speed:  800, 
		timeout: 5000,
		delay: 1000,
		random: 1,
		next:   '#photoNavRight', 
		prev:   '#photoNavLeft' 
	});
	
	
	//Pub partenaires roulante
            $('#pubSwap').cycle({ 
		fx:     'fade', 
		speed:  800, 
		timeout: 5000,
		delay: 1000,
		random: 1,
                
                pager: '#pubSwapNav',
	
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<a href="#"></a>'
		}

                
            });
	
	//SMOOTHANCHOR
	//$.smoothAnchors(700, "swing", false);
	
	//shadowbox
	//Shadowbox.init();

	
});


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-13246115-19']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


