/* --- aanroep voor clientcheck functie --- */
/*-------------------------------------------------------------------------*/
	var is = new getClient();
/*-------------------------------------------------------------------------*/


/* voor als er een 'not compatible' page is. */
/*-------------------------------------------------------------------------*/
	//if (!is.comp) window.location="notcompatible.cfm";
/*-------------------------------------------------------------------------*/


/*alle nodige stylesheet varianten voor verschillende browsers*/
/* voor de stylesheet versies die je niet nodig hebt kun je de waarden van 
   de bijhorende flags op 0 zetten*/
/*-------------------------------------------------------------------------*/
  var browserStyles = new Object();
  browserStyles.Ns = 1;  //alleen voor Netscape4
  browserStyles.Gko = 1;  //alle gecko browsers: mozilla, ns6, ns7,  en afgeleiden
  browserStyles.IeM = 1;  //Internet explorer mac
  browserStyles.NsM = 1;  //Netscape mac
/*-------------------------------------------------------------------------*/

/*alle nodige scripts en stylesheets*/
/*syntax:  include("scriptnaam.js","stylenaam.css",....);*/
/*-------------------------------------------------------------------------*/
	include("basis.css", "menu.css", "infoPage.css"); //stylesheets
  include("dropdown.js");  //scripts
/*-------------------------------------------------------------------------*/


/* initialisatie functie*/
/* hier alle zaken die verricht moeten worden als het document geladen is*/
/*-------------------------------------------------------------------------*/
	function init(){
		if (is.ns4) makeDocAll();
	}
/*-------------------------------------------------------------------------*/


/* aanroep van de domtransform scripts voor ns4 of ie4 browsers */
/* deze scripts maken deze browsers -enigzins- dom2 compatible */
/*-------------------------------------------------------------------------*/
	if (is.ns4){
		include("NsDomTransform.js");
	}else if ("isObj(document.all" && !document.getElementById){
		include("IeDomTransform.js");
	}
/*-------------------------------------------------------------------------*/


/* --- ERRORS AFVANGEN --- */
//self.onerror = function(){return true}
/* --- /ERRORS AFVANGEN --- */

/* --- CLIENTCHECK --- */
/* */

function getClient() {
    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase()
    var apv=navigator.appVersion.toLowerCase()
    this.major = parseInt(navigator.appVersion)
    this.minor = parseFloat(navigator.appVersion)
    // browserversion
    this.ns  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)))
    this.ns4 = (this.ns && (this.minor >= 4.03) && (this.major < 5))
	this.ns6 = (this.ns && (this.major == 5))
	this.gecko = (this.ns && (this.major >= 5))
    this.ie   = (agt.indexOf("msie") != -1)
    this.ie4  = (this.ie && (this.major == 3))
	this.ie45 = (agt.indexOf('msie 4.5') != -1);
    this.ie5  = (this.ie && (this.major == 4))
    // platform
	this.mac = (apv.indexOf("macintosh")>0);
	this.win = (apv.indexOf("win")>0);	
  // mac browsers
  this.iemac = (this.mac && this.ie);
  this.nsmac = (this.mac && this.ns4);
    // compatible browsers
	this.ie4comp = ((this.ie4 && !this.mac) || this.ie45 || this.ie5)
	this.ns4comp = (this.ns4);
	this.ns6comp = (this.gecko || this.ns6);
	this.comp = (this.ie4comp || this.ns4comp || this.ns6comp);
	return (this)
}



// include()
// voor het aanroepen van externe stylesheets en javascripts in een pagina
// syntax:  include("scriptnaam.js","stylenaam.css",....);
// return: -
// resultaat: de bijhorende script en style tags worden in de pagina geschreven.
// hierbij wordt aangenomen dat javascripts in de js map zitten en stylesheets in de css map
function include(){
	for (i=0 ; i<arguments.length ; i++){
		if (arguments[i].indexOf(".js") != -1){
			document.write("<" + "script language=\"javascript1.2\" src=\"" +getWebroot()+ "js/" + arguments[i] + "\"></script>");
		}else if (arguments[i].indexOf(".css") != -1){
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" +getWebroot()+ "css/" + arguments[i] + "\">");
      if(getStyleExt()){
        var extensionPos=arguments[i].indexOf(".css");
				var styleName=arguments[i].substr(0,extensionPos);
        document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" +getWebroot()+ "js/" + styleName + getStyleExt() + ".css\">");
      }
		}
	}
}

function getStyleExt(){
  if (is.ns4 && browserStyles.Ns) return "Ns";
  else if (is.gecko && browserStyles.Gko)  return "Gko";
  else if (is.nsmac && browserStyles.NsM)  return "NsM";
  else if (is.iemac && browserStyles.IeM)  return "IeM";
}

function getWebroot(){
  if (!requestWebroot) return "";
  else if (requestWebroot.indexOf("#")== 0) return "";
  else return requestWebroot;
}
// end include()


// isObj()
// test of een object bestaat
// syntax: isObj('document.bla.bla.bla');
// return: true of false
function isObj(objString) {
	var a=objString.split('.');
	var i=1;
	var theString=a[0];
	while (i<a.length && (i<a.length && eval('typeof ' + theString) == 'object')){
		theString += "." + a[i];
		i++;
	}
	return eval('typeof ' + theString) == 'object';
}
// end isObj()

// openWindow()
// MM rip om een window te openen met een nieuwe URL
function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
// end openWindow()

// printPage()
// opens a new window for printning perposes
function printPage(){
  var printWindow = window.open('#request.webroot#handler.cfm?event=onPrint&id=#o.id#','printWindow','height=600,width=400,scrollbars=yes,resizable');
}
// end printPage()

// Begin popout() function
// function provided by UU to enable a popup on an unload event.
// contact: Peter Lok (P.Lok@csc.uu.nl)
function popout() {
window.open(getWebroot()+'enquete/form1.cfm','','toolbar=no,menubar=no,location=no,height=370,width=400');
}
// End popout()

