var rotate_speed = 8; 
current = 0; previous=0; Count=0; play_text = "Play";
function Initialize () {
while (My_Names[Count].length) ++Count;
while (captxt.length < Count) captxt.push("");
}
function popWin(Folder)
{popup = window.open
	("../pop.htm?"+ Folder+My_Names[current]+ ".jpg", "", "top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars,height=600,width=800");}

function update (){
document.images.show.src = My_Names[current]+ "s.jpg";
document.all.capt.innerHTML = captxt[current];
document.all.Play_Button.innerHTML = play_text;
document.all.Speed.innerHTML = "speed:" + rotate_speed;
if (captxt[current].length) { document.all.caprow.style.display="block"} else { document.all.caprow.style.display="none"};
document.all.file_count.innerHTML = " Picture "+(current+1)+ " of "+ Count;
document.all.thumbs[previous].border=0;
document.all.thumbs[current].border =5;
previous= current;
}
function stop_it () {play_text = "Play"; update();}
function next() {
++current;	
if (current>= Count) {current=0;} 
stop_it();
}
function prev() {
--current;
if (current<0){current= Count-1;} 
stop_it();
}
function first() {current = 0; stop_it(); }
function last() {current = Count-1;stop_it();}
function toggle_play () {
play_text =(play_text == "Stop") ? "Play" : "Stop";
rotate();
}
function rotate() {
if (play_text == "Stop") {
current = (current == Count-1) ? 0 : current+1;
window.setTimeout("rotate()",  (11-rotate_speed)*1000);
   }
update();
}
function setcur(Num) {current = Num;update ();}
function faster() {if (rotate_speed>1) --rotate_speed; update();}
function slower() {if (rotate_speed<10) ++rotate_speed;update();}
