var cache	= GetCookie('cache') ? GetCookie('cache') : 'on';
cache	= 'off';

function chCache() {
	status = "cache " + (cache = cache=='on' ? 'off':'on')
	SetCookie('cache' , cache , 5000);
}

// undo Symantech's pop-up blocking javascript
if (typeof SymRealWinOpen == 'object') window.open=SymRealWinOpen

function getEl(a) {return document.getElementById(a)}

/////////////////////////////////////////////////////////////////////
/// browser vars ////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function lib_bwcheck(){
	this.ver	= navigator.appVersion;
	this.agent	= navigator.userAgent;
	this.dom	= document.getElementById ? 1:0;
	this.opera5	= this.agent.search(/opera 5/i)>-1;

	this.ie4	= (document.all && !this.dom && !this.opera5) ? 1:0;
	this.ie5	= (this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5) ? 1:0; 
	this.ie6	= (this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5) ? 1:0;
	this.ie7	= (this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5) ? 1:0;
	this.ie8	= (this.ver.indexOf("MSIE 8")>-1 && this.dom && !this.opera5) ? 1:0;
	this.ie		= this.ie4 || this.ie5 || this.ie6 || this.ie7 || this.ie8;

	this.mac	= this.agent.search(/mac/i)>-1;

	this.fire	= this.agent.search(/firefox/i)>-1;
	this.ns6	= (this.dom && parseInt(this.ver) >= 5) ? 1:0;
	this.ns4	= (document.layers && !this.dom) ? 1:0;
	this.ns		= this.ns4 || this.ns6;

	this.bw		= (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);
	return this;
}
bw	= new lib_bwcheck();

function printPage(a) {
	if (self.print && !a)	dw("<a href='javascript: doPrint(); void(0)'>Print deze pagina</a><br /><br />")
	else			dw("<a href='" + a + "'>Print deze pagina</a><br /><br />")
}

function doPrint(a) {
	if (self.print)	self.print()
	else		alert(a)
}

function chOpac(obj , opac) {
	obj		= obj.style;
	obj.opacity	= obj.MozOpacity = obj.KhtmlOpacity = (opac/100);
	obj.filter	= "alpha(opacity=" + opac + ")";
}

/////////////////////////////////////////////////////////////////////
/// print swf ///////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
function swf(u, h, w , co , bg , trans) { //url, height, width, cache-off, backgroundcolor
	if (cache == 'off') u += '&cache=' + cache + '&' + new Date().getTime();

	var trans1 = trans2 = "";

	if (trans) {
		trans1 = "<PARAM NAME='wmode' VALUE='transparent'>";
		trans2 = " wmode=transparent ";
	}

	dw("\
		<object id=flObj name=flObj type='application/x-shockwave-flash' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width=" + w + " height=" + h + ">\
		<param name=movie value='" + u + "'>" + trans1 + "<param name=bgcolor value=" + bg + "><PARAM NAME=scale VALUE=noscale><param name=quality value=high><PARAM NAME=menu VALUE=false><PARAM NAME=swliveconnect VALUE=true><PARAM NAME=align VALUE=bottom><PARAM NAME=wwwsalign VALUE=T>\
		<embed swLiveConnect=true NAME=flObj " + trans2 + " bgcolor=" + bg + " ALIGN=bottom wwwsALIGN=T src='" + u + "' menu=false scale=noscale quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=" + w + " height=" + h + "></embed>\
		</object>\
	");
}

function dw(a) {document.write(a)}

function swf2(u, h, w) { //url, height, width
	dw('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + w + '" HEIGHT="' + h + '" WALIGN="left">');
	dw('<PARAM NAME=movie VALUE="' + u + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=noscale> <PARAM NAME=salign VALUE=LT> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="' + u + '" quality=high scale=noscale salign=LT bgcolor=#FFFFFF  WIDTH="' + w + '" HEIGHT="' + h + '" WALIGN="left"');
	dw('TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
	dw('</OBJECT>');
}

function chCache() {
	status = "cache " + (cache = cache=='on' ? 'off':'on')
	SetCookie('cache' , cache , 5000);
}

function popUp(u , h , w , t , l) {
	window.open(u , "" , "height=" + h + ",width=" + w + ",left=0,top=0,scrollbars=yes"
	+ (t ? ",toolbar=yes"	:"")
	+ (l ? ",location=yes"	:"")
	);
}

function changeOrder(ta , o , n) {
	var t	= ',' + ta.join(',') + ',';
	t	= t.replace( new RegExp("," + ta[o] + "," , "") , ',');

	if (o>n)	t = t.replace( new RegExp("," + ta[n] + "," , "") , ',' + ta[o] + ',' + ta[n] + ',');
	else		t = t.replace( new RegExp("," + ta[n] + "," , "") , ',' + ta[n] + ',' + ta[o] + ',');

	return t.replace(/^,|,$/g , '').split(',');
}

// ttt = realConfirm('Eh...?' , '139,260,330,415' , 1 , 400 , 120);
// question , buttonlabels , cancelbutton , dialogwidth , dialogheight
function realConfirm(q , b , c , w , h) {
	var retVal		= "";
	var args		= new Array();

	args['question']	= q;
	args['buttons']		= b;
	args['cancel']		= c;

	retVal			= window.showModalDialog("/confirm.htm", args, "dialogWidth: " + w + "px; dialogHeight: " + h + "px; dialogTop: px; dialogLeft: px; edge: Sunken; center: Yes; help: No; resizable: no; status: No; scroll: auto; unadorned: no");

	if (retVal == null || retVal == undefined || retVal == 0)	return null
	else								return retVal
}

/////////////////////////////////////////////////////////////////////
/// focus één na laatste veld, dan op incorrect veld, dan alert /////
/////////////////////////////////////////////////////////////////////
function formNotGood(e , a) {
	var f = e.form;

	if (f.elements[f.elements.length-1].readOnly)	f.elements[f.elements.length-2].focus()
	else						f.elements[f.elements.length-1].focus()

	alert(a);
	e.focus();
	e.select();

	return false;
}

var onloads	= new Array();
addOnload	= function(a)	{onloads.push(a)}
onload		= function()	{for (var i=0; i<onloads.length; i++) onloads[i]()}

var onunloads	= new Array();
addOnunload	= function(a)	{onunloads.push(a)}
onunload	= function()	{for (var i=0; i<onunloads.length; i++) onunloads[i]()}

function openPop(url , title , reload) {
	var da	= [url , title , self , document.location.href];
	if	(bw.ie) {
		var r	= window.showModalDialog('/modalDialog.htm' , da , 'font-family:Arial; font-size:10; dialogWidth: 700px; dialogHeight: 500px; dialogTop: px; dialogLeft: px; edge: Sunken; center: Yes; help: No; resizable: yes; status: No; scroll: yes; unadorned: no')
		if (reload && r)	document.location.href = document.location.href
	}
	else {
		popupPage	= window.open('/modalDialog.htm' , "popupPage", "top=0,left=0,resizable=yes,scrollbars=auto,width=700,height=500");
		popupPage.da	= da;
	}
}

var ModalDialog		= new Object();
ModalDialog.open	= function(vars , func) {
	ModalDialog.vars	= vars;
	ModalDialog.close	= func ? func : null;
	ModalDialog.window	= window.open('/modalDialog2.htm' , 'mdw' , 'width=750,height=550,scrollbars=yes,status=yes,resizable=yes');

	var md			= ModalDialog;
	self.onfocus		= function() {
		if (md.window && md.window.open && !md.window.closed)	md.window.focus()
		else							self.onfocus = md.window = md.close = null
	}
}

String.prototype.toUpperCaseFirst	= function() {
	return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
}

/////////////////////////////////////////////////////////////////////
/// einde script ////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
