document.addEventListener("DOMContentLoaded", function(event) {
    var classname = document.getElementsByClassName("rp");
    for (var i = 0; i < classname.length; i++) {
        classname[i].addEventListener('click', myFunction, false);
        classname[i].addEventListener('contextmenu', myRightFunction, false);
    }
});
var myFunction = function(event) {
    var attribute = this.getAttribute("data-rp");               
            if(event.ctrlKey) {                   
             var newWindow = window.open(decodeURIComponent(window.atob(attribute)),'_blank');                    
             newWindow.focus();               
        } else {      
             window.open(decodeURIComponent(window.atob(attribute)),'_blank');  
        }
    };
var myRightFunction = function(event) {
    var attribute = this.getAttribute("data-rp");               
        if(event.ctrlKey) {                   
             var newWindow = window.open(decodeURIComponent(window.atob(attribute)),'_blank');                    
             newWindow.focus();               
        } else {      
             window.open(decodeURIComponent(window.atob(attribute)),'_blank');  
        }
}

$(document).ready(function(){
	$('.slide-logo').slick({
		lazyLoad: 'ondemand',
		slidesToShow: 4,
		slidesToScroll: 1,
		autoplay: true,
		autoplaySpeed: 3000,
		responsive: [
		{
			breakpoint: 991,
			settings: {
				slidesToShow: 3,
				arrows: false,
			}
		},
		{
			breakpoint: 768,
			settings: {
				slidesToShow: 2,
				slidesToScroll: 1,
				arrows: false,
			}
		}
		]
	});

	$('.edito .liste-repose-pied').slick({
		lazyLoad: 'ondemand',
		slidesToShow: 3,
		slidesToScroll: 1,
		autoplay: true,
		autoplaySpeed: 3000,
		arrows: false,
		dots: true,
		responsive: [
		{
			breakpoint: 991,
			settings: {
				slidesToShow: 2,
				arrows: false,
			}
		},
		{
			breakpoint: 768,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1,
				arrows: false,
			}
		}
		]
	});
$('.commentaire-internaute .rp').each(function() {
	console.log( $(this).attr('data-rp') );
	$(this).attr('data-rp',$(this).attr('data-rp').replace('http://',''));
});

	$('.question').on('click', function(){

		if ( $(this).hasClass('slide')){
			$(this).parents('li').find('.reponse').slideUp();
			$(this).removeClass('deplier');
		}

		else{
			$('.faq .reponse').slideUp();
			$('.question').removeClass('slide');
			$(this).parents('li').find('.reponse').slideToggle();
			$(this).toggleClass('slide');
		}
	});
});