
// A $( document ).ready() block.
$( document ).ready(function() {
	
	//SLIDER
	autoSlider(1);

	$("#slide1").click(function() {
		changeSlide(1);
	});

	$("#slide2").click(function() {
		changeSlide(2);
	});

	$("#slide3").click(function() {
		changeSlide(3);
	});

	$("#slide4").click(function() {
		changeSlide(4);
	});

	function autoSlider(slideNum){
		if(slideNum == 5) slideNum = 1;
		changeSlide(slideNum);
		
		setTimeout(autoSlider, 5000, slideNum+1);
	}

	function changeSlide(slideNum){
		$(".slide-button").attr("src","style/imgs/slide-off.png");
		$("#slide"+slideNum).attr("src","style/imgs/slide-on.png");
		$("#slide-image").attr("src","style/imgs/slide"+slideNum+".png");
	}
	//END SLIDER
	
	// MODAL LOGIN
	
	var modal = document.getElementById('loginModal');
	var btn = document.getElementById("loginButton");

	btn.onclick = function() {
		modal.style.display = "block";
	}

	window.onclick = function(event) {
		if (event.target == modal) {
			modal.style.display = "none";
		}
	}

	//END MODAL LOGIN
	


});

