// JavaScript Document

//The arrays for the cycling cover blocks
adImages1 = new Array ("images/afritourismblock.gif",        "images/petrosablock.gif",            "images/stdbank.gif",           "images/mvcblock.gif",                  "images/nbcblock.gif")
adURL1 = new Array("yebosa.com/afritourism",                 "yebosa.com/petrosa",             "sbic.co.za",                   "montevistacasino.co.za",               "yebosa.com/nbc")
adImages2 = new Array("images/crawfordblock.gif",            "images/legalwise.gif",           "images/tech2.gif",               "images/deptofeduc.gif",        "images/ncp.jpg",                       "images/tshiliblock.gif")
adURL2 = new Array("yebosa.com/crawford",                    "legalwise.co.za",                "yebosa.com/seshego",             "education.gov.za",             "yebosa.com/ncp",                       "yebosa.com/tshili")
adImages3 = new Array("images/deptswpd.gif",                 "images/un.gif",                  "images/ephblock.gif",        "images/pbblock.gif",                   "images/madcblock.gif",            "images/potch-block.gif")
adURL3 = new Array("yebosa.com/dswp",                        "un.org",                         "yebosa.com/eph",                   "advertproof.com/psbank",               "yebosa.com/madc",             "potch.co.za")
adImages4 = new Array("images/solusblock.gif",               "images/doeablock.gif",            "images/siba2.gif",               "images/pblodge.gif",           "images/vulaniblock.gif",               "images/ufsblock.gif")
adURL4 = new Array("yebosa.com/solus",                       "yebosa.com/doea",                 "yebosa.com/siba",                "yebosa.com",                   "yebosa.com/vulani",                    "yebosa.com/ufs")
adImages5 = new Array("images/firsttech.gif",                "images/housingdep.jpg",          "images/tshili1.jpg",             "images/optiplan.gif",          "images/lekwamunicipality.gif",         "images/cecilblock.gif")
adURL5 = new Array("firsttech.co.za",                        "yebosa.com/housingdep",          "yebosa.com/tshili",              "yebosa.com",                   "yebosa.com/lekwamunicipality",         "yebosa.com/cecil")
adImages6 = new Array("images/ndostblock.gif",               "images/ilmblock.gif",            "images/polokwaneblock.gif",      "images/nathi1.gif",            "images/nmblock.gif",            "images/sarccblock.gif")
adURL6 = new Array("yebosa.com/ndost",                       "yebosa.com/ilm",                 "yebosa.com/polokwane",           "yebosa.com/nathi",             "yebosa.com/nm",             "yebosa.com/sarcc")
adImages7 = new Array("images/vodacom.gif",                  "images/tswello2.gif",            "images/akananilbscblock.gif",    "images/mutaleblock.gif",       "images/btcblock.gif",           "images/embapmblock.gif",           "images/sanipass-block.gif")
adURL7 = new Array("vodacom.co.za",                          "yebosa.com/tswello",             "yebosa.com/akananilbsc",         "mutale.co.za",                 "btc.org",                      "yebosa.com/embapm",                "yebosa.com/sanipass")
adImages8 = new Array("images/nbs.gif",                      "images/lovedale1.jpg",           "images/housingdep.jpg",          "images/mohadiblock.gif",       "images/moletjiblock.gif",       "images/kznleg-block.gif",          "images/total-block.gif")
adURL8 = new Array("nbs.co.za",                              "yebosa.com/lovedale",            "yebosa.com/housingdep",          "yebosa.com/mohadi",            "yebosa.com/moletji",           "yebosa.com/kznlegislature",         "yebosa.com/total")

 thisAd1 = 0
 thisAd2 = 0
 thisAd3 = 0
 thisAd4 = 0
 thisAd5 = 0
 thisAd6 = 0
 thisAd7 = 0
 thisAd8 = 0

 imgCt1  = adImages1.length
 imgCt2  = adImages2.length
 imgCt3  = adImages3.length
 imgCt4  = adImages4.length
 imgCt5  = adImages5.length
 imgCt6  = adImages6.length
 imgCt7  = adImages7.length
 imgCt8  = adImages8.length
 
 //Functions to cycle through image arrays
 function rotate1() {
   if(document.images) {
     thisAd1++
     if(thisAd1 == imgCt1) {
       thisAd1 = 0
     }
     document.adBanner1.src = adImages1[thisAd1]
     setTimeout("rotate1()", 5 * 1000)
   }
 }

  function rotate2() {
   if(document.images) {
     thisAd2++
     if(thisAd2 == imgCt2) {
       thisAd2 = 0
     }
     document.adBanner2.src = adImages2[thisAd2]
     setTimeout("rotate2()", 5 * 1000)
   }
 }


  function rotate3() {
   if(document.images) {
     thisAd3++
     if(thisAd3 == imgCt3) {
       thisAd3 = 0
     }
     document.adBanner3.src = adImages3[thisAd3]
     setTimeout("rotate3()", 5 * 1000)
   }
 }

  function rotate4() {
   if(document.images) {
     thisAd4++
     if(thisAd4 == imgCt4) {
       thisAd4 = 0
     }
     document.adBanner4.src = adImages4[thisAd4]
     setTimeout("rotate4()", 5 * 1000)
   }
 }

  function rotate5() {
   if(document.images) {
     thisAd5++
     if(thisAd5 == imgCt5) {
       thisAd5 = 0
     }
     document.adBanner5.src = adImages5[thisAd5]
     setTimeout("rotate5()", 5 * 1000)
   }
 }

 function rotate6() {
   if(document.images) {
     thisAd6++
     if(thisAd6 == imgCt6) {
       thisAd6 = 0
     }
     document.adBanner6.src = adImages6[thisAd6]
     setTimeout("rotate6()", 5 * 1000)
   }
 }

 function rotate7() {
   if(document.images) {
     thisAd7++
     if(thisAd7 == imgCt7) {
       thisAd7 = 0
     }
     document.adBanner7.src = adImages7[thisAd7]
     setTimeout("rotate7()", 5 * 1000)
   }
 }

 function rotate8() {
   if(document.images) {
     thisAd8++
     if(thisAd8 == imgCt8) {
       thisAd8 = 0
     }
     document.adBanner8.src = adImages8[thisAd8]
     setTimeout("rotate8()", 5 * 1000)
   }
 }
 
 //functions for the cycling banner links

 function newLocation1() {
    document.location.href = "http://www."+ adURL1[thisAd1]
  }

 function newLocation2() {
    document.location.href = "http://www."+ adURL2[thisAd2]
  }

 function newLocation3() {
    document.location.href = "http://www."+ adURL3[thisAd3]
  }

 function newLocation4() {
    document.location.href = "http://www."+ adURL4[thisAd4]
  }
 
 function newLocation5() {
    document.location.href = "http://www."+ adURL5[thisAd5]
  }

 function newLocation6() {
    document.location.href = "http://www."+ adURL6[thisAd6]
  }

 function newLocation7() {
    document.location.href = "http://www."+ adURL7[thisAd7]
  }

 function newLocation8() {
    document.location.href = "http://www."+ adURL8[thisAd8]
  }
  
//Function to open link window
function navi(newLoc) {
   newPage = newLoc.options[newLoc.selectedIndex].value

   if(newPage != ""){
      window.location.href = newPage
   }
 }