//  copyright 2006 David Deatherage
//  http://CleanEdgeDesign.com

picList = new Array (
"sections/home2/roll01_sprinter1.jpg",
"sections/home2/roll02_ford09_ph.jpg",
"sections/home2/roll03_chevy1.jpg",
"sections/home2/roll04_chevy2.jpg"
)

var imgCount=picList.length;
var currentPic=-1;
var timer;
var j=0; //sets number of times to rotate in line 8 of rotate function "if (j>#)"

function rotate() {
  if (document.images) {
   currentPic++;
     if (currentPic==imgCount) {
     currentPic=0;
	 j++; 
	 }
	 
	 if (j>3) {
	   stoprotate();
	   j=0; 
	   currentPic=-1;
	   document.thephoto.src=picList[0];
	 } else {
  		document.thephoto.src=picList[currentPic];
  		timer=window.setTimeout("rotate()", 2000);
	 		}
  }
}

function stoprotate() {
 window.clearTimeout(timer);
}

//2nd rotator -- delete or comment out all from here if you only need one rotator

picList2 = new Array (
"sections/home2/roll1_int02a.jpg",
"sections/home2/roll2_int01a.jpg",
"sections/home2/roll3_int03a.jpg",
"sections/home2/roll4_int05a.jpg",
"sections/home2/roll5_int05a.jpg",
"sections/home2/roll6_int06a.jpg"
)

var imgCount2=picList2.length;
var currentPic2=-1;
var timer2;
var j2=0;

function rotate2() {
  if (document.images) {
   currentPic2++;
     if (currentPic2==imgCount2) {
     currentPic2=0;
 	 j2++; 
	 }
	 if (j2>3) {
	   stoprotate2();
	   j2=0; 
	   currentPic2=-1;
	   document.thephoto2.src=picList2[0];
	 } else {
		document.thephoto2.src=picList2[currentPic2];
		timer2=window.setTimeout("rotate2()", 3000);
			}
  }
}

function stoprotate2() {
 window.clearTimeout(timer2);
}



picList3 = new Array (
"sections/home2/roll1_uav1y.jpg",
"sections/home2/roll2_uav2y.jpg",
"sections/home2/roll3_uav3y.jpg",
"sections/home2/roll4_uav4y.jpg",
"sections/home2/roll5_uav5y.jpg"
)

var imgCount3=picList3.length;
var currentPic3=-1;
var timer3;
var j3=0;

function rotate3() {
  if (document.images) {
   currentPic3++;
     if (currentPic3==imgCount3) {
     currentPic3=0;
  	 j3++; 
	 }
	 if (j3>6) {
	   stoprotate3();
	   j3=0; 
	   currentPic3=-1;
	   document.thephoto3.src=picList3[0];
	 } else {
		document.thephoto3.src=picList3[currentPic3];
		timer3=window.setTimeout("rotate3()", 2000);
			}
  }
}

function stoprotate3() {
 window.clearTimeout(timer3);
}



picList4 = new Array (
"sections/home2/roll1_uav1r.jpg",
"sections/home2/roll2_uav2r.jpg",
"sections/home2/roll3_uav3r.jpg",
"sections/home2/roll4_uav4r.jpg",
"sections/home2/roll5_uav5r.jpg"
)

var imgCount4=picList4.length;
var currentPic4=-1;
var timer4;
var j4=0;

function rotate4() {
  if (document.images) {
   currentPic4++;
     if (currentPic4==imgCount4) {
     currentPic4=0;
  	 j4++; 
	 }
	 if (j4>7) {
	   stoprotate4();
	   j4=0; 
	   currentPic4=-1;
	   document.thephoto4.src=picList4[0];
	 } else {
		document.thephoto4.src=picList4[currentPic4];
		timer4=window.setTimeout("rotate4()", 1500);
			}
  }
}

function stoprotate4() {
 window.clearTimeout(timer4);
}
