var txt = new Array();

txt[0] = " ";
txt[1] = "Take me home.";
txt[2] = "Show me a list of beers you mug.";
txt[3] = "Where can I get my hands on this stuff.";
txt[4] = "If only I had time to read instead of drink.";
txt[5] = "Tell us how much you like good beer.";
txt[6] = "Drink this with your mates.";
txt[7] = "Now Wines as well?";

function show(i) {
  if (isEmpty(i)) return false;
  if ((i < 0) || (i >= txt.length)) return false;
  if (document.getElementById) {
    var elem = document.getElementById("comment");
    if (isEmpty(elem)) return false;
    clearElement(elem);
    elem.appendChild(document.createTextNode(txt[i]));
  }
}

function isEmpty(s){  
  return ((s == null) || (s.length == 0))
}

function clearElement(elem) {
  while (elem.childNodes.length >0) {
    elem.removeChild(elem.lastChild);
  }
  
  return;
}

function selectMood() {
  var val = "";
  if (document.getElementById) {
    var elem = document.getElementById("mood");
    if (elem.selectedIndex >= 0) { 
      val = elem.options[elem.selectedIndex].value;
    }
  }
  
  var oldURL = document.location["href"];
  if (oldURL.indexOf("?") > 0) {
    var newURL = oldURL.substr(0,oldURL.indexOf("?"));
  } else {
    var newURL = oldURL;
  }
  newURL += "?mood=" + val;
  
  document.location["href"] = newURL;
}
