function getSessionContextVar() {
  var scvi = document.getElementById("showCtxVarInput").value;
  document.getElementById("showContextVar").innerHTML = scvi + " = " + window.parent.qpr.getSessionVariable(scvi);
}

function setSessionContextVar() {
  var scvni = document.getElementById("setCtxVarNameInput").value;
  var scvvi = document.getElementById("setCtxVarValueInput").value;
  parent.qpr.setSessionVariable(scvni, scvvi);
}

window.onload = () => {
  document.getElementById("showCtxVarButton").addEventListener("click", getSessionContextVar);

  document.getElementById("setCtxVarButton").addEventListener("click", setSessionContextVar);

  if (!window.parent.qpr.getSessionVariable || !window.parent.qpr.setSessionVariable) {
    document.body.innerHTML = "Session variable interface in parent frame is not available.";
  }
}
