
// =============================================================================
function checkIfButtonsShouldShow(slidesPer){
	
	var divNum = parseInt(document.getElementById('eventStartPoint').value);
	var lastSlide =  parseInt(document.getElementById('eventsCount').value);
	
	// go back button
	if (divNum == 1){
		document.getElementById('goBackButton').style.display = 'none';
	}else{
		document.getElementById('goBackButton').style.display = '';
	}
	
	// go forward button
	if (divNum == (lastSlide - (slidesPer - 1))){
		document.getElementById('goForwardButton').style.display = 'none';
	}else{
		document.getElementById('goForwardButton').style.display = '';
	}
}


// =============================================================================
function animateContentJP(direction, slidesPer){
	
	var animationSpeed = 1000;	
	var divNum = parseInt(document.getElementById('eventStartPoint').value);
	
	
	var divWidth = 250;
	var pixWidthForward = (divWidth * divNum);
	var pixWidthBack = (divWidth * (divNum-1)) - divWidth;
	
	if (direction == 'goForward'){
		$("#animateDiv").animate({
			//width: "0px",
			//opacity: 0,
			left: "-"+ pixWidthForward +"px"
		}, animationSpeed);
		
		document.getElementById('eventStartPoint').value = (divNum + 1);
		
	}else if (direction == 'goBack'){
		$("#animateDiv").animate({
			//width: "0px",
			//opacity: 0,
			left: "-"+pixWidthBack+"px"
		}, animationSpeed);
		
		document.getElementById('eventStartPoint').value = (divNum - 1);
	}

	checkIfButtonsShouldShow(slidesPer);
}


// =============================================================================
function setLeftPositioning(){
	var divWidth = 250;
	
	var lastSlide =  parseInt(document.getElementById('eventsCount').value);
	var i = 1;	
	
	while (i <= lastSlide){		
		var leftPix = (divWidth * (i-1));
		$("#list-item-"+i).css('left', leftPix+'px');
		i++;
	}
}













