
//----- Begin include-bestand "scripts.js": -----

//------ Maandnamen en -lengte: ------------
function objMaand (Naam, MaxDgn)
{
  this.Naam = Naam;
  this.MaxDgn = MaxDgn;
  return (this);
}
var Maanden = Array(new objMaand ("aug.",  31), new objMaand ("sept.", 30), new objMaand ("okt.", 31),
                    new objMaand ("nov.",  30), new objMaand ("dec.",  31), new objMaand ("jan.", 31), 
                    new objMaand ("febr.", 28), new objMaand ("mrt.",  31), new objMaand ("apr.", 30),
                    new objMaand ("mei",   31), new objMaand ("juni",  30), new objMaand ("juli", 31));

//------ StijlInstellen (): -------------------
/* invoer: Selector = tagnaam of classnaam
           Regel = stijlregel (gedeelte dat tussen de accolades komt, maar zonder de accolades zelf)
*/
/*
function StijlInstellen (Selector, Regel)
{
  if (Regel.trim() == "")       // lege string geeft problemen in MSIE (6.0)!
  {
    return;
  }
  var DocHead = document.getElementsByTagName ("head")[0];
  var Stijlregel = document.createElement ("style");
  Stijlregel.type = "text/css";
  DocHead.appendChild (Stijlregel);
  if (navigator.appName.indexOf ("Internet Explorer") > -1)
  {
    var N = document.styleSheets.length;
    var Stijlblad = document.styleSheets [N - 1];            // laatste in de rij
    Stijlblad.addRule (Selector, Regel);
  }
  else
  {
    var Stijltekst = document.createTextNode (Selector + " { " + Regel + " } ");
    Stijlregel.appendChild (Stijltekst);
  }
}    // "StijlInstellen ()"
*/

//------ StijlbladPlaatsen (): ------------------------
function StijlbladPlaatsen (Stijlblad)
{
  var DocHead = document.getElementsByTagName ("head")[0];
  var Link = document.createElement ("link");
  DocHead.appendChild (Link);
  Link.type = "text/css";
  Link.rel = "stylesheet";
  Link.href = Stijlblad;
  
}    // "StijlbladPlaatsen ()"

//------- GetComputedStyle_HI (): -----
function GetComputedStyle_HI (Elem)
{
//  if (navigator.appName.toLowerCase().indexOf ("internet explorer") >= 0)
  if (Elem.currentStyle)
  {
    return (Elem.currentStyle);
  }
  if (window.getComputedStyle)
  {
    return (window.getComputedStyle (Elem, ""))
  }
  return (null);
}    // "GetComputedStyle_HI ()"

//------ ScrollstandBepalen (): ----------------------
// Bron: http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
function ScrollstandBepalen ()
{
  var x = -1, x_Win = -1, x_DocEl = -1, x_DocBody = -1;
  var y = -1, y_Win = -1, y_DocEl = -1, y_DocBody = -1;
  var M = "";

  if ( (window.pageXOffset) &&
       (window.pageYOffset)    )
  {
    x_Win = parseInt(window.pageXOffset);
    y_Win = parseInt(window.pageYOffset);
    M += "Win ";
  }
  else if ( (document.documentElement           ) &&
            (document.documentElement.scrollTop ) &&
            (document.documentElement.scrollLeft)    )
  {
    x_DocEl = parseInt(document.documentElement.scrollLeft);
    y_DocEl = parseInt(document.documentElement.scrollTop);
    M += "DocEl ";
  }    // o.a. Firefox, IE5
  else if (document.body)
  {
    x_DocBody = parseInt(document.body.scrollLeft);
    y_DocBody = parseInt(document.body.scrollTop);
    M += "DocBody ";
  }    // o.a. IE6

  x = (x_Win > -1) ? x_Win : 0;
  y = (y_Win > -1) ? y_Win : 0;
  if ((x_DocEl > -1) && (!x || (x > x_DocEl)))
  {
    x = x_DocEl;
    y = y_DocEl;
  }
  x = ((x_DocBody > -1) && (!x || (x > x_DocBody))) ? x_DocBody : x;
  y = ((y_DocBody > -1) && (!y || (y > y_DocBody))) ? y_DocBody : y;
  this.x = x;
  this.y = y;
  this.M = M;
  return (this);

}    // "ScrollstandBepalen ()"

//------ Beginhoofdletter (): -------------------------
function Beginhoofdletter (Str)
{
  var Ch, T;
  Ch = Str.substr (0, 1);
  T = Str.substr (1);
  return (Ch.toUpperCase() + T);
  
}    // "Beginhoofdletter ()"

//------ CreateChildText (): ------------------------
function CreateChildText (Parent, Text)
{
  var TextNode = document.createTextNode (Text);
  Parent.appendChild (TextNode);
  return (TextNode);

}    // "CreateChildText ()"

//------ GetOuterHTML (): -----------------
function GetOuterHTML (Elem)
{
  if (navigator.appName.indexOf ("Internet Explorer") > 0)
  {
    return Elem.outerHTML;
  }
  var Elem2 = Elem.ownerDocument.createElement("body");
  Elem2.appendChild(Elem.cloneNode(true));
  return Elem2.innerHTML;

}    // "GetOuterHTML ()"

//------ Duizendscheiders (): --------------------
/* Plaatst een punt na elk duizendtal.
   In:  N = getal
   Uit: return getal met duizendscheiders (string)
*/
function Duizendscheiders (N)
{
  var Ns = "" + N;             // string
  var L = Ns.length;
  var i, j, T;
  j = (L % 3);
  T = "";
  for (i = 0; i < L; i++)
  {
    if (j == 0)
    {
      if (T != "")
      {
        T += ".";
      }
      j = 3;
    }
    T += Ns.charAt (i);
    j--;
  }
  return (T);
}    // Duizendscheiders ()

//------ Timestamp_DD_MM_JJJJ_hh_mm_ss (): ---------------
/* Converteert Unix timestamp naar datum en tijd.
   In:  Ts = timestamp (hele seconden sinds 01-01-1970, 00.00.00 UTC).
   Uit: return dd-mm-jjjj hh.mm.ss (string).
*/
function Timestamp_DD_MM_JJJJ_hh_mm_ss (Ts)
{
  var Dtm = new Date (1000 * Ts);
  var Jr = Dtm.getFullYear();
  var Md = 1 * Dtm.getMonth() + 1;
  var Dg = 1 * Dtm.getDate();
  var Hr = 1 * Dtm.getHours();
  var Mn = 1 * Dtm.getMinutes();
  var Sc = 1 * Dtm.getSeconds();
  Jr = "" + Jr;
  Md = (Md < 10) ? "0" + Md : "" + Md;
  Dg = (Dg < 10) ? "0" + Dg : "" + Dg;
  Hr = (Hr < 10) ? "0" + Hr : "" + Hr;
  Mn = (Mn < 10) ? "0" + Mn : "" + Mn;
  Sc = (Sc < 10) ? "0" + Sc : "" + Sc;
  return (Dg + "-" + Md + "-" + Jr + " " + Hr + "." + Mn + "." + Sc);
  
}    // Timestamp_DD_MM_JJJJ_hh_mm_ss ()

//------ Timestamp_DD_MM_JJJJ (): ---------------
/* Converteert Unix timestamp naar alleen de datum.
   In:  Ts = timestamp (hele seconden sinds 01-01-1970, 00.00.00 UTC).
   Uit: return dd-mm-jjjj (string).
*/
function Timestamp_DD_MM_JJJJ (Ts)
{
  var Dtm = new Date (1000 * Ts);
  var Jr = (1 * Dtm.getFullYear());
  var Md = (1 * Dtm.getMonth() + 1);
  var Dg = (1 * Dtm.getDate());
  Jr = "" + Jr;
  Md = (Md < 10) ? "0" + Md : "" + Md;
  Dg = (Dg < 10) ? "0" + Dg : "" + Dg;
  return (Dg + "-" + Md + "-" + Jr);
  
}    // Timestamp_DD_MM_JJJJ ()

//------- AlleenCijfers (): ------------------------
function AlleenCijfers (Str)
{
  return (Str.replace (/[^0-9]/g, ""));
}
//------- TfnrValideren (): ------------------------
function TfnrValideren (Tfnr)
{
  var i, L, Ch, N = 0, Nmin;
  var Toegestaan = "-. ";
  Tfnr = Tfnr.trim();
  Nmin = (Tfnr.charAt(0) == "0") ? 10 : 7;
  if (Tfnr.charAt(0) == "+")            // buitenland
  {
    Tfnr = Tfnr.substr (1);
    Nmin = 9;
  }
  L = Tfnr.length;
  for (i = 0; i < L; i++)
  {
    Ch = Tfnr.charAt (i);
    if ((Ch >= "0") && (Ch <= "9"))
    {
      N++;
    }
    else if (Toegestaan.indexOf (Ch) < 0)
    {
      return (0);                       // ongeldig teken
    }
  }
  return (N >= Nmin);
  
}    // TfnrValideren ()

//------- Uitbreidingen voor String-object in Javascript: -----

String.prototype.trim = function()
{
  return (this.replace(/^\s+|\s+$/g,""));
}

String.prototype.ltrim = function()
{
  return (this.replace(/^\s+/,""));
}

String.prototype.rtrim = function()
{
  return (this.replace(/\s+$/,""));
}

String.prototype.insert = function (i, text)
{  // Inserts a string [text] into a string object at position [i].
  return (this.substr (0, i) + text + this.substr (i));
}

//-------- String.prototype.cmp_wc (): -------------------------
/* Compares string with a pattern that may contain wildcard characters.
   Input:     Pttrn = pattern (may include wildcards) with which the string is to be compared
   Output:    boolean true if Pttrn matches the complete the string, otherwise false
   Windcards: "?"     for one and only one character
              "*"     for zero or more characters
              "(xyz)" for zero or more times "xyz"
*/
String.prototype.cmp_wc = function(Pttrn)
{
  // Replace spaces and hyphens in (copy of) string by "-":
  var Str = this.replace (/\s/g, "-");              // spaces to "-"
  Str = Str.replace (/-+/g, "-");                   // multiple "-" to single ones

  // Replace spaces and hyphens in Pttrn by "-":
  Pttrn = Pttrn.replace (/\s/g, "-");               // spaces to "-"
  Pttrn = Pttrn.replace (/-+/g, "-");               // multiple "-" to single ones

  // Convert Pttrn to real regexp:
  Pttrn = Pttrn.replace (/\?/g, "\\S\?");           // "?": one and only one character
  Pttrn = Pttrn.replace (/\*/g, "\\S\*");           // "*": zero or more characters
  Pttrn = Pttrn.replace (/\((\S*?)\)/g, "\$1\?");   // (xy): for zero or more times "xyz" ("*?" = "non-greedy")
                                                    // (must be the last one, otherwise "?" converted again)
  Pttrn = "^" + Pttrn + "$";                        // enforce testing complete string

  // test with regexp:
  var i = Str.search (Pttrn);                       // >= 0 if found
  return (i >= 0);

}    // "strcmp_wc ()"

//------ Waarde(): ---------------------
function Waarde(s)         // Geeft het getal waarmee een string begint
{                          // Bijv.: "10px" geeft "10"
  var i, L, Ch, W = 0;
  L = s.length
  for (i = 0; i < L; i++)
  {
    Ch = 1 * s.charAt(i);
    if ((Ch >= 0) || (Ch <= 9))
    {
      W = (W * 10) + Ch;
    }
    else
    {
      break;
    }
  }
  return (W);
}    // Waarde()

//------ JS_GroepInGroepen(): --------------------
function JS_GroepInGroepen (Groep, Groepen)
{
  var Groep_, GroepenArr, i, N;
  Groep_ = String(Groep).trim();
  GroepenArr = String(Groepen).split (",");
  N = GroepenArr.length;
  for (i = 0; i < N; i++)
  {
    if (Groep_ == GroepenArr[i].trim())
    {
      return (1);
    }
  }
  return (0);

}    // JS_GroepInGroepen()

//------ ReturnTrue (): --------------------------------
function ReturnTrue()
{
  return (true);
}

//------ EmlStarten (): --------------------------------
/* input:  Eigennaam: "gewone"naam
           Naamdeel:  gedeelte van adres voor "@"
           Dmn:       gedeelte van adres na "@" (domeinnaam + uitgang)
                      (optioneel; indien niet opgegeven, wordt de standaard-domeinnaam gebruikt)
           Owp:       onderwerp (optioneel)
           Inh:       inhoud van het te genereren bericht (optioneel)
   output: e-mailprogramma wordt gestart
*/
function EmlStarten (Eigennaam, Naamdeel, Dmn, Owp, Inh)
{
  if (Dmn === undefined) { Dmn = ""; }
  if (Owp === undefined) { Owp = ""; }
  if (Inh === undefined) { Inh = ""; }

  var T, N;
  var T = "mailto:%22" + Eigennaam + "%22 <" + Naamdeel + "%40";
  if (Dmn == "")
  {
    T += StdDomeinnaam + ">";
  }
  else
  {
    T += Dmn + ">";
  }
  N = 0;
  if (Owp != "")
  {
    T += "?subject=" + encodeURI (Owp);
    N++;
  }
  if (Inh != 0)
  {
    T += (N == 0) ? "?" : "&";
    T += "body=" + encodeURI (Inh);
  }
  window.location.href = T;
}    // EmlStarten ()

//------ HtmlAnsi (): -----------------------
/* Vooral t.b.v. tekst op titelbalk website. Verschillende ANSI-codes boven
   de &#128; worden daar niet juist weergegeven.
*/
function HtmlAnsi (Tekst)
{
  Tekst = Tekst.replace (/&bdquo;/g, "„");
  Tekst = Tekst.replace (/&rdquo;/g, "”");
  Tekst = Tekst.replace (/&lsquo;/g, "‘");
  Tekst = Tekst.replace (/&rsquo;/g, "’");
  Tekst = Tekst.replace (/&ndash;/g, "–");
  Tekst = Tekst.replace (/&mdash;/g, "–");
  Tekst = Tekst.replace (/&shy;/g, "");
  Tekst = Tekst.replace (/&#47;/g, "/");
  Tekst = Tekst.replace (/&#150;/g, "--");
//*** LET OP: MSIE 6.0 kan niet tegen de volgende regel: ***
//  Tekst = Tekst.replace (/–/g, "--");
  return (Tekst);

}    // "HtmlAnsi ()"

//------ AcroreadDownloader (): -----------------------
function AcroreadDownloader (HAlign, Marge)
{
  var tTitle = "Nieuwste versie van Adobe Reader downloaden";
  if (Taalcode == 1)
  {
    tTitle = "Download latest version of Adobe Reader";
  }
  return ("<a href = \"http://www.adobe.com/nl/products/acrobat/readstep2.html\" " +
          "   style = \"border: 0px;\" rel = \"external\">" +
          "<img src = \"fileadmin/afbeeldingen/get_adobe_reader.gif\" alt = \"\"\"" +
          "     align = \"" + HAlign + "\" style = \"" + Marge + " border: 0px;\"" +
          "     title = \"" + tTitle + "\"></a>");
}    // "AcroreadDownloader ()"

//------------------------------------------------

//----- Einde include-bestand "scripts.js" -----

