// 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 j
//PreLoad images 3images
 for (j=1; j < 4; j++) {
var preload = new Image();
    preload.src = "P" + j + ".jpg";
}

//----------------------------------


//**************************************
var max = 4;  // Number of  pictures + 1
var i =1;
var j;
var jmax = 0
//**************************************
function auto_on() {
i=1;
//dly_change = 0  //force it
///if (dly_change == 0){i++}
///document.Dbug.debug.value = "picture # " + i + " of " + max;
document.images["picwin"].src= "P"+ "1" + ".jpg";

//auto_id=setInterval('step()',3000)  This works but below is better unless you want to
// use clearInterval.

//This method is used to call a function or evaluate an expression at specified //intervals, in milliseconds. This will continue until the clearInterval method is //called or the window is closed. The ID value returned by setInterval is used as the //parameter for the clearInterval method. Note that if an expression is to be //evaluated, it must be quoted to prevent it being evaluated immediately

self.setInterval('step()', 2000)  // 
}

function step() {
 
if (i<max) 
   {}//i++;
    
   
else {i = 1; j=1;}
if (i==1 & j==1)
   {document.images["picwin"].src= "P"+ i + ".jpg";
   j=0;}
else
{document.images["picwin"].src= "P"+ i + ".jpg"; i++}


//document.Dbug.debug.value = "picture # " + i + " of " + max
//{i++ }//if (i==1) {j=0}}

}



