var num_recs = 7;
var delay = 5000;
var first = 0;
var slideTimerId = 0;

function changeSlideAuto(div_count) 
{
	if(num_recs > 1) 
	{
		if (div_count >= num_recs) 
		{
			div_count=1;
		}
		else 
		{
			div_count++;
		}
		if (first != 0) 
		{
			changeSlide(div_count);
		}
		else 
		{
			first = 1;
		}
		
		slideTimerId = setTimeout("changeSlideAuto('"+div_count+"')",delay);
	}
}

function changeSlide(number)
{
    if(number == 1) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/OurMission.png' border='0' alt='Our Mission'  />";
		document.getElementById('rotatorTitle').innerHTML = "Our Mission";
		document.getElementById('rotatorDescr').innerHTML = "<br /><br /><br /><br /><br />";		                
	}
	
	if(number == 2) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/Impaired-Driving.jpg' border='0' alt='Impaired Driving'  />";
		document.getElementById('rotatorTitle').innerHTML = "Impaired Driving";
		document.getElementById('rotatorDescr').innerHTML = "Impaired Driving is one of the biggest problems and cause of crashes, injuries and fatalities today.<br><a href='Test-Impaired-Driving-1.htm' style='color: #ffffff;'><b><br>Learn More »</b></a>";		                
	} //end of rotate 1
	
	if(number == 3) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/Speeding.jpg' border='0' alt='Aggressive Driving'  />";
		document.getElementById('rotatorTitle').innerHTML = "Aggressive Driving";
		document.getElementById('rotatorDescr').innerHTML = "The District was one of the first jurisdictions in the country to join the Smooth Operator Program.<br><a href='Test-Aggressive-Driving.htm' style='color: #ffffff;'><b>Learn More »</b></a>";
	} //end of rotate 1
	
	if(number == 4) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/Pedestrian-Safety.jpg' border='0' alt='Pedestrian Safety'  />";
		document.getElementById('rotatorTitle').innerHTML = "Pedestrian Safety";
		document.getElementById('rotatorDescr').innerHTML = "The District and surrounding jurisdictions are united against bicycle and pedestrian tragedies.<br><br /><a href='Test-Pedestrian-Safety.htm' style='color: #ffffff;'><b>Learn More »</b></a>";
	} //end of rotate 1
	
	if(number == 5) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/Seat-Belt-Safety.jpg' border='0' alt='Occupant Protection'  />";
		document.getElementById('rotatorTitle').innerHTML = "Occupant Protection";
		document.getElementById('rotatorDescr').innerHTML = "The District has the strongest, most comprehensive seat belt law in the nation.<br><a href='Test-Occupant-Protection.htm' style='color: #ffffff;'><b><br>Learn More »</b></a><br>";
	} //end of rotate 1
	
	if(number == 6) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/Distracted-Driving.jpg' border='0' alt='Distracted Driving'  />";
		document.getElementById('rotatorTitle').innerHTML = "Distracted Driving";
		document.getElementById('rotatorDescr').innerHTML = "Driver distractions cause crashes, injuries and deaths. In 2004, the District of Columbia enacted laws to restrict mobile phone use while driving.<br><br>";
	}
	
	if(number == 7) 
	{
		clearTimeout ( slideTimerId );
		document.getElementById('rotatorImg').innerHTML = "<img width='640' height='170' src='ddot/hso/images/Sliding_Images/WorkZone-Safety.jpg' border='0' alt='Work Zone Safety'  />";
		document.getElementById('rotatorTitle').innerHTML = "Work Zone Safety";
		document.getElementById('rotatorDescr').innerHTML = "Each year, lives are lost in work zones, and the majority of those fatalities are drivers not the workers.<br><br /><br>";
	}
	
}
