$(document).ready(function(){
	$('body').addClass('hasJS');
	
	$(function(){
	$('#left_tab').click(
		function(){
			if ($('#left_panel').css('left')=='150px'){
				$('#left_panel').animate({'left':'23px'}, 500);
				$(this).toggleClass('out');
				$('#empty').load('spip.php?page=session&panel=left&status=out');
			} else if ($('#left_panel').css('left')=='23px'){
				$('#left_panel').animate({'left':'150px'}, 500);
				$(this).toggleClass('out');
				$('#empty').load('spip.php?page=session&panel=left');
			}
		})
	});
	
	$(function(){
	$('#right_tab').click(
		function(){
			if ($('#right_panel').css('right')=='150px'){
				$('#right_panel').animate({'right':'23px'}, 500);
				$(this).toggleClass('out');
				$('#empty').load('spip.php?page=session&panel=right&status=out');
			} else if ($('#right_panel').css('right')=='23px'){
				$('#right_panel').animate({'right':'150px'}, 500);
				$(this).toggleClass('out');
				$('#empty').load('spip.php?page=session&panel=right');
			}
		})
	});
	
	
	$('.outer_links .year').each(function(){
		var $this = $(this);
		var $hd = $('.header', $this);
		var $bd = $('.links', $this);
		
		$hd.click(function(){
			if ($this.hasClass('opener')) {
				$bd.slideUp({ 
					duration: 1000,
					easing: 'easeOutExpo'});
			} else {
				$('#cat_links .year .links').slideUp();
				$('#cat_links .year').removeClass('opener');
				$bd.slideDown({ 
					duration: 1500,
					easing: 'easeOutBounce'});
			}
			$this.toggleClass('opener');
		});
		$bd.hide();
	});
	
	$('.outer_content').each(function(){
		var $this = $(this);
		var $hd = $('.outer_header', $this);
		var $bd = $('.outer_links', $this);
		
		$hd.click(function(){
			if ($this.hasClass('opener')) {
				$bd.slideUp({ 
					duration: 1000,
					easing: 'easeOutExpo'});
			} else {
				/*if(jQuery.browser.msie && (parseInt(jQuery.browser.version) < 7) && ($this.parent('div').attr("id")=='right_panel_inner')){
					$('#right_panel_inner .opener .outer_links').slideUp({ 
					duration: 1000,
					easing: 'easeOutExpo'});
				}*/
				$bd.slideDown({ 
					duration: 1500,
					easing: 'easeOutBounce'});
			}
			$this.toggleClass('opener');
		});
		$bd.hide();
	});
	
	//if (jQuery.browser.msie && (parseInt(jQuery.browser.version) < 7)){
	//} else {
	
		$('#latest_links').show();
		$('#latest_header').addClass('opener');
		
		$('#popular_links').show();
		$('#popular_header').addClass('opener');
	//}
				   
});