	var current = '#slide0';
	var hPS;
	var stopped = false;
	var ambHover;
	var acuteHover;
	var ehrHover;
	var transition = "slow"; // Transition speed between slides.  Can be "fast", "slow", or an actual time expressed in milliseconds
	var pauseDuration = 8000; // Pause duration on slides.  Can be "fast", "slow", or an actual time expressed in milliseconds
	function homePageSlider(){
		if (current == "#slide1"){
			$('#slider').animate({"left": "-=950px"}, "slow");
			$('#slide1P').hide();
			$('#slide2P').show();
			current = '#slide2';
			$('#sliderButtonAmb').css('background', 'url(/images/home/home-ambulatory-button.png)');
			$('#sliderButtonAcute').css('background', 'url(/images/home/home-acute-button-hover.png)');
		}
		else if (current == "#slide2"){
			$('#slider').animate({"left": "-=950px"}, "slow");
			$('#slide2P').hide();
			$('#slide3P').show();
			current = '#slide3';
			$('#sliderButtonAcute').css('background', 'url(/images/home/home-acute-button.png)');
			$('#sliderButtonEHR').css('background', 'url(/images/home/home-EHR-button-hover.png)');
		}
		else{
			$('#slider').animate({"left": "+=1900px"}, "slow");
			$('#slide3P').hide();
			$('#slide1P').show();
			current = '#slide1';
			$('#sliderButtonEHR').css('background', 'url(/images/home/home-EHR-button.png)');
			$('#sliderButtonAmb').css('background', 'url(/images/home/home-ambulatory-button-hover.png)');
		}
	}
	$(document).ready(function(){
		$("select[name=iAmA]").sb();
		$("select[name=number]").sb();
		$('#sliderButtonAmb').mouseover( function() {
			$(this).css('background', 'url(/images/home/home-ambulatory-button-hover.png)');
		}).mouseout( function() {
			if (current == "#slide1")
				$(this).css('background', 'url(/images/home/home-ambulatory-button-hover.png)');
			else
				$(this).css('background', 'url(/images/home/home-ambulatory-button.png)');
		});
		$('#sliderButtonAcute').mouseover( function() {
			$(this).css('background', 'url(/images/home/home-acute-button-hover.png)');
		}).mouseout( function() {
			if (current == "#slide2")
				$(this).css('background', 'url(/images/home/home-acute-button-hover.png)');
			else
				$(this).css('background', 'url(/images/home/home-acute-button.png)');
		});
		$('#sliderButtonEHR').mouseover( function() {
			$(this).css('background', 'url(/images/home/home-EHR-button-hover.png)');
		}).mouseout( function() {
			if (current == "#slide3")
				$(this).css('background', 'url(/images/home/home-EHR-button-hover.png)');
			else
				$(this).css('background', 'url(/images/home/home-EHR-button.png)');
		});
		$('#sliderButtonAmb').click(function(){
			if (current == "#slide2"){
				$('#slider').animate({"left": "+=950px"}, transition);
				$('#sliderButtonAcute').css('background', 'url(/images/home/home-acute-button.png)');
			}
			else if(current == "#slide0"){
				video.stopVideo();
				$('#slider').animate({"left": "-=950px"}, transition);
			}
			else if (current == "#slide3"){
				$('#sliderButtonEHR').css('background', 'url(/images/home/home-EHR-button.png)');
				$('#slider').animate({"left": "+=1900px"}, transition);
			}
			else
				;
			$('#sliderButtonAmb').css('background', 'url(/images/home/home-ambulatory-button-hover.png)');
			$('.arrowTab').hide();
			$('#slide1P').show();
			current = '#slide1';
			clearInterval(hPS);
		});
		$('#sliderButtonAcute').click(function(){
			if (current == "#slide1"){
				$('#slider').animate({"left": "-=950px"}, transition);
				$('#sliderButtonAmb').css('background', 'url(/images/home/home-ambulatory-button.png)');
			}
			else if(current == "#slide0"){
				video.stopVideo();
				$('#slider').animate({"left": "-=1900px"}, transition);
			}
			else if (current == "#slide3"){
				$('#sliderButtonEHR').css('background', 'url(/images/home/home-EHR-button.png)');
				$('#slider').animate({"left": "+=950px"}, transition)
			}
			else
				;
			$('#sliderButtonAcute').css('background', 'url(/images/home/home-acute-button-hover.png)');
			$('.arrowTab').hide();
			$('#slide2P').show();
			current = '#slide2';
			clearInterval(hPS);
		});
		$('#sliderButtonEHR').click(function(){
			if (current == "#slide1"){
				$('#slider').animate({"left": "-=1900px"}, transition);
				$('#sliderButtonAmb').css('background', 'url(/images/home/home-ambulatory-button.png)');
			}
			else if(current == "#slide0"){
				video.stopVideo();
				$('#slider').animate({"left": "-=2850px"}, transition);
			}
			else if (current == "#slide2"){
				$('#slider').animate({"left": "-=950px"}, transition)
				$('#sliderButtonAcute').css('background', 'url(/images/home/home-acute-button.png)');
			}
			else
				;
			$('#sliderButtonEHR').css('background', 'url(/images/home/home-EHR-button-hover.png)');
			$('.arrowTab').hide();
			$('#slide3P').show();
			current = '#slide3';
			clearInterval(hPS);
		});
		/*if (window.addEventListener != null){
			window.addEventListener("focus", function(){
				if (stopped)
					hPS = setInterval( "homePageSlider()", pauseDuration);
			});
			window.addEventListener("blur", function(){
				clearInterval(hPS);
				stopped=true;
			});
		}*/
		$('#fNameOverlay').click(function(){
			$('#fNameHolder').show();
			$('#fName').show();
			$('#fName').focus();
			$(this).hide();
		});
		$('#pNumOverlay').click(function(){
			$(this).hide();
    	$('#pNum').show();
			$('#pNumHolder').show();
			$('#pNum').focus();
		});
		$('#emailOverlay').click(function(){
			$(this).hide();
    	$('#email').show();
			$('#emailHolder').show();
			$('#email').focus();
		});
		$('#lNameOverlay').click(function(){
			$(this).hide();
    	$('#lName').show();
			$('#lNameHolder').show();
			$('#lName').focus();
		});
});
