// List Ticker by Alex Fish www.alexefish.com
(function($){
  $.fn.list_ticker = function(options){
    var defaults = {
      speed:4000,
	  effect:'slide'
    };
    var options = $.extend(defaults, options);
    return this.each(function(){
      var obj = $(this);
      var list = obj.children();
	  if ( list.length < 2 ) {
	  	return this;
	  }
      list.not(':first').hide();
      setInterval(function(){
        list = obj.children();
        list.not(':first').hide();
        var first_li = list.eq(0)
        var second_li = list.eq(1)
		if(options.effect == 'slide'){
			first_li.slideUp();
			second_li.slideDown(function(){
				first_li.remove().appendTo(obj);
			});
		} else if(options.effect == 'fade'){
			first_li.fadeOut(function(){
				second_li.fadeIn();
				first_li.remove().appendTo(obj);
			});
		}
      }, options.speed)
    });
  };
})(jQuery);
$(document).ready(function(){
	$(".content div.toggle_titre").click(function(){
		var $bloc = $(this).next('div.toggle_bloc');
		if ( $bloc.length )
		{
			if ( $bloc.is(':visible') )
			{
				$bloc.hide();
				$(this).removeClass('current');
			}
			else
			{
				$bloc.show();
				$(this).addClass('current');
			}
		}
	});
	$(".block-menu-menu-header .expanded").mouseover(function(){
		$(this).addClass('current').children("ul").show();
	}).mouseout(function(){
		$(this).removeClass('current').children("ul").hide();
	});
	$(".view-liste-membres.view-display-id-block_1 .view-content").list_ticker();
	$(".view-liste-membres.view-display-id-block_2 .view-content").list_ticker();
	// ouverture des blocks passés en ancre
	location.hash  && $('a[name="'+location.hash.replace(/^#/, '')+'"]').parent('div').trigger('click');	
	// WIDGETS
	// print
	$('#icon_print').click(function(){
		print();
	});
	// addThis
	$('#icon_addthis').click(function(){
		return addthis_sendto();
	}).mouseover(function(){
		return addthis_open(this, '', '[URL]', '[TITLE]');
	}).mouseout(function(){
		addthis_close();
	});
});
