var tm;
rotator = true;
n = 1;
li = 'gallery/home/pm.jpg,gallery/home/building.jpg,gallery/home/ot.jpg,gallery/home/front.jpg,gallery/home/cf1.jpg,gallery/home/cf2.jpg,gallery/home/cf3.jpg';
theImages = li.split(',');
allImages = 7;
imgObjects = new Array();
for (var i = 0; i < allImages; i++) {
 imgObjects[i] = new Image();
 imgObjects[i].src = theImages[i];
}

function rotate(direction) {
 n = n + direction;
 if (n > allImages) n = 1;
 rotateImg(n)
}

function rotateImg(imgNum) {
 clearTimeout(tm);
 new Effect.Fade('boxImg', {duration: 1, afterFinish:
  function() {
   $('myImage').src = imgObjects[imgNum-1].src;
   new Effect.Appear('boxImg', {duration: 1, queue: 'end'});
   tm = setTimeout('rotate(1)', 5000);
  }
 })
}

function fadeSlides(start) {
 if (start == 1) {
  rotateImg(1)
 } else {
  rotate(1);
 }
}
