Good day!

I am new in web development and i am trying to work on our company's website. I am having trouble in making the slideshow to autoplay once the site is loaded. here is the code for java:

NewImg = new Array (
"images/Pic03.png",
"images/Pic01.jpg",
"images/Pic02.jpg"
);

var random_display = 0;
var ImgNum = 0;
var ImgLength = NewImg.length - 1;
var totalImages = NewImage.l
//Time delay between Slides in milliseconds
var delay = 1500;
var lock = true;
var run;

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


And here's the html:
<div id="slideshow">
<img src="images/Pic03.png" name="slideshow">
</div>

Css:
#slideshow {
margin-top: 170px;
width: 1024px;
height: 368px;
position: absolute;
z-index:3;
}

Help will greatly be appreciated.

Thanks!