<HTML>
<HEAD>
<TITLE>Exitau</TITLE>
<script LANGUAGE="JavaScript" TYPE="text/javascript">

  function sendData() {

    if ((top.dataFrame.document.body) && (top.dataFrame.document.body.innerHTML!="")) {
      theReply=top.dataFrame.document.body.innerHTML;

      // If there is an error then display an alert.
      if (theReply.indexOf("error=0")==-1) {
        alert("An error was returned from the LMS server:\n\n  " + theReply);

      // Otherwise call exitau and  close the window.
      } else {
        top.exitFrame.document.location=exitStr;

      }

    } else {
      setTimeout("sendData()",100);

    }


  }

  //////////////////////////////////////////////////////////
  //
  //////////////////////////////////////////////////////////

  function sendExitAu() {
    if ((top.exitFrame.document.body) && (top.exitFrame.document.body.innerHTML!="")) {
      theReply=top.exitFrame.document.body.innerHTML;

      // If there is an error then display an alert.
      if (theReply.indexOf("error=0")==-1) {
        alert("An error was returned from the LMS server:\n\n  " + theReply);

      // Close the window.
      } else {
        close();

      }

    } else {
      setTimeout("sendData()",100);

    }

  }

  //////////////////////////////////////////////////////////
  //
  //////////////////////////////////////////////////////////

  function getURLParam(theUrl, theParam) {
    theVal=new String("");

    // If the parameter is not in the url then return empty.
    if (theUrl.indexOf(theParam)==-1) return theVal;

    theVal=theUrl.substring(theUrl.indexOf(theParam));
    theVal=theVal.substring(theVal.indexOf("=")+1);

    if (theVal.indexOf("&")!=-1)
      theVal=theVal.substring(0,theVal.indexOf("&"));

    return theVal;

  }

  loc=new String(document.location);

  fwd=getURLParam(loc, "fwd");
  aiccUrl=getURLParam(loc, "url");
  aiccSid=getURLParam(loc, "session_id");
  aiccData=getURLParam(loc, "aicc_data");

  exitStr=fwd + "?url=" + aiccUrl + "&session_id=" + aiccSid + "&command=exitau&version=2.0";
  sendStr=fwd + "?url=" + aiccUrl + "&session_id=" + aiccSid + "&command=putParam&version=2.0&aicc_data=" + aiccData;

  // Create the frameset.
  dhtml="";
  dhtml+="<frameset rows=\"50,50\" framespacing=\"0\" border=\"0\" frameborder=\"no\">";
  dhtml+="<frame onload=\"top.sendData()\" noresize=\"true\" scrolling=\"no\" src=\"" + sendStr + "\" name=\"dataFrame\">";
  dhtml+="<frame onload=\"top.sendExitAu()\" noresize=\"true\" scrolling=\"no\" src=\"about:blank\" name=\"exitFrame\">";
  dhtml+="</frameset>";
  document.write(dhtml);

</script>

</HEAD>
</HTML>
