function changeImage(r,i)
{
r.src=i;
}

function ImageRotator(imageSet,speed)
{
  currentImg ++;
  if (currentImg == imageSet.length)
    currentImg=0;
  changeImage(document.ImgName,imageSet[currentImg]);
  setTimeout("ImageRotator(imageSet,speed)", speed)
}

function RotateImg(width,height,s,images)
{
 speed = s;
 si = 0; 
 ci=0;
 cc=0;
 imageSet = new Array();
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  currentImg = 0;
   
 document.write("<a href='advertise.php?page=main'><img name='ImgName'");
 if (width >0)
    document.write("width="+width);
 if (height >0)
    document.write(" height=" +height);
	document.writeln(" src=" +imageSet[0]+ " border='0' alt='' vspace='2'></a>");

  setTimeout("ImageRotator(imageSet,speed)", speed)
}

function RotateSet(width,height,images)
{
  speed=4000;
  RotateImg(width,height,speed,images);
}
