/*
Aanvullingen:
	2003-05-23: functies watermerk en dynawin toegevoegd
	2002-04-09: klokfuncties toegevoegd
	2002-02-26: functies tbv wachtboodschap geplaatst, functie winOpen overgezet
Wijzigingen:
	2003-05-23: Nu ook voor site Red Eagles
	2002-04-09: var maand algemeen gemaakt
	2002-03-19: dit bestand van Start en Insider gelijk gemaakt
	2002-02-26: deze header in .js-bestand geplaatst
	2007-09-10: functie waterMerk aangepast root dir images
*/

var sSlash = location.href.indexOf("http://") != -1 ? "/" : "\\";

var maand = new Array ("leeg", "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december");

function isLeeg(str) {
   return (str == null || str == "");
}

function isIE() {
    var agt=navigator.userAgent.toLowerCase();
    return (agt.indexOf("msie") != -1);
}

function isNav() {
    var agt=navigator.appName.toLowerCase();
    return (agt.indexOf("netscape") != -1);
}

function waterMerk() {
	if (document.all||document.getElementById)
	document.body.style.background="url('/images/achtergrond.jpg') white center repeat fixed";
}

function showStatus(i) {
	var statusMsg = new Array();
		statusMsg[0] = "";
		statusMsg[1] = "door 'insider 2.2' beveiligde toegang!";
	self.status=statusMsg[i];
}

// functie om altijd in "bovenste" window te laden
function checkTop() {
	if (self.location != window.top.location) {
		window.top.location=self.location;
	}
}

function gaNaar(keuze) {
	if (keuze != "NoGo") {
		if (keuze.indexOf("http://") == -1){
			content.location = keuze;
		} else {
			top.location = keuze;
		}
	}
}

function gaSnelNaar(doel) {
	doelUrl = doel.options[doel.selectedIndex].value;
	if (doelUrl != "") {
		if (doelUrl.indexOf("http://") == -1){
			dir=(doelUrl.substring(0,doelUrl.indexOf("/")));
			pag=(doelUrl.substring((doelUrl.indexOf("/")+1),doelUrl.length));
			laadPagina(dir,pag);
		} else {
			window.open(doelUrl,"","");
		}
	}
}

function laadPagina(dir,pag){
	if (pag != "home.htm") {
		parent.frames.submenu.location="../"+dir+"/submenu.htm";
		if (pag.indexOf("http://") == -1){
			parent.frames.infopagina.location="../"+dir+"/"+pag;
		}else{
			parent.frames.infopagina.location=pag;
		}
	}else{
		parent.location="../"+dir+"/home.htm";
	}
}

function myprint() {
  var contents = document.all.content.innerHTML;
  var printwindow = window.open("empty.html","","");
  printwindow.document.body.innerHTML = contents;
}

function printit(){  
	if (window.print) {
		window.print() ;  
	}else{
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box
		WebBrowser1.outerHTML = "";  
	}
}

function imgOn(imgName) {
	if (document.images) {
		document[imgName].src=eval(imgName+"_on.src");
	}
}

function imgOff(imgName) {
	if (document.images) {
		document[imgName].src=eval(imgName+"_off.src");
	}
}

//Begin Klokfuncties
var timerID = null;
var timerRunning = false;

function startKlok() {
	stopKlok();
	time();
}

function stopKlok() {
	if(timerRunning) {
		clearTimeout(timerID);
		timerRunning = false;
	}
}

function time() {
	var now = new Date();
	var yr = now.getYear();
	var mNr = now.getMonth() + 1;
	var dNr = now.getDay() + 1;
	var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	var hours = now.getHours();
	var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
	var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
	var dag = new Array ("leeg", "Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"); 
	var MonthDayYear =(dag[dNr] + " " + dayNr + " " + maand[mNr] + " " + yr);
	var TimeValue =(hours + minutes + seconds);
	window.status=MonthDayYear + " " + TimeValue +" © CvB";
	timerID = setTimeout("time()",1000);
	timerRunning = true;
}
// Einde klokfuncties

function wijzDatum() {
	tijd=document.lastModified;
	mnd=eval(tijd.substring(0,2));
	dag=eval(tijd.substring(3,5));
	jaar=eval(tijd.substring(6,tijd.indexOf(" ")));
		if (jaar<2000){jaar += 2000;}
	uur=tijd.substring((tijd.indexOf(" ")+1),20);
	document.write("Laatste wijziging: "+dag+" "+maand[mnd]+" "+jaar);
}

// variabelen en functie om link in extern window te openen
function newWin(url,para) {
	str="titlebar=1,menubar=1,toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1";
	if (!isLeeg(para)) {
		str+="," + para;
	}
	window.open(url,"remoteWin",str);
}

function winOpen(x) {
//	var doel=eval(x);
//	newWin(doel,"width=600,height=400");
	newWin(x,"width=600,height=400");
}

function DynaWin(url, h, w, l, t) {
	poph = + h + 70;
	popw = + w + 60;
	disp = window.open("","pop","height=" + poph + ",width=" + popw + ",left=" + l + ",top=" + t + "");
	content = '<HTML>';
	content += '<TITLE>Pop-up Window</TITLE>';
	content += '</HEAD>';
	content += '<BODY onBlur="self.close()">';
	content += '<P ALIGN="CENTER"><img src="' + url + '"></P>';
	content += '<H4 ALIGN="CENTER" style="Font-Family : \'verdana\';"><A HREF="#" onClick="self.close()">Sluiten</A></H4>';
	content += '</BODY></HTML>';
	disp.document.write(content);
	disp.document.close();
}

// functies en variabele om wachtboodschap tijdens het laden van pagina te tonen
function ap_getObjStyle(name) { 
	if (document.getElementById){
		return document.getElementById(name).style;
	} else if (document.all){
		return document.all[name].style;
	} else if (document.layers){
		return document.layers[name];
	} 
} 

var DHTML = (document.getElementById || document.all || document.layers);

function ap_showWaitMessage(div,flag)  { 
	if (!DHTML) return; 
	var x = ap_getObjStyle(div);
	x.visibility = (flag) ? 'visible':'hidden';
//	if(! document.getElementById) if(document.layers) x.left=280/2; return true;
}

function lopendeTekst(W,H,C,SA,SD,tekst) {
	xxx = '<div align="center"><marquee';
	xxx+= ' WIDTH="'+W+'"';
	xxx+= ' HEIGHT="'+H+'"';
	xxx+= ' BGCOLOR="'+C+'"';
	xxx+= ' SCROLLAMOUNT="'+SA+'"';
	xxx+= ' SCROLLDELAY="'+SD+'"';
	xxx+= ' ALIGN="TOP"';
	xxx+= ' BEHAVIOR="SCROLL"';
	xxx+= ' DIRECTION="LEFT"';
	xxx+= ' LOOP="-1"';
	xxx+= ' HSPACE="1"';
	xxx+= ' VSPACE="1">';
	xxx+= tekst + '</marquee></div>';
	document.write(xxx);
}
