//*****************************************************
//Configuration information

timesetup = 15000; // delay in milliseconds
images = new Array(5); //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[0] = "<a href=\"recycling.html\"><img src=\"images/ss/advaCOMPOSTER_site.jpg\" alt=\"Click here for advaCOMPOSTER\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[1] = "<a href=\"../biomass/\"><img src=\"images/ss/biomass_boiler.jpg\" alt=\"Click here for biomass boiler\" border=\"0\" width=\"400\" height=\"200\"></a>";

images[2] = "<a href=\"../food_waste/\"><img src=\"images/ss/advadigester_site.jpg\" alt=\"Click here for advaDIGESTER\" 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[3] = "<a href=\"recycling.html\"><img src=\"images/ss/briquetting.jpg\" alt=\"Click here for organic waste recycling\" 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[4] = "<a href=\"recycling.html\"><img src=\"images/ss/food_waste_digester.jpg\" alt=\"Click here food waste digester solution\" 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;
}
