<!--
  // REQUIRES:
  /*
     querystring_functions.js
  */
  
  

  // WHAT DOES THIS SCRIPT DO
  /*
    This script forces a page to load into a frameset. Though search engines see the page as not-framed, 
    visitors of the website will only be able to see it inside the correct frameset even though
    they open the page directly. 
  */
  

  
  // USAGE:
  /*
    1. 
      Put the function loadThisPageInFrameset in the body of the document which must
      be loaded into a frameset. 
      This function has two parameters (in this order): 
        - the URL of the top frameset
        - the name of the frame in which the page should be loaded
        
      example:
        <body onLoad="loadThisPageInFrameset('/frameset.htm', 'main');">
  
      You can also place this function within a <script> block *before* the body.
      
      example:
        <script language="JavaScript" type="text/javascript">
        <!--
          loadThisPageInFrameset('/frameset.htm', 'main');
        //-->
        </script>
        <body>

  
  
    2. 
      Now the frameset will be opened when the page loads when this page is
      not in the frameset. 
      The frameset receives the url and the name of the frame. 
      The frameset should now actually open the url into the correct frame. 
      This is done by putting the function loadURLFromQueryStringInThisFrameset()
      into the onLoad of the frameset.
      
      example:
        <frameset onLoad="loadURLFromQueryStringInThisFrameset()">
        
        
        
        
        
        
  */  
  









  // settings
  
  iLoadInFramesetDebugLevel = 0;


  
  
  
  
  
  // -------------------------------------------------------------------------
  // -------------------------------------------------------------------------
  // -------------------------------------------------------------------------
  
  
  
  
  /*
  ' function  : loadThisPageInFrameset
  ' overview  : loads this page into a frameset (if it's not already)
  ' arguments : [in] sFramesetURL, the URL of the frameset to use (no querystring allowed!) 
  '             [in] sFrameName, the name of the frame. obviously all frame names must be unique. 
  ' returns   : 
  ' example   : loadInFrameset('frameset.htm', 'maincontent')
  */
  function loadThisPageInFrameset(sFramesetURL, sFrameName)
  {
    if (top == self)
    {
      top.location.replace(sFramesetURL + '?loadurl=' + escape(location.href) + '&inframe=' + escape(sFrameName));  
    }    
  } 

  

  /*
  ' function  : loadURLFromQueryStringInThisFrameset
  ' overview  : this function must be placed in the onLoad of the frameset that is
  '             used with the function loadThisPageInFrameset.
  ' arguments : 
  ' returns   : 
  ' example   : <frameset onLoad="loadURLFromQueryStringInThisFrameset();">
  */
  function loadURLFromQueryStringInThisFrameset()
  {
    var saQuerystring = arrayOfQueryString();


    if (iLoadInFramesetDebugLevel >= 1) 
    {
      alert('Dit is de frameset. De URL van de querystring wordt nu in het hoofdframe geladen mits dit kan. ');
      alert('saQuerystring[\'loadurl\'] = ' + saQuerystring['loadurl']);
      alert('saQuerystring[\'inframe\'] = ' + saQuerystring['inframe']);
    }
  
    
    // if loadurl and inframe are specified then do the trick: 
    // load the url in the frame
    if (((typeof saQuerystring['loadurl'] != 'undefined') && (typeof saQuerystring['inframe'] != 'undefined')) && 
        ((saQuerystring['loadurl'] != 'undefined') && (saQuerystring['inframe'] != 'undefined')))
    {
      var sURL = saQuerystring['loadurl'];
      window.open(sURL, saQuerystring['inframe'], '', true);
      
      if (iLoadInFramesetDebugLevel >= 1) alert('De URL is in het frame geladen. ');
    }
  } 
  
  
  
//-->
