$(document).ready(function() {

    var scrollRevealEnabled = true;
    
       //SCROLL REVEAL
    if (scrollRevealEnabled) {
       window.sr = ScrollReveal();
       sr.reveal(".sr-panel, .text-page-panel", { duration: 1200, distance: '60px', opacity: 0, scale: 0.9, reset: true });
    }
    
    
	// Image Lightbox
	//
	
	$("#lbClose").click(function() {
		$(".lightbox").css("display", "none");
	});

	$(".lightbox").click(function() {
		$(".lightbox").css("display", "none");
	});

	$(".imgContainer img").click(function (e) {
		e.preventDefault();
		e.stopPropagation();
	});


	

	
	
	$(".text-page-panel img").click(function () {

		var thisImage = $(this);
		var imageSrc = thisImage.attr('src');
		var cls = thisImage.attr("class");

		if (cls != "no-lightbox")
		{
			$(".lightbox img").attr("src", imageSrc);
			$(".lightbox").css("display", "table");
        }

		//console.log ("imageSrc " + imageSrc);
		//console.log("cls " + cls);
	
	});


	// keep right col in place
	//
	
	/* Disabled
	$(window).scroll(function(){

		var header 	= $(".content-header").height();
		var win 	= $(window).scrollTop()
		var offset 	= win - header;

		if (offset>0) {
			$(".right-col").css("top", offset + "px")
		} else {
			$(".right-col").css("top", "0px")
		}

	});
	*/



    $(".aSub-item").click(function () {
        $('html, body').animate({
			scrollTop: $($(this).attr("href")).offset().top - 120
        }, 500);
    });

	$(".toggle-nav").click(function(){
		
		$("nav").toggleClass("open");
		
	});
	
	$('.match-row').matchHeight({
		byRow: true
	});
	
$('.donut-carousel').slick({
  dots: false,
  arrows: true,
  infinite: true,
  speed: 300,
  slidesToShow: 1,
  slidesToScroll: 1,
  responsive: [
    {
      breakpoint: 960,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    },
    {
      breakpoint: 768,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    // You can unslick at a given breakpoint now by adding:
    // settings: "unslick"
    // instead of a settings object
  ]
});	
	

	$(".expander-btn").click(function(){

			if ($(this).hasClass("active")){

				$(this).text("Read More").removeClass("active");
				$(this).parent().removeClass("open");

			} else {

				$(this).text("Read Less").addClass("active");
				$(this).parent().addClass("open");
			}

			return false
		});
	
	
});

