// check if we are in quirks mode and alert the user to the fact as we are
// supposed to be in standards mode
if (document.compatMode && document.compatMode != "CSS1Compat") {
  alert("Standards-compliant mode is not switched on.\nThis page requires IE to be in standard compliant mode.\nCurrent compliancy mode is: "+document.compatMode);
}

// Open a popup window
function popupWin(url, width, height, attrs, target) {
  win = window.open(url, target|'_blank',
    'height=' + height + ',' +
    'width=' + width + ',' +
    'status=1,resizable=1,scrollbars=1' + attrs);

  if (!win) {
    alert('Please disable any popup blockers for this site');
  } else {
    win.opener = window;
    win.focus();
  }
}

// Open a div panel
function openDiv(id, toggle) {
  if (document.getElementById) {
    var elm = document.getElementById(id);
    if (elm) {
      if (typeof Effect == 'object') {
        Effect.toggle(id, 'slide');
      } else {
        elm.style.display = ((!toggle || elm.style.display != 'block') ? 'block' : 'none');
      }
      return true;
    }
  }
  return false;
}

// Close a div panel
function closeDiv(id) {
  if (document.getElementById) {
    var elm = document.getElementById(id);
    if (elm) {
      if (typeof Effect == 'object') {
        Effect.SlideUp(id);
      } else {
        elm.style.display = 'none';
      }
      return true;
    }
  }
  return false;
}

function wsw_onload() {

  // The popup panels are set to invisible in the CSS as the Effects code will
  // not work if the CSS sets them to 'display: none;'. So after loading the
  // page we set them to not display and then set them visible.
  if (typeof Element != 'undefined') {
    var elm = $('wsw-user-panel');
    Element.hide(elm);
    elm.style.visibility = 'visible';
  }
}
