$(document).ready(function(){
	var slideOff = false;
	var curSlide = 1;
	var interval = setInterval( nextSlide, 8000);
	function nextSlide() {
		if(slideOff==false) {
			curSlide++;
			if(curSlide==1) {
				$('#topimg2').hide();
				$('#topimg3').hide();
				$('#topimg1').show();
			}
			if(curSlide==2) {
				$('#topimg1').hide();
				$('#topimg3').hide();
				$('#topimg2').show();
			}
			if(curSlide==3) {
				$('#topimg1').hide();
				$('#topimg2').hide();
				$('#topimg3').show();
				curSlide = 0;
			}
		}
	}
    $('#bckgrnd1').click(function(event) {
		event.preventDefault();
		$('#topimg2').hide();
		$('#topimg3').hide();
		$('#topimg1').show();
		slideOff = true;
		return false;
    });
    $('#bckgrnd2').click(function(event) {
		event.preventDefault();
		$('#topimg1').hide();
		$('#topimg3').hide();
		$('#topimg2').show();
		slideOff = true;
		return false;
    });
    $('#bckgrnd3').click(function(event) {
		event.preventDefault();
		$('#topimg1').hide();
		$('#topimg2').hide();
		$('#topimg3').show();
		slideOff = true;
		return false;
    });
});
