<%@ page import = "java.util.*" %>

<html>
<head>
    <meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
    <title>datango Trainer POSTed start</title>
</head>

<script language=javascript>
    // Enter the correct trainer name here!
    // Do not add URL parameters here! They are handled automatically.
    var trainerUrl = "http://jupiter.wlan.ahr.de/t432/frameset.html";

    // If you urgently need fixed URL parameters, put them here as
    // initial content of the arrays:
    var paramNames = [];
    var paramValues = [];

<%
Enumeration params = request.getParameterNames();
while (params.hasMoreElements()) {
    String paramName = (String)params.nextElement();
    String paramValue = request.getParameter(paramName);

    // In 1.4ff this may be done more simply using Regexp.
    // This is a temp. solution until I find out how to use 
    // functions in JSP ... pa, 17.12.03
    // replace LF with JS escape sequence "\n"
    // replace CR with JS escape sequence "\r"

    String value = "";
    int oldPos = 0;
    int pos = paramValue.indexOf('\n');

    if (pos < 0) {
        out.println("// pos 0");
    }

    while (pos >= 0) {
        value += (paramValue.substring(oldPos, pos) + '\\' + 'n');
        oldPos = pos + 1;
        pos = paramValue.indexOf('\n', oldPos);
    }
    paramValue = value + paramValue.substring(oldPos);
    value = "";
    oldPos = 0;
    pos = paramValue.indexOf('\r');

    while (pos >= 0) {
        value += (paramValue.substring(oldPos, pos) + '\\' + 'r');
        oldPos = pos + 1;
        pos = paramValue.indexOf('\r', oldPos);
    }
    paramValue = value + paramValue.substring(oldPos);
    %>
    paramNames[paramNames.length] = "<%= paramName %>";
    paramValues[paramValues.length] = "<%= paramValue %>";
    <%
}
%>

var queryString = '';
for (var i = 0; i < paramNames.length; ++i) {
    queryString += (i == 0 ? "?" : "&");
    queryString += (paramNames[i] + '=' + escape(paramValues[i]));
}

alert('datango Trainer POSTed start: Redirecting to "' + trainerUrl + queryString + '"');
self.location.replace(trainerUrl + queryString);

</script>
</html>
<!--
  Copyright Notice:

  Copyright 2000-2005 datango AG
  ALL RIGHTS RESERVED

  UNPUBLISHED - Use of a copyright notice is precautionary only and
  does not imply publication or disclosure.

  THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  INFORMATION OF DATANGO AG. ANY DUPLICATION, MODIFICATION,
  DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS
  STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF
  DATANGO AG.  -->
