var canstat = true, star = false
function setrating(n, pname) {
  setratestatus("Recording rating....")
  url = "http://christophernight.net/setrating.php?pname=" + pname + "&rating=" + n
  i = new Image()
  i.src = url
  setratestatus("Rating recorded!")
  if (canstat) {
    canstat = false
    setTimeout("canstat = true", 3000)
  }
  return false
}
function setstars(n) {
  if (!star) {
    star = new Object()
    star.cell = new Array()
    for (j = 1; j <= 4; ++j)
      star.cell[j] = document.getElementById("ratestar" + j)
    star.yellow = new Image()
    star.yellow.src = "../ratestar-yellow.png"
    star.gray = new Image()
    star.gray.src = "../ratestar-gray.png"
  }
  s = "Click to rate " + ["", "1/4 (bad)", "2/4", "3/4", "4/4 (good)"][n]
  if (n == 0) s = "Click on a star to rate"
  setratestatus(s)
  for (j = 1; j <= 4; ++j)
    star.cell[j].src = j <= n ? star.yellow.src : star.gray.src
}
function setratestatus(s) {
  if (!canstat) return
  document.getElementById("ratestatus").value = s
}

