Hello. I have a problem I am trying to load my images for background so it is fixed and also changes every few seconds. My images are kept in catalog/view/theme/mwbcomputers/image/etc.png

Images are not starting

I would like it to be able to load and start straight from first image. with out stating at blank page as has done in past.

<script language="javascript">
var myImages = new Array("catalog/view/theme/mwbcomputers/image/bg1.png",
var targetImage = document.findElementById("targetImage");
// this function switches the src for the targetImage with one from the myImage array
var func_rotateImage =
function rotateImage(){

if(typeof rotateImage.index == 'undefined'){

rotateImage.index = 0;


if(typeof rotateImage.size == 'undefined'){

rotateImage.size = myImages.length;

} else if(rotateImage.size != myImages.length) {

// if the array size changes reset index to avoid out of bounds
rotateImage.index = 0;
rotateImage.size = myImage.length;


// if the myImages array is empty do nothing
if(rotateImage.size < 1) {



//this will make the index loop from 0 to n-1 by one for each time the function is called
rotateImage.index = (rotateImage.index + 1) % rotateImage.size

targetImage.src = myImages[rotateImage.index];

// this will make it alter the image every 5 seconds you can put this in the body onload event or call it manually
var intId_rotateImage = setInterval(func_rotateImage,5000);

// if you want to stop the image rotation run this function