/*
   startCrawl() takes the object height and an array of the ID's
   of the objects to crawl. the heights the objects should all be
   equal for the crawl to function correctly.  objects can be images,
   divisions, etc.
*/

// global variables:
    moveDistance = 1;
    moveInterval = 70;
    pauseInterval = 1500;
    maxTop = 86;
    imgTop = 0;
    var imgArray;

function startCrawl(theImgHeight, theImgIDs){
    imgArray = theImgIDs;
    maxTop = theImgHeight;
    for(i = 0; i < imgArray.length; i++) {
         imgArray[i] = document.getElementById(imgArray[i]);
         imgArray[i].style.top = i * (0 + maxTop);
         }
    doCrawl();
    }

function doCrawl() {
    if (imgTop == 0) {
        imgTop = imgTop - moveDistance;
        setTimeout("doCrawl()", pauseInterval); 
        }
    else if (imgTop > -maxTop) {
        imgTop = imgTop - moveDistance;
        for(i = 0; i < imgArray.length; i++) {
           imgArray[i].style.top = imgTop + i * (0 + maxTop);
           }
        setTimeout("doCrawl()", moveInterval); 
        }
    else {
        imgArray.push(imgArray.shift());
        imgTop = 0;
        for(i = 0; i < imgArray.length; i++) {
           imgArray[i].style.top = imgTop + i * (0 + maxTop);
           }
        setTimeout("doCrawl()", moveInterval); 
        }
    }
