var currentImage = 0;
var arraySize = 5; 
var maxArray = arraySize -1; 
var imageArray = new Array(arraySize); 
var captionArray = new Array(arraySize); 
var courtesyArray = new Array(arraySize); 
imageArray[0] = "/images/slideshow/top5cities/denver.jpg"; 
imageArray[1] = "/images/slideshow/top5cities/nashville.jpg"; 
imageArray[2] = "/images/slideshow/top5cities/sanAntonio.jpg"; 
imageArray[3] = "/images/slideshow/top5cities/dallas.jpg"; 
imageArray[4] = "/images/slideshow/top5cities/saltLakecity.jpg"; 
captionArray[0] = "<strong>No. 1 Denver, Colo.</strong><br>With a median annual household income of $62,500 and the median home price at $305,000, Denver tops the list as an affordable place to live and work.";
captionArray[1] = "<strong>No. 2 Nashville, Tenn.</strong><br>Median home prices are around $260,000 in Nashville, the city experienced 2% job growth in 2007 and the annual median household income was close to $53,000, making it a great place to spend less and earn more."; 
captionArray[2] = "<strong>No. 3 San Antonio, Texas</strong><br>With the cheapest median home prices of the top five--at just $177,600, and a median household income of $46,400, San Antonio makes the cut."; 
captionArray[3] = "<strong>No. 4 Dallas, Texas</strong><br>Thanks to a median annual household income of $56,000 and a median home price of  $202,867, Dallas could be the place to be."; 
captionArray[4] = "<strong>No. 5 Salt Lake City, Utah</strong><br>The median home price is a little higher than its counterparts at $376,100, but salaries are higher there too.  The median annual household income is $56,800."; 
courtesyArray[0] = "Source: Denver Metro Convention & Visitors Bureau"; 
courtesyArray[1] = "Source: Nashville Convention & Visitors Bureau"; 
courtesyArray[2] = "Source: San Antonio Convention & Visitors Bureau"; 
courtesyArray[3] = "Source: Dallas Convention & Visitors Bureau"; 
courtesyArray[4] = "Source: Salt Lake Convention & Visitors Bureau"; 
if (document.images)
{
  pic1= new Image(276,150); 
  pic1.src="/images/slideshow/top5cities/denver.jpg"; 

  pic2= new Image(276,150); 
  pic2.src="/images/slideshow/top5cities/nashville.jpg"; 

  pic3= new Image(276,150); 
  pic3.src="/images/slideshow/top5cities/sanAntonio.jpg"; 

  pic4= new Image(276,150); 
  pic4.src="/images/slideshow/top5cities/dallas.jpg"; 

  pic5= new Image(276,150); 
  pic5.src="/images/slideshow/top5cities/saltLakecity.jpg"; 
}
function swapper(direction){ 
if (direction == -1) { 
	currentImage = currentImage - 1; 
} 
else if (direction == 1) { 
	currentImage = currentImage + 1; 
} 
else {
	currentImage = direction - 11;
}
if (currentImage < 0) {
	currentImage = maxArray; 
} 
else if (currentImage > maxArray) { 
	currentImage = 0; 
} 
document.getElementById('imageCaption').innerHTML = captionArray[currentImage]; 
document.getElementById('imageCourtesy').innerHTML = "<font size = 1>" + courtesyArray[currentImage] + "</font>"; 
document.sliderPicture.src = imageArray[currentImage]; 
}