  var Indexcounter = 0;  
  var imagecount   = 7;

  var aryImages    = new Array(imagecount);
  var aryLinks     = new Array(imagecount);

  // Rotation 
  aryImages[0]  = 'images/admin/rightblock-1-3.gif'; // Case story
  aryImages[1]  = 'images/admin/rightblock-1-2.gif'; // M & D digester
  aryImages[2]  = 'images/admin/rightblock-1-1.gif'; // CCS
  aryImages[3]  = 'images/admin/rightblock-2-1.gif'; // calibration
  aryImages[4]  = 'images/admin/rightblock-2-3.gif'; // sanitary sensors
  aryImages[5]  = 'images/admin/rightblock-3-2.gif'; // UPW Analyzers
  aryImages[6]  = 'images/admin/rightblock-3-1.gif'; // Conc. analyzer



  // Links rotation 1
  aryLinks[0]  = 'modules.php?op=modload&name=News&file=article&sid=220'; // case story. 
  aryLinks[1]  = 'modules.php?op=modload&name=News&file=article&sid=137'; // Analyzers for M&D digesters
  aryLinks[2]  = 'modules.php?op=modload&name=News&file=article&sid=136'; // CCS
  aryLinks[3]  = 'modules.php?op=modload&name=News&file=article&sid=12'; // Calibration
  aryLinks[4]  = 'modules.php?op=modload&name=News&file=article&sid=18'; // Sanitary sensors
  aryLinks[5]  = 'modules.php?op=modload&name=News&file=article&sid=162'; // Acid resistant sensors
  aryLinks[6]  = 'modules.php?op=modload&name=News&file=article&sid=167'; // Concentration analyzers


  for (i=0; i < aryImages.length; i++) {
    var preload = new Image();
    preload.src = aryImages[i];
  }


function geturl(Imgcontainer) {
    return aryLinks[Imgcontainer];
}


function shiftimage() {
   i = arguments[0];
   var containername = 'Imgcontainer' + i;  // Which contain should have its image changed ?
   var img = document.getElementsByName(containername);
   img[0].src = aryImages[i];
}


function shift() {
   // Shift all images in the image array one position down and move the last item to the front.
   // Store the last item first.
      var Newfirst = aryImages[imagecount - 1];

   // Move the images on pos. up in the array
      for (i = (imagecount - 1); i > 0; i--) {
        aryImages[i] = aryImages[i - 1];
      }
   // Reinsert the stored "last" image at first pos.  
      aryImages[0] = Newfirst;

   // Rotate the image links.
      var Newfirstlink = aryLinks[imagecount - 1];
      for (i = (imagecount - 1); i > 0; i--) {
        aryLinks[i] = aryLinks[i - 1];
      }
      aryLinks[0] = Newfirstlink;

   // Now changes all the images.
      setTimeout("shiftimage(1);",500);
      setTimeout("shiftimage(2);",800);
      setTimeout("shiftimage(3);",900);
      setTimeout("shiftimage(4);",1000);
      setTimeout("shiftimage(0);",1100);
}

function stoploop() {
  clearTimeout(loopID); 
}

function loopImage() {
  shift();
  loopID = setTimeout("loopImage()", 8000);
}







