$(function() {

// Caroussel
	var myUNcarousel = $('#myUNcarousel li').size();
	$('#myUNcarousel').jcarousel({
		size: myUNcarousel,
		scroll: 1
	});
	var myUNcarousel2 = $('#myUNcarousel2 li').size();
	$('#myUNcarousel2').jcarousel({
		scroll: 1
	});
	var myUNcarousel3 = $('#myUNcarousel3 li').size();
	$('#myUNcarousel3').jcarousel({
		scroll: 1
	});

// Switch
	
  $(".ae_switch_container .ae_switch_content").hide();
  $(".ae_switch_container").each(function() {
		$(this).find('.ae_switch_content:eq(0)').show();		 
	});
   
   $(".ae_switch_container .ae_switch_tabs a").click(function(){ 
		$(this).parent().siblings().removeClass('active');		
		$(this).parent().addClass('active');		
        $(this).parents('.ae_switch_tabs').siblings('.ae_switch_content').hide();
        $(this.hash).show();        
        this.blur();        
        return false;
        
	});
	
	
	$(".ae_switch_container2 .ae_switch_content2").hide();
  $(".ae_switch_container2").each(function() {
		$(this).find('.ae_switch_content2:eq(0)').show();		
	});
	  $(".ae_switch_container2 .ae_switch_tabs a").click(function(){ 
		$(this).parent().siblings().removeClass('active');
		$(this).parent().addClass('active');
        $(this).parents('.ae_switch_container2').find('.ae_switch_content2').hide();
        $(this.hash).show();
        if($(this).attr('title')=='Implantations')
		{
			initialize_Gmap();
		}
        this.blur();
        return false;
	});
	  
	  
	$(".ae_switch_container3 .ae_switch_content3").hide();
  $(".ae_switch_container3").each(function() {
		$(this).find('.ae_switch_content3:eq(0)').show();		
	});
	  $(".ae_switch_container3 .ae_switch_tabs a").click(function(){ 
		$(this).parent().siblings().removeClass('active');
		$(this).parent().addClass('active');
        $(this).parents('.ae_switch_container3').find('.ae_switch_content3').hide();
        $(this.hash).show();        
        this.blur();
        return false;
	});
	
// Popin
	if ($("a.ae_popin_inscription").is("a")) {
		$("a.ae_popin_inscription").popin({
			width:470,
			height:600,
			className: "ae_pagePopin"
		});
	}

	if ($("a.ae_popin_doc").is("a")) {
		$("a.ae_popin_doc").popin({
			width:470,
			height:180,
			className: "ae_pagePopin"
		});
	}

	
	if ($("a.ae_popin_recrut").is("a")) {
		$("a.ae_popin_recrut").popin({
			width:470,
			height:540,
			className: "ae_pagePopin"
		});
	}
	
	if ($("a.ae_popin_etre-rappele").is("a")) {
		$("a.ae_popin_etre-rappele").popin({
			width:470,
			height:500,
			className: "ae_pagePopin"
		});
	}

})

/*************Onglets id�o fiche*************************/
$(function() {
    /*$(".onglet").hide();
    $(".onglet:eq(0)").show();*/
    $(".fleche").hide();   
    $(".onglet_on").siblings(".fleche").show();
});

$(function() {
    $(".onglet_bloc .click-script a").click(function(){ 
    		
	  $('.onglet_bloc .click-script a').removeClass('onglet_on');
	  $(this).addClass('onglet_on');	 
      $(".content_bloc .onglet").hide();
      $(".fleche").hide();
      
      // Recup des coordonnees      
      var str= this.name;
      var elem = str.split(',');
      
      // MAJ Carte google
      map.setCenter(new GLatLng(elem[0],elem[1]), 15);      
     
      $(this.hash).show();      
      this.blur();      
      return false;
    });
});
