var rotate_speed = 5; 
current = 0; previous=0; Count=0; play_text = "Play";
function Initialize () {
while (My_Names[Count].length) ++Count;
while (captxt.length < Count) captxt.push("");
}
function update (){
document.images.show.src = My_Names[current];
document.getElementById("ashow").href = My_Names[current];
document.getElementById("capt").childNodes[0].nodeValue = captxt[current];
document.getElementById("Play_Button").childNodes[0].nodeValue = play_text;
document.getElementById("Speed").childNodes[0].nodeValue= "speed:" + rotate_speed;
if (captxt[current].length) { document.getElementById("caprow").style.display="block"} else { document.getElementById("caprow").style.display="none"};
document.getElementById("file_count").childNodes[0].nodeValue = " Picture "+(current+1)+ " of "+ Count;
document.getElementsByName("thumbs")[previous].style.border="0";
document.getElementsByName("thumbs")[current].style.border="5px ridge #40f040";
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();}
