//*****************************************************
//Configuration information

timesetup = 15000; // delay in milliseconds
images = new Array(8); //number of images

images[0] = "<a href=\"Advafoam.html\"><img src=\"images/ss/adva_foam.gif\" alt=\"Click here for AdvaFoam\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[1] = "<a href=\"spagiene.html\"><img src=\"images/ss/spa_giene.jpg\" alt=\"Click here for Spa.Giene\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[2] = "<a href=\"disinfectants.html\"><img src=\"images/ss/disinfectants.jpg\" alt=\"Click here for disinfectants\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[3] = "<a href=\"sharps_safety.html\"><img src=\"images/ss/sharps_safety.jpg\" alt=\"Click here for Sharps Safety\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[4] = "<a href=\"Atomiser.html\"><img src=\"images/ss/atomiser.jpg\" alt=\"Click here for Atomiser\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[5] = "<a href=\"hygiene.html\"><img src=\"images/ss/enviro_giene.jpg\" alt=\"Click here for Hy.Giene\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[6] = "<a href=\"food_carts.html\"><img src=\"images/ss/food_carts.jpg\" alt=\"Click here for Food Service Carts\" border=\"0\" width=\"400\" height=\"200\"></a>";

//images[7] = "<a href=\"Advasol.html\"><img src=\"images/ss/advasol.jpg\" alt=\"Click here for more Advasol\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[7] = "<a href=\"hearing_aids.html\"><img src=\"images/ss/joy-10.jpg\" alt=\"Click here for Joy-10\" border=\"0\" width=\"400\" height=\"200\"></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("ss0", choosenImage);
  choosenIndex = index;
}


//---------------------------
function displayStart() {
  index = Math.floor(Math.random() * images.length);
  choosenImage = images[index];
  ChangeContent("ss0", choosenImage);
  choosenIndex = index;
}