var d = document;
var l = (d.layers)?1:0;// check for Netscape 4
//var css_ie_1 = "/includes/css/algemeen.css"
//var css_ie_2 = "/includes/css/menu.css"
var css_ie_1 = "./includes/css/algemeen.css"
var css_ie_2 = "./includes/css/menu.css"
var css_ie_3 = "./includes/css/print.css"
var css_ns4_1 = ""
var css_ns4_2 = ""

// write stylesheetlink
if (l) {  // use Netscape css
  document.write("<link rel=\"StyleSheet\" href=\"" + css_ns4_1 + "\" type=\"text/css\">");
  document.write("<link rel=\"StyleSheet\" href=\"" + css_ns4_2 + "\" type=\"text/css\">");
}
else { // use IE css
  document.write("<link rel=\"StyleSheet\" href=\"" + css_ie_1 + "\" type=\"text/css\">");
  document.write("<link rel=\"StyleSheet\" href=\"" + css_ie_2 + "\" type=\"text/css\">");
  document.write("<link rel=\"StyleSheet\" href=\"" + css_ie_3 + "\" type=\"text/css\" media=\"print\">");
}

// open popup window
var popup;
function openPopup(Url,w,h) {
   var popW = w ? w : 446;
   var popH = h ? h : 450;
   var newUrl = getBase() + Url
   if (popup && !popup.closed) {popup.close();}
   popup = window.open(newUrl, "Popup","height=" + popH + ",width=" + popW + ",resizable=yes,status=yes,scrollbars=yes");
   popup.focus();
}

// link from popup window opens in opener (if present)

function from_popup(url)
{
   obj = window.opener.top;
   if (obj && !obj.closed)
   {
      obj.location.href=url;
      obj.focus();
   }
   else
   {
      window.open(url);
   }
}

function getBase()
{
   var oBaseColl;
   if ((navigator.userAgent.indexOf("MSIE"))!=-1) {
      oBaseColl = document.all.tags('BASE');      
   }
   else {
      oBaseColl = document.getElementById('BASE');      
   }
   return ( (oBaseColl && oBaseColl.length) ? oBaseColl[0].href : "" );
}

function ConstructURL(url) {
   var base = getBase()
   if (url.substr(0, 2) == "./") {
      url = url.substr(2, url.length);
   }

   if ((url.substr(0, 4).toLowerCase() !="http") && (url.substr(0, 1) != "/")) {
      if (url.substr(0, 1) == "#") {
          docLoc = new String(document.location);
          if (docLoc.indexOf("#") > 0) {
               docLoc = docLoc.substr(0, docLoc.indexOf("#"));
          }
          url = docLoc + url;
      }
      else {
          url = base + url;
      }
   }
   return url;
}

function printHelp()
 {
  if (navigator.userAgent.indexOf('MSIE 4') > 0)
  {
   alert("Druk op Ctrl-P om de informatie af te drukken");
  }
  else
  {
   window.print();
  }
 }

// this function is for opening popup positioned windows with a certain width and height
var win = null;
function newWindow(link,name,h,w,l,t,features) {
   var win_left = l;
   var win_top = t;
   if (win_left == '') {
      win_left = (screen.width-w)/2;
      if (win_left < 0) win_left = 0;
   }
   if (win_top == '') {
      win_top = (screen.height-h)/2;
      if (win_top < 0) win_top = 0;
   }
   var settings = 'height=' + h + ',';
   settings += 'width=' + w + ',';
   settings += 'top=' + win_top + ',';
   settings += 'left=' + win_left + ',';
   settings += features;
   win = window.open(link,name,settings);
   win.focus();
}
