﻿
function jsCreateRenderDiv(strPage)
{
  var bOK = true;
  
  // Have to add the ActiveX controls to the document,
  // because otherwise they can't access browser properties.
  
  // strPage is the calling page.
  //  - If set, failure results in a redirect to failed.asp.
  //  - If not set, just returns false if it fails.
  
  objRender = document.createElement('object');
  divRender.appendChild(objRender);
  divRender.style.visibility = "hidden";

  try {
    objRender.classid= "clsid:63524C90-850D-49E3-A595-7A92799647D6";
  } catch (e) {
    bOK = false;
    if (strPage != "")
      window.navigate("failed.asp?from=" + strPage + "&err=No%20render%20control");
  }

  if (bOK && objRender.getLastSettings() == "notallowed") {
    bOK = false;
    window.navigate("failed.asp?from=" + strPage + "&err=Render%20control%20not%20allowed%20on%20this%20site");
  }
  
  return bOK;
}

function jsCreateSupportDiv(strPage, objDiv)
{
  var bOK = true;
  var bAllowed = true;
  
  // Have to add the ActiveX controls to the document,
  // because otherwise they can't access browser properties:
  
  // strPage is the calling page.
  //  - If set, failure results in a redirect to failed.asp.
  //  - If not set, just returns false if it fails.

  objSupport = document.createElement('object');
  objDiv.appendChild(objSupport);
  objDiv.style.visibility = "hidden";

  try {
    objSupport.classid= "clsid:D66C259A-3B25-41C5-9B01-BEA5A8DBE443";
    bAllowed = (objSupport.GetPCSerial() != "notallowed");
  } catch (e) {
    bOK = false;
    if (strPage != "")
      window.navigate("failed.asp?from=" + strPage + "&err=No%20support%20control");
  }

  if (bOK && !bAllowed) {
    bOK = false;
    window.navigate("failed.asp?from=" + strPage + "&err=Support%20control%20not%20allowed%20on%20this%20site");
  }
  
  return bOK;
}

