var Rollpic1 = "images/b01.jpg";
var Rollpic2 = "images/b02.jpg";
var Rollpic3 = "images/b03.jpg";
var Rollpic4 = "images/b04.jpg";
var Rollpic5 = "images/b05.jpg";
var Rollpic6 = "images/b06.jpg";
var Rollpic7 = "images/b07.jpg";
var Rollpic8 = "images/b08.jpg";

var PicNumber=1;
var NumberOfPictures=8;
var HowLongBetweenPic=5;

function SwitchPic(counter){
	if(counter < HowLongBetweenPic){
	
		counter++;
		
		//Display pic in what <IMG> tag roll is what I called the image
		document.roll.src = eval("Rollpic" + PicNumber);
		
		//function calls itself
		CallSwitchPic=window.setTimeout("SwitchPic("+counter+")",1500); 
	}
	else{
		//if its not the last picture goto the next picture
		if(PicNumber < NumberOfPictures){
			PicNumber++;
			SwitchPic(0);
		}
		//its the last picture go to the first one
		else{
			PicNumber=1;
			SwitchPic(0);
		}
	}
}

var preloadFlag = false;
function preloadImages() {
        if (document.images) {
                worldlocation= newImage("http://www.enplas-ets.com/images/worldlocation-over.gif");
                sitemap= newImage("http://www.enplas-ets.com/images/sitemap-over.gif");
                preloadFlag = true;
        }
}

function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}

function changeImages() {
        if (document.images && (preloadFlag == true)) {
                for (var i=0; i<changeImages.arguments.length; i+=2) {
                        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                }
        }
}
