// Make sure the correct top frame is loaded
function topredirect(baseref,load) {
//if ((top == self) || (top.frames[0].name != 'Frame_Cornerwwwf18nl')) 
   if (top == self)
      reloadpageinframeset(baseref,load);
   else 
      if (top.frames[0].name != 'Frame_Cornerwwwf18nl') 
         reloadpageinframeset(baseref,load);
}

// Do the real loading of the page if top frame was not found
function reloadpageinframeset(baseref,load) {
   // Test if this is a local Internet Explorer browse, uses / instead of \ in adress
   if (location.pathname.lastIndexOf('\\') == -1) 
      var use_slash = "/";
   else
      var use_slash = "\\";
	  
   // Get an index for the page
   if (location.href.lastIndexOf("#") == -1) 
      var fileref = "";
   else
      var fileref = location.href.substring(location.href.lastIndexOf('#'),location.href.length);

   // Get the filename
   var filename = location.pathname.substring(location.pathname.lastIndexOf(use_slash)+1,location.pathname.length);

   // Determine if the calling page is to be loaded as part of the frame
   if (load != 'no')
      var newURL = location.protocol + use_slash+use_slash + location.host + location.pathname.substring(0,location.pathname.lastIndexOf(use_slash)) + use_slash+'index.html?' + baseref + filename + fileref;
   else
      var newURL = location.protocol + use_slash+use_slash + location.host + location.pathname.substring(0,location.pathname.lastIndexOf(use_slash)) + use_slash+'index.html?' + baseref;

   // Use the correct way to show the page
   if (document.images)
      top.location.replace(newURL);
   else
      top.location.href = newURL;
}

// Make sure the correct parent frame is loaded
function frameredirect(lvl1framename,lvl1framefile,load) {
  if (top.Frame_Cornerwwwf18nl) {
     if (parent.frames[1].name != lvl1framename) {
        if (load != 'no')

		   // Test if this is a local Internet Explorer browse, uses / instead of \ in adress
           if (location.pathname.lastIndexOf('\\') == -1) 
              var use_slash = "/";
           else
              var use_slash = "\\";

           // Fill varibale with the page to be loaded in the frameset.
           // top.F181vl1 = location.pathname.substring(location.pathname.lastIndexOf(use_slash)+1,location.pathname.length);
           top.F18lvl1 = location.href.substring(location.href.lastIndexOf(use_slash)+1,location.href.length);
		   
        // Use the correct way to show the page
		if (document.images)
           location.replace(lvl1framefile);
        else
           location.href = lvl1framefile;
     }
  }
}

// Make sure the correct page is loaded within the current frameset
function loadcorrectpage(lvl,pagename) {
   // Look for variable if not found return specified (default) pagename.
   // This is done to prevent errors when variable does not exists.
   if (eval('top.F18lvl'+lvl)) {
      // If variable is empty return specified (default) pagename,
      // else return the pagename in the varibale and empty the variable
      if (eval('top.F18lvl'+lvl) == '') {
         return pagename;
      }
      else {
         var temp = eval('top.F18lvl'+lvl);
         eval('top.F18lvl'+lvl+' = ""');
         return temp
      }
   }
   else {
     return pagename
   }
}
