// <script>
/* Copyright (c) Gaute Sandvik 2004, 2005, 2006 */


// oppdaterMeny
function oppdaterMeny(){

 function getFile(href){
  var BSL=String.fromCharCode(92);
  var FSL=String.fromCharCode(47);
  var A = href.split(BSL);
  var HREF = A.join(FSL)
  var P = HREF.split(FSL);
  var fileName = P.pop();
  var filePath = P.join(FSL)
  return {path:filePath, name:fileName}; 
 }//end getFile
 
 var hash="";
 if (window.location.hash) hash = "#" + window.location.hash;
 var file = getFile(location.pathname)
 var filNavn = file.name;
 var filBane = file.path; 
 var path= filBane + "/index.html"
 
 if(parent.location!=self.location){
  parentFile=getFile(parent.location.pathname);
  if(parentFile.path==file.path && parent.menyramme){
   //oppdater meny:
   parent.menyramme.updateMenu(filNavn);
  }
  else{ //fanget av fremmed websted
   //kapre vindu:
   top.location = path + "?"+ filNavn + hash 
  } 
 }
 else{// no parent
  if(filNavn=="hovedmeny.html"|| filNavn=="~1st-hovedmeny.html") {
   // forsøk på å åpne hovedmeny utenfor freameset.
   top.location=path;
  }
  
  else{ 
   if(!opener || opener.location.hostname!=window.location.hostname){ 
    //åpne i nytt frameset:
    top.location =  path + "?"+ filNavn + hash
   }
  }
 }
}//end 


//onload:
function changeMenu(){
 //oppdaterMeny
 oppdaterMeny();
 if (parent && parent.hovedramme && parent.hovedramme!=self) {
  parent.hovedramme.changeMenu();
 }
}//end changeMenu


