// Hilite functions
function hiliteImgTxt(i) {
  if (document.getElementById) {
    document.getElementById("image"+i).style.borderColor = '#E8C061';
    document.getElementById("label"+i).style.color = '#E8C061';
  }
}
function unHiliteImgTxt(i) {
  if (document.getElementById) {
    document.getElementById("image"+i).style.borderColor = '#CCCCCC';
    document.getElementById("label"+i).style.color = '#CCCCCC';
  }
}
function hiliteButton(i) {
  if (document.getElementById) {
    var b = document.getElementById("button"+i);
    b.style.backgroundColor = '#E8C061';
    b.style.color = '#484E55';
  }
}
function unHiliteButton(i) {
  if (document.getElementById) {
    var b = document.getElementById("button"+i);
    b.style.backgroundColor = '#547291';
    b.style.color = '#CCCCCC';
  }
}
function scrollAllTheWayLeft() {
  if (self.scrollTo) {
    self.scrollTo(0,0);
    return false;
  } else if (self.scroll) {
    self.scroll(0,0);
    return false;
  }
  return true;
}
function calcPicWidth(elemId) {
  var elem = document.getElementById(elemId);
  var w = parseInt(elem.width);
  // Hacky!
  var pad = 0;
  if (elem.className == 'portfolioPhoto') {
      pad = 10;
  } else if (elem.className == 'insetSpacer') {
      pad = 50;
  }
  return w + pad;
}
function scrollPastPic(elemId) {
  scrollBy(calcPicWidth(elemId) + 50, 0);
}
function scrollBefoPic(elemId) {
  scrollBy(-calcPicWidth(elemId) - 50, 0);
}
function setImage(id, uri) {
  if (document.getElementById) {
    var img = document.getElementById(id);
    img.setAttribute('src', uri);
  } else if (document.images) {
    eval("document.images['" + id + "'].src = '" + uri + "'");
  }
}
function preloadImage(uri, width, height) {
  if (document.images) {
    var img = new Image(width, height);
    img.src = uri;
  }
}
