// build a redirection form if redirection needed preferred to
// window.location.href = .... because with a form, we can use
// the POST method and thus have a "clean" URL in the browser
window.onload = function() {
   var root = "/", defaultPage = "mui.asp";
   var path =  window.parent.location.pathname;
   if (path != root && path.indexOf(root + defaultPage) < 0) {
      // parent windows is neither at the root URL or at mui.asp
      var pageStart = document.location.href.indexOf(root, 10) + root.length;
      var base = document.location.href.substring(0, pageStart);
      var page = document.location.href.substring(pageStart);
      // create new form to redirect
      var redirectForm = document.createElement("FORM");
      redirectForm.action = base + defaultPage;
      redirectForm.method = "POST"; // do not show url param
      // redirection parameter
      var contentParam = document.createElement("INPUT");
      contentParam.type = "hidden";
      contentParam.name = "content";
      contentParam.value = page;
      redirectForm.appendChild(contentParam);
      document.body.appendChild(redirectForm);
      redirectForm.submit();
   }
   else {
      // remove links if inside the site frameset
      var linkDiv = document.getElementById("links");
      if (linkDiv)
         document.body.removeChild(linkDiv);
   }
}
