// This code is copyrighted 2008 - 2010  By Stephen J. Halpern
// It may not be used without permission. Incorporation of this code, by me, on a
// client's web site does not give that client the right to use this code on any
// other site without permission. 
// Stephen J. Halpern
var num;
var dly;
var j;
var a_on = 0  // auto_on indicator 0=off, 1=On
var dly_change = 0

function m_over (n) {   // Mouse over on Index Page
document.images["picwin"].src= "m"+n + ".jpg";
}

function m_out() {document.images["picwin"].src= "m1.jpg";} // Mouse out  on Home page return to map1

function step() {
if (j<max) 
   {j++}
 else {j = 1}
document.images["picwin"].src= "p"+j + ".jpg";
///document.Dbug.debug.value = "picture # " +j + " of " + max
if (j==1) {auto_off()}   // added 3/28 for Ted's site to stop after one pass.

}
function step_back(){
if(j > 1){
j =j - 1;}
else{j=max}
document.images["picwin"].src= "p"+ j + ".jpg";
//////////////////////////document.Dbug.debug.value = "picture # " + j + " of " + max;
}

function setup() {j = 1;   // Initalization "ONLOAD"
//  max=10;
///////////////////////////////////////document.Dbug.debug.value = "picture # " + "1"+ " of " + max;
dly = 3500 ///3000;  // Initial speed
}

function auto_on() {
a_on=1;
if (dly_change == 0){j++}
///////////////////////////document.Dbug.debug.value = "picture # " + j + " of " + max;
document.images["picwin"].src= "p"+ "2" + ".jpg";

auto_id=setInterval('step()',dly)
}

function auto_off() {
a_on=0;
clearInterval(auto_id);
}

function set_dly(m){
document.Dbug.debug.value = "got it " + m;
if(a_on == 1) {
    document.Dbug.debug.value ="a_on is ON";
    auto_off()
    dly = m*1000;
    dly_change = 1;
    auto_on();
    dly_change = 0;
	}
else{dly = m*1000;  // Auto Mode is off
      document.Dbug.debug.value ="dly= "  + dly;
	}
}
