// Convert location.search into an array of values indexed by name.
function getSearchAsArray() {
   var minNav3 = (navigator.appName == "Netscape" &&
      parseInt(navigator.appVersion) >= 3);
   var minIE4 = (navigator.appName.indexOf("Microsoft") >= 0 &&
      parseInt(navigator.appVersion) >= 4);
   var minDOM = minNav3 || minIE4 ;  // Baseline DOM required for this function
   var results = new Array();
   if (minDOM) 
      {
      var input = unescape(parent.location.search.substr(1));
      if (input) 
         {
         var srchArray = input.split("&");
         var tempArray = new Array();
         for (i = 0; i < srchArray.length; i++) 
            {
            tempArray = srchArray[i].split("=");
            results[tempArray[0]] = tempArray[1];
            }
         }
      }
   return results;
   }
//-------------------------------------------------------------
function loadFrame() {
  // Check if we are contained in a wrapper
  var mysite1="borke.nl" ;
  var myserver="www.tricksandtails" ;
  // act only if this is not an alowed site
  if ((document.referrer.match(mysite1) != mysite1))
    {
    //alert("Not "+mysite1+" : "+self.location.href+" s,t "+top.location.href);
    if (self==top) 
      {
      // We are single on top, so invoke a container
      var filename = location.href ;
      myserver = location.hostname ;
      location.href = "http://"+myserver+"/indexd.htm?content="+filename ;
      //location.href = myserver+"/indexd.htm?content="+filename ;
      }
    else
      {// Check if we are hijacked
      if (top.location.href.match(myserver) != myserver) 
        {
        //Let's escape from this captivity
        var filename = location.href ;
        myserver = location.hostname ;
        top.location = "http://"+myserver+"/indexd.htm?content="+filename ;
        }
      }
    }
  }
//-------------------------------------------------------------
function loadFrameReq()
  {
  //alert(self.location.href+" request: s,t "+top.location.href);
  mysite1="borke.nl" ;
  // act only if this is not an alowed site
  if ((document.referrer.match(mysite1) != mysite1))
    {
    if (parent.location.search)
      {
      //Some file is requested for load
      var filename = top.main.location.href ;
      // Check for valid requester
      if (filename.match("open.htm")=="open.htm") 
        { // This file is allowed to load content
        var srchArray = getSearchAsArray() ;
        if (srchArray["content"])
          { // Load content in main frame
          top.main.location.href = srchArray["content"] ;
          }
        }
      }
    else
      { // No page requested, load default opening page
      if (self == top) location.href = "stabij/borke.htm" ; 
      else top.main.location.href = "stabij/borke.htm" ;     
      }
    }
  }
//-------------------------------------------------------------

