var pause = 5;
var counter = 0;
var slideshowData = [
    {img:'daniel-vanhorn.jpg',caption:'<b>Daniel VanHorn</b> - 9.69 @ 145 MPH'},
	{img:'tony-shepherd-2.jpg',caption:'<b>Tony Shepherd</b> - 8.68 @ 153.51 MPH'},
    {img:'brian-black.jpg',caption:'<b>Brian Black</b> - 7.89 @ 175.2 MPH 1.21 60 ft'},	
	{img:'shawn-strauss.jpg',caption:'<b>Shawn Strauss</b> - 5.07 @ 125 1.21 60 ft'},	
	{img:'rick-newman.jpg',caption:'<b>Rick Newman</b> - 8.65 @ 159 MPH'},
	{img:'larry-hamilton.jpg',caption:'<b>Larry Hamilton</b> - 10.05 @ 132 MPH 1.32 60 ft'},
	{img:'John_Schaeffer.jpg',caption:'<b>John Schaeffer</b> - 9.78 @ 137 MPH 1.33 60 ft'},					 					 
	{img:'bumperdrag1.jpg',caption:'<b>Mark Caughey</b> - 9.23 @ 149.1 MPH'},
	{img:'Clay_Forester.jpg',caption:'<b>Clay Forester</b> - Sand Zilla'},
	{img:'eric_piner.jpg',caption:'<b>Eric Piner</b> - 9.13 @ 149 MPH'},
	{img:'Faisal_Merghelani.jpg',caption:'<b>Faisal Merghelani</b> - 9.54 @ 142.84 MPH'},
	{img:'ron_hughes.jpg',caption:'<b>Ron Hughes</b> - 9.90 @ 142 MPH'},
	{img:'RPM-1.jpg',caption:'<b>RPM Inc. Camaro</b> - 8.27 @ 163 MPH'},
	{img:'RPM-2.jpg',caption:'<b>RPM Inc. Trailblazer SS</b> - 10.63 @ 129.7 MPH'},
	{img:'sam.jpg',caption:'<b>Sam Stevenson</b> - 10.14 @ 131.21 MPH'},
	{img:'shawn-mccauley-1.jpg',caption:'<b>Shawn McCauley</b> - 9.71 @ 142 MPH'}			
];

// preload images
for (var i=0; i<slideshowData.length; i++) {
	var data = slideshowData[i];
	var myImage = new Image();
	myImage.src = "/images/gallery/intro/large/JPEG/" + data.img;
}

function slideshow() {
	var data = slideshowData[counter];
	
	var doappear = function() {
		$("slideshowImage").src = "/images/gallery/intro/large/JPEG/" + data.img;
		jQuery("#slideshowText").html('<span style="margin:0;padding:0;font-size:14px;font-weight:bold;color:#666;">Featured Nitrous Outlet Customers</span><br>' + data.caption);
		
		$("slideshowImage").appear({
			beforeStart:function() {
				// test
			},
			afterFinish:function(){
				counter++;
				if (counter >= slideshowData.length) {
					counter = 0;
				}
				setTimeout("slideshow()",parseInt(pause*1000));			
			}
		});		
	}
	
	$("slideshowImage").fade({
		afterFinish:function(){
			jQuery("#slideshowText").html('&nbsp;');		
			doappear();
		}
	});
}

jQuery(window).bind("load",function(){
	slideshow();
});
