// JavaScript Document

i = 9 // Number of banners that you have
banner1 = new Image();
banner1.src = "/images/main_images/top_image2.jpg";
banner2 = new Image();
banner2.src = "/images/main_images/top_image3.jpg";
banner3 = new Image();
banner3.src = "/images/main_images/top_image4.jpg";
banner4 = new Image();
banner4.src = "/images/main_images/top_image5.jpg";
banner5 = new Image();
banner5.src = "/images/main_images/top_image6.jpg";
banner6 = new Image();
banner6.src = "/images/main_images/top_image7.jpg";
banner7 = new Image();
banner7.src = "/images/main_images/top_image8.jpg";
banner8 = new Image();
banner8.src = "/images/main_images/top_image9.jpg";
banner9 = new Image();
banner9.src = "/images/main_images/top_image10.jpg";
links = new Array
links[1] = "http://www.seisen.com/welcome/"
links[2] = "http://www.seisen.com/welcome/"
links[3] = "http://www.seisen.com/welcome/"
links[4] = "http://www.seisen.com/welcome/"
links[5] = "http://www.seisen.com/welcome/"
links[6] = "http://www.seisen.com/welcome/"
links[7] = "http://www.seisen.com/welcome/"
links[8] = "http://www.seisen.com/welcome/"
links[9] = "http://www.seisen.com/welcome/"
description = new Array
description[1] = "Welcome to Seisen International School"
description[2] = "Welcome to Seisen International School"
description[3] = "Welcome to Seisen International School"
description[4] = "Welcome to Seisen International School"
description[5] = "Welcome to Seisen International School"
description[6] = "Welcome to Seisen International School"
description[7] = "Welcome to Seisen International School"
description[8] = "Welcome to Seisen International School"
description[9] = "Welcome to Seisen International School"

function randombanner(){
  var randomnumber = Math.random();
  i = Math.round( (i - 1) * randomnumber) + 1;
  // document.banner.src = eval("banner" + i + ".src");
  imgpath = eval("banner" + i + ".src");
  document.getElementById("topimage").style.backgroundImage="url('" + imgpath + "')";
}

function startTime(){
  var time= new Date();
  hours= time.getHours();
  mins= time.getMinutes();
  secs= time.getSeconds();
  closeTime=hours*3600+mins*60+secs;
  closeTime+=5;   
  Timer();
}

function Timer(){
  var time= new Date();
  hours= time.getHours();
  mins= time.getMinutes();
  secs= time.getSeconds();
  curTime=hours*3600+mins*60+secs;
  
  if (curTime>=closeTime){
    if (i < 9){
      i++;
      // document.banner.src = eval("banner" + i + ".src");
      imgpath = eval("banner" + i + ".src");
      document.getElementById("topimage").style.backgroundImage="url('" + imgpath + "')";
    } else {
      i = 1;
      // document.banner.src = eval("banner" + i + ".src");
      imgpath = eval("banner" + i + ".src");
      document.getElementById("topimage").style.backgroundImage="url('" + imgpath + "')";
    }
    startTime();
  } else {window.setTimeout("Timer()",3000);}
}

function clickLink(){
  top.location = links[i];
}

function descript(){
  window.status = description[i];
}
// -->
