// Make sure the correct top frame is loaded
function topredirect(baseref,load) {
//if ((top == self) || (top.frames[0].name != 'officieuze_strippagina_music')) 
   if (top == self)
      reloadpageinframeset(baseref,load);
   else 
      if (top.frames[0].name != 'officieuze_strippagina_music') 
         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 an search entry for the page
   if (location.href.lastIndexOf("?") == -1) 
      var searchref = "";
   else
      var searchref = 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.htm?' + baseref + filename + fileref + searchref;
   else
      var newURL = location.protocol + use_slash+use_slash + location.host + location.pathname.substring(0,location.pathname.lastIndexOf(use_slash)) + use_slash+'index.htm?' + 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.officieuze_strippagina_music) {
     if (parent.frames[0].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.DOSlvl1 = location.pathname.substring(location.pathname.lastIndexOf(use_slash)+1,location.pathname.length);
           top.DOSlvl1 = 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.DOSlvl'+lvl)) {
      // If variable is empty return specified (default) pagename,
      // else return the pagename in the varibale and empty the variable
      if (eval('top.DOSlvl'+lvl) == '') {
         return pagename;
      }
      else {
         var temp = eval('top.DOSlvl'+lvl);
         eval('top.DOSlvl'+lvl+' = ""');
         return temp
      }
   }
   else {
     return pagename
   }
}

