//*****************************************************
//Configuration information

timesetup = 4000; // delay in milliseconds
images = new Array(6); //number of images

images[0] = "<a href=\"http://www.webconcerns.co.uk/default.asp\"><img src=\"image1.jpg\" alt=\"Click here for ...\" border=\"0\" width=\"100\" height=\"100\"></a>";

images[1] = "<a href=\"http://www.webconcerns.co.uk/asp/default.asp\"><img src=\"image2.jpg\" alt=\"Click here for ...\" border=\"0\" width=\"100\" height=\"100\"></a>";

images[2] = "<a href=\"http://www.webconcerns.co.uk/aspnet/default.asp\"><img src=\"image3.jpg\" alt=\"Click here for ...\" border=\"0\" width=\"100\" height=\"100\"></a>";

images[3] = "<a href=\"http://www.webconcerns.co.uk/javascript/default.asp\"><img src=\"image4.jpg\" alt=\"Click here for ....\" border=\"0\" width=\"100\" height=\"100\"></a>";

images[4] = "<a href=\"http://www.webconcerns.co.uk/aspnet/searchdb/default.asp\"><img src=\"image5.jpg\" alt=\"Click here for ....\" border=\"0\" width=\"100\" height=\"100\"></a>";

images[5] = "<a href=\"http://www.webconcerns.co.uk/aspnet/search/default.asp\"><img src=\"image6.jpg\" alt=\"Click here for ...\" border=\"0\" width=\"100\" height=\"100\"></a>";



//*****************************************************

type = "IE"; //default setting
BrowserSniffer(); //find out which browser
choosenImage = 0;
choosenIndex = 0;

displayStart();

if (images.length > 0) {
  timerID = setInterval(swapImage,timesetup);
}

//---------------------------
function BrowserSniffer() {
  if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";
  else if (document.all) type="IE";
  else if (document.layers) type="NN";
  else if (!document.all && document.getElementById) type="MO";
  else type = "IE";
}

//---------------------------
function whatBrows() {
  window.alert("Browser is : " + type);
}

//---------------------------
function ChangeContent(id, str) {

  if (type=="IE") {
    document.all[id].innerHTML = str;
  }

  if (type=="NN") {
    document.layers[id].document.open();
    document.layers[id].document.write(str);
    document.layers[id].document.close();
  }

  if (type=="MO" || type=="OP") {
    document.getElementById(id).innerHTML = str;
  }

}

//---------------------------
function swapImage() {
  index = Math.floor(Math.random() * images.length);
  if (index == choosenIndex) {
    index++;
    if (index == images.length) {
      index = 0;
    }
  }  
  choosenImage = images[index];
  ChangeContent("box0", choosenImage);
  choosenIndex = index;
}


//---------------------------
function displayStart() {
  index = Math.floor(Math.random() * images.length);
  choosenImage = images[index];
  ChangeContent("box0", choosenImage);
  choosenIndex = index;
}