// PUT THE URL'S OF YOUR IMAGES INTO THIS ARRAY...
//var ImageList = new Array('1.jpg','2.jpg','3.jpg','4.jpg','6.jpg','7.jpg','8.jpg','10.jpg','11.jpg','12.jpg','13.jpg','14.jpg','15.jpg');

// DO NOT EDIT BELOW THIS LINE!
function CacheImage(ImageSource) { // TURNS THE STRING INTO AN IMAGE OBJECT
   var ImageObject = new Image();
   ImageObject.src = 'Portals/' + ThePortal + '/' + TheFolder + '/' + ImageSource;
   return ImageObject;
}

function MoveImage(Direction) {
   if (SlideReady) {
      NextSlide = CurrentSlide + Direction;
      
      if (navigator.appName == "Microsoft Internet Explorer") {
	// THIS WILL DISABLE THE BUTTONS (IE-ONLY)
	document.forms(0).Previous.disabled = (NextSlide == 0);
	document.forms(0).Next.disabled = (NextSlide == (ImageList.length-1));
      }  
 if ((NextSlide >= 0) && (NextSlide < ImageList.length)) {
            document.images['ImageUp'].src = ImageList[NextSlide].src;
            CurrentSlide = NextSlide++;
            Message = 'Image ' + (CurrentSlide+1) + ' of ' + ImageList.length;
            self.defaultStatus = Message;
            if (Direction == 1) CacheNextSlide();
      }
      return true;
   }
}

function Download() {
   if (ImageList[NextSlide].complete) {
      SlideReady = true;
      self.defaultStatus = Message;
   }
   else setTimeout("Download()", 100); // CHECKS DOWNLOAD STATUS EVERY 100 MS
   return true;
}

function CacheNextSlide() {
   if ((NextSlide < ImageList.length) && (typeof ImageList[NextSlide] == 'string'))
{ // ONLY CACHES THE IMAGES ONCE
      SlideReady = false;
      self.defaultStatus = 'Downloading image...';
      ImageList[NextSlide] = CacheImage(ImageList[NextSlide]);
      Download();
   }
   return true;
}

function LoadImages(Portal,Folder) {
   ThePortal = Portal;
   TheFolder = Folder;
   CurrentSlide = -1;
   ImageList[0] = CacheImage(ImageList[0]);
   SlideReady = true;
   MoveImage(1);
}
