<%@language = "javascript" %>
<% /*
     $Revision$
     $Id$

   Parameters:
    - lang (required): the language code (e.g. NL)

   Sets the current application language to 'lang' and also
   stores the language 'lang' with the user's data in the database

*/
var JSON_Result = true;
%>

<!--#include file="../Shared/common.inc"-->
<%
protectRequest.validateToken();
    var plang = getQParamSafe('lang');

    for (i in S("language_toggles"))
    {
        if (S("language_toggles")[i] == plang)
        {
            sql = "UPDATE prs_perslid SET prs_perslid_lang = "+ safe.quoted_sql(plang)
                + " WHERE prs_perslid_key = " + user_key;
            Oracle.Execute(sql);
            Session("user_lang") = "" + plang;
        }
    }

    Response.Write(JSON.stringify({ success: true }));
%><% ASPPAGE_END(); %> 
