window.onload = auto;

NewImg = new Array (
"../home/home_frames/1_popup.html",
"../home/home_frames/2_popup.html",
"../home/home_frames/3_popup.html",
"../home/home_frames/4_popup.html"
);
var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 2000;

var lock = false;
var run;

function chgImg(direction) {
if (document.images) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}
document.getElementById("popups").src = NewImg[ImgNum];
   }
}

function auto() {
if (lock == true) {
lock = false;
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
run = setInterval("chgImg(1)", delay);
   }
}

function ap(text) {
document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
auto();
}