
$(window).load(function(){//on attend que la page soit charg�e
    slider();
    menu();
	//INTRANET
	filter();
	
	
	
if($('.fancybox').length)$('.fancybox').fancybox({onComplete:function(){$("img").noContext();}});
});

function slider(){
	$('#slider').smoothSlide({
		time : 300
		,step:8
		,width:565
		,height:70
		,multipage:false
		,leftArrow:'<img src="'+domain+'/files/design/arrowLeft.png" alt="Gauche" />'
		,rightArrow:'<img src="'+domain+'/files/design/arrow_right.png" alt="Droite" />'
	});
    $('#slider').attr('rel','Right');
	var test = setInterval(slideGo,5000);
	$('#smoothSlideGotoRight, #smoothSlideGotoLeft').click(function(){
		clearInterval(test);
	})
}
function slideGo(){
	pos = $('#slider').css('left');
	$('#smoothSlideGoto'+$('#slider').attr('rel')).mousedown();
	//slider est au bout
		setTimeout(verifSlide,500,pos);
	
}
function verifSlide(pos){
	if(pos==$('#slider').css('left')){
		if($('#slider').attr('rel')=='Left')$('#slider').attr('rel','Right');
		else $('#slider').attr('rel','Left');
		slideGo();
	}
}
function menu(){
    $('.elmMenu').mouseenter(function(){
        if($(this).attr('id')!="selected" && $(this).attr('id')!="current"){
            $(this).find('.elmMenuLink').animate({paddingLeft:'9px'},300);
        }
    });
    $('.elmMenu').mouseleave(function(){
        if($(this).attr('id')!="selected" && $(this).attr('id')!="current"){
            $(this).find('.elmMenuLink').animate({paddingLeft:'0px'},300);
        }
    });
}


///////////////////////////////////////////////////////////////////
///////////////////////INTRANET////////////////////////////////////
///////////////////////////////////////////////////////////////////
function filter(){
	filterChange();
	$('.checkAll').click(function(){
		$(this).parents('.formFilter').find('input').attr('checked','checked');
		filterChange();
	})
	$('.uncheckAll').click(function(){
		$(this).parents('.formFilter').find('input').attr('checked','');
		filterChange();
	})
	$('#formFilterType input').click(function(){
		filterChange();
	});
	$('#formFilterDate input').click(function(){
		filterChange();
	});
}
function filterChange(){
	var typeSelect = getInputCheck($('#formFilterType'));
	var dateSelect = getInputCheck($('#formFilterDate'));

	$('.docToList').each(function(i,elm){
		pass=false;
		var docToListId = $(elm).attr('id').split('//');
		if($.inArray(docToListId[0],typeSelect)>=0)pass=true;
		
		if(pass){
			pass=false
			if($.inArray(docToListId[1],dateSelect)>=0)pass=true;
			log(docToListId[1]);
			log(dateSelect);
			log($.inArray(docToListId[1],dateSelect));
		}
		if(pass)$(elm).show();
		else $(elm).hide();
	});
}


function getInputCheck(form){
	var tmp = new Array();
	form.find('input:checked').each(function(){
		tmp.push($(this).attr('id'));
	});
	return tmp;
}

