
	$(function(){

			$(".nextButton").click(function () {
      			 clearTimeout(timeOut);
				  nextFader();
    		});
			$(".prevButton").click(function () {
      			 current=current-2;
      			 if (current==-2) {
      			 	current=numItems-2;
      			 }
      			 if (current==-1) {
      			 	current=numItems-1;
      			 }
      			// alert(current);
				   clearTimeout(timeOut);
				  nextFader();
    		});



			//$("#ssPic").html($("#sspic0").html());
			var timeOut;
			var current=1;
			function nextFader() {

			    $("#ssPic").fadeOut(500, function () {

			        if(current == numItems) {
						current = 0;
			        }
				//	alert(current);
					thecontent=$("#ssPic"+current).html();
					//alert("#layer".current);

					$("#ssPic").html(thecontent);
			        $("#ssPic").fadeIn(1000);//ms
			        $("#ssCap").html($("#ssCap"+current).html());
					$("#ssHead").html($("#ssHead"+current).html());
			        timeOut=setTimeout(nextFader,8000);

			        current++;
			    });

			}

			setTimeout(nextFader,6000);


		});