$(document).ready(function() {
  var countThumbs = $('.thumbs-1 > *').length;
  var thumbWidth = 0;
  var maxThumbTop = 0;
  var thumbPos;
  var count=1;
  var imageWidth;
  var imageHeight;
  var topPosition =0;
  var imagePosition = 0;
  var thumbArray = new Array(countThumbs);
  var prevlargeName = 'Large-1';
  var prevY;
  var topPos;
  var y;
  var distance;
  var yExp;
  var blobPos;
  var divHeight = -$('#scroller-images').height() + 600;
  
	$("#scroller").mousemove(function(e){
		y = e.pageY - this.offsetTop;
		if(y > 400) {
			yExp = (y-400) / 80;
			distance = Math.exp(yExp);
			distance = Math.round(distance);
			distance = distance /2;
		} else if(y <200) {
			yExp = (0-y) / 150;
			yExp = yExp + 2.5;
			distance = Math.exp(yExp);
			distance = Math.round(distance);
			distance = distance /2;
		}
   });
	
	setInterval(movePosition,40);

	function movePosition() {
		topPos = $('#scroller-images').css('top').replace('px','');
		if (y < 200 || y > 400) {
			if (y <200 && topPos <0) {
					$('#scroller-images').css({
								  top: (topPos - -distance) + 'px'
								  });
			}
			if (y >400 && topPos > divHeight) {
					$('#scroller-images').css({
										  top: (topPos - distance) + 'px'
										  });
			}
		}
		prevY = y;
	}


//Hide (Collapse) the toggle containers on load
	$(".toggle").hide();
	
	$(".trigger:first").addClass('active-trigger');

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$(".trigger").click(function(e){
		e.preventDefault();
		$(this).toggleClass("active-trigger").next().slideToggle("300")
		.siblings(".toggle:visible").slideUp("300");
		$(this).siblings(".trigger").removeClass("active-trigger");

	});
	
	$(".toggle-xmas").hide();
	
	$(".trigger-Xmas:first").addClass('active-trigger');
	
	$(".trigger-xmas").click(function(e){
		e.preventDefault();
		$(this).addClass("active-trigger")
		if ($(this).hasClass("active-trigger")) {
			$(".toggle-xmas").slideDown("300");
			$(".trigger-xmas").removeClass("active-trigger");
		} else {
			$(".toggle-xmas").slideUp("300");
		}
	});


});


