
function newWindow(page) {
  window.open(page, "popup",
    "height=550,width=700,left=10,top=10,menubar=no,toolbar=no,scrollbars=yes,resizable=yes");
};

function open_newWindow(page) {
  window.open(root + page, "",
    "height=600,width=600,left=10,top=10,menubar=no,toolbar=no,scrollbars=yes,resizable=yes");
};

function open_hbcFile(filename) {
    theLocation=filename;
	readFileViaApplet();
	document.write(document.HbcToHtml_applet.fileContent);
};

function fixDoubleDots(path) {
// Shrinks double dot notation "../" in path names so that relative paths can be used in a file and
//   they will work both locally and remotely.  Note that IE uses backslashes for local paths.
//

  currentPath = document.location.pathname;
  re = new RegExp('\\\\', 'gi');
  temp = currentPath.replace(re, '/');
  currentDir = temp.substring(0, temp.lastIndexOf("/") + 1);
  currentPath = document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1);
  path = currentDir + path;

  while ( (i = path.indexOf('../')) != -1 ) {
    left=path.substring(0, i);
    right=path.substring(i + 3, path.length);
    j=left.substring(0, left.length - 1).lastIndexOf('/') + 1;
    newLeft=left.substring(0, j);
    path = newLeft + right;
  };
  return path;
};

function loadPage(page) {
  window.location.href=fixDoubleDots(page +  '.htm');
};

function loadRE(page) {
  window.location.href=fixDoubleDots(page);
};

