function show(img, w, h) {
  var ew = w, eh = h, dw = 0, dh = 0;
  if (ew > 800) { ew = 800; dh = 16; }
  if (eh > 600) { eh = 600; dw = 16; }
  var ww = window.open('','Image','width='+(ew + dw)+',height='+(eh + dh)+',scrollbars='+(w > 800 || h > 600 ? 'on' : 'no'));
  ww.document.open();
  ww.document.writeln("<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0><img src=\""+img+"\" width="+w+" height="+h+" onClick='window.close()'>");
  ww.document.close();
}
function hide(id) {
  var el = document.getElementById(id);
  if (el) el.style.display = 'none';
}
function toggle(id) {
  var el = document.getElementById(id);
  if (el) {
    el.style.display = el.style.display == 'none' ? '' : 'none';
    if (el.style.display == '') el.focus();
  }
}
function popup(s) {
  window.open(s, '', 'width=680,height=670,scrollbars=1');
}

/* ------------------ */
/*
function return_true() { return true; }
function return_false() { return false; }
function handle_click_ns(e) { return (e.which < 2 || e.which > 3); }
function handle_select_ns(e) { return false; }

if (document.all) { 
  document.oncontextmenu = return_false;
  document.onselectstart = return_false;
}
else if (document.layers || document.getElementById) {
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = handle_click_ns;
  } else {
    document.onmouseup = handle_click_ns;
    document.oncontextmenu = return_false;
  }
  if (window.sidebar){
    document.onmousedown = handle_select_ns;
    document.onclick = return_true();
  }
}
*/
function toggle_messages() {
  var el = document.getElementById("messages_box");
  if (el) {
    el.style.display = el.style.display == 'none' ? 'inline' : 'none';
    if (el.style.display != 'none') el.focus();
  }
}
function close_messages(evt) {
  var el = document.getElementById("messages_box");
  if (evt) {
    if (evt.srcElement && evt.srcElement.id && evt.srcElement.id == "post_it") el = null;
      else if (evt.target && evt.target.id && evt.target.id == "post_it") el = null;
  }
  if (el) {
    el.style.display = 'none';
  }
}
