function showList(label){
	
	
	if(label.hasClass('active'))
	{
		label.parent('.views-exposed-widget').find('.form-checkboxes').slideUp(300,function(){
			label.removeClass('active');
		}).removeClass('active');
		
	}
	else{		
		$('.form-checkboxes').slideUp(300,function(){
			$('.views-exposed-widget label').removeClass('active');
			label.addClass('active');
		}).removeClass('active');
		label.parent('.views-exposed-widget').find('.form-checkboxes').slideDown(300).addClass('active');
		
	}
}
function initProjet(){
	if($("form",'.section-realisations').length > 0)
	{
		$("form",'.section-realisations').jqTransform(); 
		$('body').addClass('hasJqTransform');
	}
	if($('.bef-checkboxes').length > 1){
		$('.bef-checkboxes .form-item').hover(
			function(){
				$(this).addClass('form-item-checkboxes-hover');
			},
			function(){
				$(this).removeClass('form-item-checkboxes-hover');
			}
		)
		//on masque la liste
		$(".leftLabel").parents('.views-exposed-widget').find('.form-checkboxes').hide();
		
		// au click, on affiche la liste
		$(".leftLabel").click(
			function(){
				showList($(this).parent('label'));
			}
		)
		//console.log($(".leftLabel").parents('.views-exposed-widget'));
		
		$('#reset-views').click(function(){
			var leForm = $(this).parents('form'); 
			leForm.find('input[type=checkbox][checked]').removeAttr('checked');
			leForm.find('a.jqTransformCheckbox').removeClass('jqTransformChecked');
			leForm.submit();
		})
	}
	//slide bandeau noir projet	
	if($('.projet').length > 0)
	{
		$('.projet .sliding').hide();
		$('.projet').hover(function(){
				$(this).find('.sliding').slideDown(300);
			},
			function(){
				$(this).find('.sliding').slideUp(300);
			}
		)
		Cufon.replace('.client');
		Cufon.replace('#label-search');
		Cufon.replace('.pager li',{hover:true});
		Cufon.replace('.pager li a', {	hover: true});		
	}
	if($('.pager').length > 0)
	{	
		$('.pager li.pager-next,.pager li.pager-previous').hover(function(){
			$(this).attr('id','hover');
		},function(){
			$(this).attr('id','');
		});
	}
}
$(function(){
	$('body').addClass('hasJs');
	initProjet();
	
	if($('.chained').length > 0)
	{
		$('.chained').loopedSlider({
			addPagination: true, 
			slides: '.slides',
			container:'.container-slides'
		});
	}
	/* page projet */
	//find all form with class jqtransform and apply the plugin
	
   if($("form",'.section-contact').length > 0)
	{
		$("form",'.section-contact').jqTransform(); 
		$('body').addClass('hasJqTransform');
	}
	//page projet
	if($('.meta').length > 0)
	{
		//$('.meta').
	}
	//$('span.jquery-checkbox').unbind();
})
$(window).load(function(){
})
