//File: dvk.js with functions for handling change of menus and titles

function smt (d, n, f) {
  document.write('\<a href="mailto:' + n + '@' + f + '.' + d + '"\>' + n + '@' + f + '.' +  d + '\<\/a\>');
}

// Function for showing details of object in new window incl. search string with id
// Arguments: file (action file), id (object id), w (width of window, h (height of window)
function dt(file,id,w,h) {
  href = file + '?id=' + id;
  detail_window = window.open(href, 'det_window', 'width=' + w + ',height=' + h + ',top=20,left=20,dependent=yes,resizable=yes,scrollbars=yes,titlebar=yes,status=yes');
} // End function sign

//Function for displaying title of page and pulling side menu for the page
function pull_menu () {
  // New code 30/12 2005 here
  // Check if page is within its frame
  if (top.location == self.location) { // It's NOT in a frame
    var page_file = this.location.href;
    // Check if environment is test or local developement version
    if (page_file.indexOf("~test") != -1) { // Test
      var env = "/~test/";
    } else if (page_file.indexOf("dvk2") != -1) { //Local env
      var env = "/dvk2/";
    } else { 
      var env = "/"; // Drift
    }
    top.location.href = this.location.protocol + "//" + this.location.host + 
                        env + "index.html?page=" + page_file;
  } else { // End if page is NOT within frame
    // If IN a frame
    parent.name = "parent"; // Rename to make target = "page" work in frame
  }
  // End New code 30/12 2005 here

  // Compose the current url of the window without search string
  url = this.location.protocol + "//" + this.location.host + this.location.pathname;

  // If the url of the referrer is different from the current url
  if (document.referrer.indexOf(url) == -1) {
    // Reload to show title for this page
    if (parent.frames['title']) {parent.frames['title'].location.reload()};
  }

  //Pull menu for this page
  if ((parent.frames['sidemenu']) && (parent.frames['sidemenu'].document.title != menu_title)) 
  {parent.frames['sidemenu'].location=menu_file}
} //End title_menu

//Function for going back one step from side menu if unsyncronized menu and page
function menu_back () {
  var browser=navigator.appName;
  var version=navigator.appVersion;
  var platform=navigator.platform;
  var ver1=version.substring(0,1);
  var plat3=platform.substring(0,3);
  //alert("browser: " + browser + " ver1: " + ver1 + " plat3: " + plat3);
  if ((browser != "Netscape") || (ver1 != 4) || (plat3 != "Mac")) {
    if (parent.frames['page'].menu_title != document.title) {
      parent.frames['page'].history.back();
    }
  }
} //End menu_back

