// Initial and alternate images.
var imgOrig = new Image()
var imgNew = new Image()

function init(person)
{
  if (person == "DaveG")
  {
    var e = document.getElementById("idMailto")
    var x = new Array("mai", "lto", ":")
    var y
    y = new Array("da", "ve", "grund", "gei", "ger", "@", "ho", "tma", "il.c", "om");
    var n = ""
    for (var i = 0; i < y.length; i++)
      n += y[i]
    m = ""
    for (var i = 0; i < x.length; i++)
      m += x[i]
    m += n
    e.setAttribute("href", m)
    e.innerHTML = n
  }

  // Store initial image names for all profiles.
  var imgMain = new Array();
  imgMain["MikeB"]  = "MikeB.jpg"
  imgMain["DavidW"] = "DavidW.jpg"
  imgMain["DaveG"] = "DaveG.jpg"
  imgMain["JudyJ"] = "JudyJ.gif"
  imgMain["AndyW"] = "AndyW.jpg"
  imgMain["LingW"] = "LingW.jpg"
  imgMain["JeannieB"] = "JeannieB.jpg"
  imgMain["DarcieG"] = "DarcieG.jpg"
  imgMain["WayneS"] = "WayneS.gif"
  imgMain["KevinM"] = "KevinM.jpg"
  imgMain["JohnC"] = "JohnC.jpg"

  // Store alternate image names for all profiles.
  var imgAlt = new Array();
  imgAlt["MikeB"]  = "MikeB-Alt.jpg"
  imgAlt["DavidW"] = "DavidW-Alt.jpg"
  imgAlt["DaveG"] = "DaveG-Alt.jpg"
  imgAlt["JudyJ"] = "JudyJ-Alt.jpg"
  imgAlt["AndyW"] = "AndyW-Alt.jpg"
  imgAlt["LingW"] = "LingW.jpg"
  imgAlt["JeannieB"] = "JeannieB-Alt.jpg"
  imgAlt["DarcieG"] = "DarcieG.jpg"
  imgAlt["WayneS"] = "WayneS.gif"
  imgAlt["KevinM"] = "KevinM-Alt.jpg"
  imgAlt["JohnC"] = "JohnC.jpg"

  // Prefix "img/" to all image names.
  for (s in imgMain)
    imgMain[s] = "img/" + imgMain[s]
  for (s in imgAlt)
    imgAlt[s] = "img/" + imgAlt[s]

  // Load appropriate image names for current profile (passed in).
  imgOrig.src = imgMain[person]
  imgNew.src = imgAlt[person]

  // Choose random index into array of six colors.
  var Colors = new Array("#000099", "#006600", "#880000", "#404040", "#D07000", "#00A090")
  //                      DarkBlue   DarkGreen  Red         Gray      Orange     Cyan

  // Generate random int in range 0 - 5 based on time.
  var d = new Date()
  var s = d.getSeconds() % 6

  // Set ProfileName strip background to random color.
  var profileName = document.getElementById("ProfileName")
  profileName.style.background = Colors[s]

  // Set image frame color accordingly.
  var imageCell = document.getElementById("ImageCell")
  if (imageCell != null)
    imageCell.style.border = "1px solid " + Colors[s]

  // Set article frame color accordingly.
  var articleFrame = document.getElementById("ArticleFrame")
  articleFrame.style.border = "1px solid " + Colors[s]
}

function ImageClick(e)
{
  // When Ctrl+Click image, replace with alternate image.
  //  When Shift+Click image, revert to original image.
  if (window.event.ctrlKey)
    imgPerson.src = imgNew.src
  if (window.event.shiftKey)
    imgPerson.src = imgOrig.src
}
