
function showPleaseWait(){
    document.getElementById('pleasewait').style.display = 'block';
    var coll = document.getElementsByTagName('SELECT');
    for (i=0; i<coll.length; i ++){
      coll[i].style.visibility = 'hidden';
    }
    setTimeout('document.getElementById(\'pleasewait_anim\').src = document.getElementById(\'pleasewait_src\').value;', 111);
    return true;
}

function hidePleaseWait(){
    document.getElementById('pleasewait').style.display = 'none';
    var i = 0;
    var coll = document.getElementsByTagName('SELECT');
    for (i=0; i<coll.length; i ++){
      coll[i].disabled='';
      coll[i].style.visibility = '';
    }
}

function printStackTrace() {
      var callstack = [];
      var isCallstackPopulated = false;
      try {
        i.dont.exist+=0; //doesn't exist- that's the point
      } catch(e) {
        if (e.stack) { //Firefox
          var lines = e.stack.split('\n');
          for (var i=0, len=lines.length; i<len; i++) {
            if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
              callstack.push(lines[i]);
            }
          }
          //Remove call to printStackTrace()
          callstack.shift();
          isCallstackPopulated = true;
        }
        else if (window.opera && e.message) { //Opera
          var lines = e.message.split('\n');
          for (var i=0, len=lines.length; i<len; i++) {
            if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
              var entry = lines[i];
              //Append next line also since it has the file info
              if (lines[i+1]) {
                entry += ' at ' + lines[i+1];
                i++;
              }
              callstack.push(entry);
            }
          }
          //Remove call to printStackTrace()
          callstack.shift();
          isCallstackPopulated = true;
        }
      }
      if (!isCallstackPopulated) { //IE and Safari
        var currentFunction = arguments.callee.caller;
        while (currentFunction) {
          var fn = currentFunction.toString();
          var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('')) || 'anonymous';
          callstack.push(fname);
          currentFunction = currentFunction.caller;
        }
      }
      alert(callstack.join('\n\n'));
    }


function alertED(s) {
  alert(ED(s));
}
function confirmED(s) {
  return confirm(ED(s));
}
function ED(s) {
    var e, n, v;

    // Look for entities to decode
    if (/&[\w#]+;/.test(s)) {
      // Decode the entities using a div element not super efficient but less code
      e = document.createElement("div");
      e.innerHTML = s;
      n = e.firstChild;
      v = '';
      if (n) {
        do {
          v += n.nodeValue;
        } while (n = n.nextSibling);
      }
      return v || s;
    }
    return s;
}


