var linktopimg = new Image()
linktopimg.src = "images/linktop.gif"
var linkbottomimg = new Image()
linkbottomimg.src = "images/linkbottom.gif"

var currentDiv = null
var maxbottom = 0
var linkbottom = 0
var infobottom = 0
var origwidth = 0
var origheight = 0
var theWindHt = 0
var theWindWt = 0

function reloadAgain()
{
   if (innerwidth != origwidth || innerheight != origheight)
      location.reload()
}

if (IE)
{
   window.onresize = centerIt
}
  
if (NS)
{
   origwidth = innerwidth
   origheight = innerheight
   window.onresize = reloadAgain
}

function makeVisible(newDiv)
{
   if (currentDiv != null)
   {
      if (NS)
         currentDiv.display = "none"
      if (IE)
         currentDiv.style.display = "none"
   }
  
   currentDiv = newDiv
  
   if (NS)
      newDiv.display = "block"
   if (IE)
      newDiv.style.display = "block"
    
   centerIt()
}

function centerIt()
{
   if (NS)
   {
      theWindHt = window.innerHeight
      theWindWt = window.innerWidth
   }
   if (IE)
   {
      theWindHt = document.body.clientHeight
      theWindWt = document.body.clientWidth
   }
  
   linkLeft = (theWindWt / 2) - 380
   if (linkLeft < 5)
      linkLeft = 5
    
   if (NS)
      linkbox.left = linkLeft
   if (IE)
      linkbox.style.left = linkLeft
    
   if (currentDiv != null)
   {
      if (NS)
         currentDiv.left = linkLeft + 200
      if (IE)
         currentDiv.style.left = linkLeft + 200
   }

   if (NS)
      infobottom = currentDiv.innerHeight + 200
   if (IE)
      infobottom = currentDiv.clientHeight + 200

   maxbottom = linkbottom + 20
   if (infobottom > maxbottom)
      maxbottom = infobottom + 20
   if (theWindHt - 85 > maxbottom)
      maxbottom = theWindHt - 85
    
   if (NS)
   {  
      footer.top = maxbottom
      footer.left = linkLeft
   }
   if (IE)
   {
      footer.style.top = maxbottom
      footer.style.left = linkLeft
   }
  
   space = maxbottom - 580
   if (space <= 25)
      space = 25

   if (NS)
      document.linkboxspacer.height = space
   if (IE)
      document.all.linkboxspacer.height = space
}

function setuppage(link)
{
   if (NS)
   {
      var whynbccn = document.whynbccn
      var whoweare = document.whoweare
      var ourmission = document.ourmission
      var weekly = document.weekly
      var upcoming = document.upcoming
      var links = document.links
      var contact = document.contact
      var bulletin = document.bulletin
      var newsletter = document.newsletter
      var linkbox = document.linkbox
      var footer = document.footer
      var weeklyupd = document.weeklyupd
   }

   if (IE)
   {
      var whynbccn = document.all.whynbccn
      var whoweare = document.all.whoweare
      var ourmission = document.all.ourmission
      var weekly = document.all.weekly
      var upcoming = document.all.upcoming
      var links = document.all.links
      var contact = document.all.contact
      var bulletin = document.all.bulletin
      var newsletter = document.all.newsletter
      var linkbox = document.all.linkbox
      var footer = document.all.footer
      var weeklyupd = document.all.weeklyupd
   }

   if (NS)
      linkbottom = linkbox.innerHeight + 200
   if (IE)
      linkbottom = linkbox.clientHeight + 200

   makeVisible(link)
}

