<%@ Language=JavaScript %>
<% /*
     $Revision$
     $Id$
     
     Dit bestand maakt het mogelijk voor gebruikers van Facilityplace
     om via SingleSignOn toegang te krijgen.
*/ %>
<%Response.Expires=0;%>
<html>
<%

var base64=[
'A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z',
'0','1','2','3','4','5','6','7','8','9','+','/' ];

function encode (Str) { 
    var charCodes = new Array(); 
    var encStr = ""; 

    for (var i = 0; i < Str.length; i += 3) { 
        /* grab groups of three characters, 24 bits, then split into 
           4 groups of 6 bits, and use each group as an index into 
           base64[] to get the encoded character */ 


        /* bits24 is 3 groups of 8-bit characters */ 
        var bits24  = ( Str.charCodeAt(i)     ) <<  16; 
        if ( Str.substr(i + 1, i + 2) ) { 
            bits24 |= ( Str.charCodeAt(i + 1) ) <<   8; 
        } 
        else { 
            bits24 |= ( 0 )                     <<   8; 
        } 
        if ( Str.substr(i + 2, i + 3) ) { 
            bits24 |= ( Str.charCodeAt(i + 2) ) <<   0; 
        } 
        else { 
            bits24 |= ( 0 )                     <<   0; 
        } 
        encStr += base64[ (bits24 >>> 18) & 0x3F ]; 
        if ( (bits24 >>> 12) & 0x3F ) { 
            encStr += base64[ (bits24 >>> 12) & 0x3F ]; 
        } 
        else { 
            encStr += '='; 
        } 
        if ( (bits24 >>> 6) & 0x3F ) { 
            encStr += base64[ (bits24 >>>  6) & 0x3F ]; 
        } 
        else { 
            encStr += '='; 
        } 
        if ( (bits24 >>> 0) & 0x3F ) { 
            encStr += base64[ (bits24 >>>  0) & 0x3F ]; 
        } 
        else { 
            encStr += '='; 
        } 
   } 
   return encStr;
} 

var user = '' + Request.ServerVariables("REMOTE_USER");
if (user =='' || user=='undefined') {   
  user = '' + Request.ServerVariables("HTTP_USER");
  if (user =='' || user=='undefined') {
    user =='';
  }
}

//user = 'xxx';
%>

<head>
</head>
<body onload="document.all.facilitor.submit();">
  <form name="facilitor" action="http://allv.facilityplace.nl/default.asp?fac_id=allv" method=post>
    <input type="hidden" name="UID" value="<%=encode(user)%>">
  </form>
</body>
</html>
