$(document).ready(function() { 
	//biggerlink
	$('.loi #main div.boxle').biggerlink();
	$('.membres #main ul#members>li>ul>li').biggerlink({clickableclass:'members_click',hoverclass:'members_hover'});
	
	//fancy box
	/*
	$('#right ul.fancy li a').fancybox({ 'overlayShow': true }); 
	$('#left a.fancy').fancybox({ 'overlayShow': true }); 
	$('#contact_map a').fancybox({ 'overlayShow': true, 'frameWidth': 640, 'frameHeight':  480}); 
	*/
	
	//newsticker
	$('#header_breves').newsTicker();
	
	//calendar
	/*
	$('a.calendar_day_clickable').qtip({
	   content: '<strong>Event title</strong>: This is an event from Agenda',
	   show: { when: { event: 'mouseover' },effect: { type: 'fade',length: 400 } },
	   hide: { when: { event: 'mouseout' },effect: { type: 'fade',length: 400 } },
	   position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } },
	   style: { 
	      width: 200,
	      padding: 7,
	      background: '#147fe7',
	      color: '#fff',
	      textAlign: 'left',
	      border: {
	         width: 1,
	         radius: 1,
	         color: '#147fe7'
	      },
	      tip: { corner: 'leftMiddle', size: { x: 8, y: 12 } },
		  title: { 'background-image': 'url(../images/layout/bg_calendar_today.png)','background-repeat': 'repeat-x'}
	   }
    })
	*/
	
	// sls shadow
	var cssObj = { 'box-shadow' : '#333 0 4px 8px', // Added when CSS3 is standard
		'-webkit-box-shadow' : '#333 0 4px 8px', // Safari
		'-moz-box-shadow' : '#333 0 4px 8px'}; // Firefox 3.5+
	$("#suggestions").css(cssObj);
	
	// sls fadeout
	 $("input").blur(function(){
	 	$('#suggestions').fadeOut();
	});
	
	// fix for target=”_blank”
	$("a[rel$='external']").click(function(){
		this.target = "_blank";
	});
	
	// animate navsec right 
	$('#right #navsec li a').hover(function() { //mouse in
		$(this)
		.animate({ backgroundPosition: '20px center',paddingLeft: '35px' }, 400);
	}, function() { //mouse out
		$(this)
		.animate({ backgroundPosition: '10px center', paddingLeft: '25px' }, 400);
	});
	
	// animate row publication 
	$('table tbody tr')
	.hover(function() { //mouse in
		$(this).animate({ backgroundColor: "#eeeeee" }, 400);
	}, function() { //mouse out
		$(this).animate({ backgroundColor: "#ffffff" }, 400);
	});

	// animate ul li ul li membres 
	$('ul#members li ul li')
	.hover(function() { //mouse in
		$(this).animate({ backgroundColor: "#eeeeee" }, 400);
	}, function() { //mouse out
		$(this).animate({ backgroundColor: "#ffffff" }, 400);
	});

	
	// list filter news
	$('ul#filter a').click(function() {
		$(this).css('outline','none');
		$('ul#filter .current').removeClass('current');
		$(this).parent().addClass('current');
		var filterVal = $(this).attr("id");	
		if(filterVal == 'all') {
			$('.news div.accordeon>div.list .hidden').fadeIn('slow').removeClass('hidden');
		} else {
			$('.news div.accordeon>div.list').each(function() {
				if(!$(this).hasClass(filterVal)) {
					$(this).fadeOut('normal').addClass('hidden');
				} else {
					$(this).fadeIn('slow').removeClass('hidden');
				}
			});
		}
		return false;
	});

	//biggerlink
	$('.activites_loi #main div.boxle').biggerlink();
	$('.membres #main ul#members>li>ul>li').biggerlink({clickableclass:'members_click',hoverclass:'members_hover'});
	
	//tablesorter
	$(".sorter").tablesorter();
	
	//Fancybox
	
	
	//FlickrFeed
	$('#cbox').jflickrfeed({
		limit: 28,
		qstrings: {
			id: '58684663@N02'
		},
		itemTemplate: '<li>'+
						'<a rel="gallery_flickr" href="{{image}}" title="{{title}}">' +
							'<img src="{{image_s}}" alt="{{title}}" />' +
						'</a>' +
					  '</li>'
	}, function(data) {
		$("a[rel=gallery_flickr]").fancybox();
	});
	
	$("a.lightbox").fancybox();

});
/*
function lookup(inputString) {
	if(inputString.length == 0) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		$.post("process/ajax/sls.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
			$('#suggestions').fadeIn(); // Show the suggestions box
			$('#suggestions').html(data); // Fill the suggestions box
		});
	}
}*/

/* accordeon
************/

$(document).ready(function(){
  
  $('div.accordeon div.content').hide();
  //$('.accordeon a').bind('click',openClose);
  $('div.accordeon h3').bind('click',openClose);
  
});

function openClose(){
  var cur_li=$(this).parent('div.list');
  if(!cur_li.hasClass('open')){
    $('div.accordeon .open').removeClass('open').children('div.content').slideUp('fast');
    cur_li.addClass('open').children('div.content').slideDown('fast');
  }else{
    cur_li.removeClass('open').children('div.content').slideUp('fast');
  }
  return false;
}
