	$(document).ready(function () {
			playSlide();

			$(".slide_control").bind("mouseover", function(){
				gotoSlide($(this).attr("index"));
				pauseSlide = true;
			});

			$(".slide_control").bind("mouseout", function(){
				pauseSlide = false;
			});

		});

		var slidePictures = new Array();
		var slideHTML = new Array();
		var slideLinks = new Array();

		var currentSlide = 0;
		var frameInterval = 5500;
		var pauseSlide = false;
	

		//create slide show
		slidePictures[0] = "images/home-hero-pesticideapplicators.jpg";
		slidePictures[1] = "images/home-hero-powertoolsafety.jpg";
		slidePictures[2] = "images/home-hero-managingsafety.jpg";
		slidePictures[3] = "images/home-hero-lostyouth.jpg";
		slidePictures[4] = "images/home-hero-controllingexposure.jpg";

		slideHTML[0] = "<h2>Standard Practices For Pesticide Applicators</h2>";
		slideHTML[0] += "<p>This manual deals with the health and safety of workers who work with or near pesticides.</p>";

		slideHTML[1] = "<h2>You're A Pro: Power Tool Safety</h2>";
		slideHTML[1] += "<p><i>You're a Pro: Power Tool Series</i> contains four, short videos that demonstrate the dangers and possible consequences of using power tools incorrectly. Each video identifies some of the hazards and provides tips on how to operate power tools safely.</p>";
		
		slideHTML[2] = "<h2>Managing Safety from a Supervisor's Perspective</h2>";
		slideHTML[2] += "<p>This infoflip is designed to help supervisors manage their responsibilities for the health and safety of their workers.</p>";
		
		slideHTML[3] = "<h2>Lost Youth</h2>";
		slideHTML[3] += "<p>Michael, Jennifer, John, and Nick all speak of losing their youth after suffering serious workplace accidents. Through dramatic recreations of these accidents and one-on-one discussions with the young people and their parents, Lost Youth tells four stories of lives forever altered.</p>";

		slideHTML[4] = "<h2>Controlling Exposure: Protecting Workers from Infectious Disease</h2>";
		slideHTML[4] += "<p>This book describes common infectious diseases and how they are spread, and explains how to protect workers from exposure to infectious diseases.</p>";
	
		slideLinks[0]= "practices-for-pesticide-applicators/product-BK35.html?nav=newreleases";
		slideLinks[1]= "Youre_A_Pro_Power_Tools/product-DVD154.html?nav=newreleases";
		slideLinks[2]= "managing-saftey-supervisor-perspective/product-BK119.html?nav=publications";
		slideLinks[3]= "lost-youth-unedited/product-DVD-40UE.html?nav=videos";
		slideLinks[4]= "Controlling%20_Exposure/product-BK129.html?nav=publications";


		function playSlide(){
			gotoSlide(currentSlide);
			intervalId = setInterval( 
				function(){
					if (!pauseSlide){	
						var index = 0;
						if (currentSlide < slidePictures.length - 1)
							index = parseInt(currentSlide) + 1;
						gotoSlide(index);
					}
				}
			, frameInterval );
		}

		function gotoSlide(index){
			//console.log(index);
			
			// swap image
			$("#slide_container_back")
				.html("<img src='"+slidePictures[index]+"' />");
			$("#slide_container_front")
				.show()
				.html("<img src='"+slidePictures[currentSlide]+"' />")
				.fadeOut("slow");
			
			// add link
			$("#home_hero_window .container").css("cursor", "pointer")
				.unbind()
				.click(function(){window.location=slideLinks[index]})
				.mouseover(function(){pauseSlide=true;})
				.mouseout(function(){pauseSlide=false;})
			;

			// text
			$("#slide_text_container").html(slideHTML[index]);

			// buttons
			$("#home_hero_num a").removeClass("slide_control_active");
			$(".slide_control[index=" + index + "]").addClass("slide_control_active");
			currentSlide = index;
		}