$(document).ready(function(){
	
// FUNCTION 1  --------  Animates the topnav LI arrows
	$(".topNav li a").closest('li').not(".current_page_parent, .current_page_item").hover(function(){	
		var containerLI = $(this).closest('li');
		containerLI.stop().animate({'backgroundPosition':'(50% 35px)'}, {duration:200});	
		}, function(){
		var containerLI = $(this).closest('li');	
		containerLI.stop().animate({'backgroundPosition':'(50% 20px)'}, {duration:200});
			
	});

	
// FUNCTION 2  --------  Used for animating side nave arrow
	$("#sideNav li").mouseenter(function(){
		if ( $(this).hasClass("current-cat") ) {
			return;
		} else {
			var anchorLink = $(this).children();
			anchorLink.stop(true,false).animate({ 'backgroundPosition' : '-2px 9px','paddingLeft' : '35px' }, 300);
		}
		}).mouseleave(function(){	
		if ( $(this).hasClass("current-cat") ) {
			return;
		} else {
			var anchorLink = $(this).children();
			anchorLink.stop(true,false).animate({ 'backgroundPosition' : '-12px 9px','paddingLeft' : '25px' }, 300);
		}
	});	
	
	
// FUNCTION 3  --------  Used for animating expanding div
	$(".expDIV").click(function(){
		var expEle = $(this).attr("expTar");
		$("." + expEle).slideToggle("normal");
		if ( $(this).hasClass("ON") ) {
			$(this).removeClass("ON");
		} else {
			$(this).addClass("ON");
		}
	});
	
	

	
	
// FUNCTION 5  --------  scroll to top of page
	$(".jumpTop").click(function(){ 
		$('html, body').animate({scrollTop:0}, 500);
		return false;
	});
	
});

function setPostArrow() {	// Set starting position of background arrow for posts page
	$("#topNav .page-item-374").addClass("current_page_item");	// Set background of UL - "topNav" to the same position as LI with "current_page_item".  
};

// FUNCTION 4  --------  Used for slideshow	
	function testSlider() {
		var thumbCount = $("#slider li").length;
		var w = 500; // same width as li width declared in css for li
		var currentPos = 0;
		var slideW = (w*thumbCount);
		var maxslide = (-1*w*thumbCount) + w;
		var minslide = 0;
		$("#slider ul").css("width",slideW + "px");
		$("#sliderPrevBtn").addClass("OFF");
		
		$("#sliderNextBtn").click(function(){
			if (currentPos > maxslide) {
				var nextLI = (currentPos - 500);		
				$("#slider ul").animate({"left" : nextLI + "px"},600);
				currentPos = nextLI;
				$("#sliderPrevBtn").removeClass("OFF");
				if (currentPos <= maxslide) {
					$("#sliderNextBtn").addClass("OFF");
				} 
			} 
		});
		$("#sliderPrevBtn").click(function(){
			if (currentPos < minslide) {
				var prevLI = (currentPos + 500);		
				$("#slider ul").animate({"left" : prevLI + "px"},600);
				currentPos = prevLI;
				$("#sliderNextBtn").removeClass("OFF");
				if (currentPos > -w) {
					$("#sliderPrevBtn").addClass("OFF");
				} else {
					$("#sliderPrevBtn").removeClass("OFF");
				}
			} 
			
		});
		animate("prev");
	};










				


