//<!--
/*
 * standard objects and functions
 * >= MSIE 4 
 * >= NS 4.5 (NS 6)
 *
 * (C) Tjerk Wolterink
 * tjerk@derdehelft.com
 * 2003
 */
function insertSpace(width, height) {
	document.write("<img src=\"http://www.vragender.com/nijhof/img/fill_pixel.gif\" class=noborder width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;\">");
}

if(getBrowserVersion()<4) {
	alert("U heeft een te oude browser hierdoor"
		+"kan het zijn dat de pagina niet goed wordt weergegeven.\n"
		+"Het is raadzaam een nieuwere browser te installeren\n"
		+"\tBijvoorbeeld Internet Explorer 5.x of Netscape 6"
	);
}
//

function detectFlash() {
	if (navigator.mimeTypes && navigator.mimeTypes.length) {
		var flash=navigator.mimeTypes['application/x-shockwave-flash'];
		if (flash && flash.enabledPlugin) return(true) 
		else return(false);
	} else return -1;
}

function getElement(name) {
	if (document.getElementById) {
		if(document.getElementById(name)) return document.getElementById(name).style;
	} else if (document.all) {
		if(document.all[name]) return document.all[name].style;
	} else if (document.layers)	{
		if(document.layers[name]) return document.layers[name];
	} else return false;
}

function getRootElement(name) {
	if (document.getElementById) {
		if(document.getElementById(name)) return document.getElementById(name);
	} else if (document.all) {
		if(document.all[name]) return document.all[name];
	} else if (document.layers)	{
		return null;
	} else return false;
}

function getBrowserName() {
	return navigator.appName=="Netscape" ? "ns" : "msie";
}

function getBrowserVersion() {
	return parseInt(navigator.appVersion);
}

function Browser() {
	this.name=getBrowserName();
	this.version=getBrowserVersion();
	this.java=navigator.javaEnabled();
	function getName() {
		return this.name;
	}
	this.getName=getName;
	function getVersion() {
		return this.version;
	}
	this.getVersion=getVersion;
	function getJava() {
		return this.java;
	}
	this.getJava=getJava;
}

function ScreenVars() {
	this.screenheight;this.screenwidth;
	this.availheight;this.availwidth;
	this.colordepth;
	this.innerheigh;this.innerwidth;
	this.scrollleft;this.scrolltop;

	function refresh() {
		this.screenheight=parseInt(self.screen.height);
		this.screenwidth=parseInt(self.screen.width);
		this.availheight=parseInt(self.screen.availHeight);
		this.availwidth=parseInt(self.screen.availWidth);
		this.colordepth=parseInt(self.screen.colorDepth);
		this.innerheight=parseInt(self.innerHeight ? (document.body ? window.document.body.offsetHeight : self.innerHeight) : (window.document.body ? window.document.body.offsetHeight : "?"));
		this.innerwidth=parseInt(self.innerWidth ? self.innerWidth : (window.document.body ? window.document.body.offsetWidth : "?"));
		this.scrollleft=parseInt(document.body ? (document.body.scrollLeft ? document.body.scrollLeft : 0) : 0);
		this.scrolltop=parseInt(document.body ? (document.body.scrollTop ? document.body.scrollTop : 0) : 0);
	}
	this.refresh=refresh;
}

//mousemovehandler
var mouse_x=0;var mouse_y=0;
if (document.layers) {
	window.captureEvents(Event.MOUSEMOVE);
}
function mouseMoveHandler(e) {
	mouse_x=e ? e.pageX + (window.layers ? (self ? self.pageXOffset : 0) : 0): event.x+document.body.scrollLeft;
	mouse_y=e ? e.pageY + (window.layers ? (self ? self.pageYOffset : 0 ) : 0): event.y+document.body.scrollTop;
}
document.layers ? window.onMouseMove = mouseMoveHandler : document.onmousemove=mouseMoveHandler;
// mousemovehandler

var templayer=null;
function Layer(name,x,y) {
	this.name=name;
	this.x=x ? x : 0;
	this.y=y ? y : 0;
	this.id=getElement(name);
	this.timeout=false;
	
	function get(){
		return this.id;
	}
	this.get=get;

	function show() {
		if(this.id) {
 			if(document.layers)	this.id.visibility="show"
			else this.id.visibility="visible";
			this.visible=true;
		}
		clearTimeout(this.timeout);
		this.timeout=null;
	}
	this.show=show;
	
	function hide(milisecs){
		if(this.id) {
			if(milisecs==null || milisecs==0 || !milisecs) {
				if(document.layers) this.id.visibility="hide" 
				else this.id.visibility="hidden";
				this.visible=false;
			} else {
				templayer=this;
				this.timeout=setTimeout('templayer.hide(0)', milisecs);
			}
		} 
	}
	this.hide=hide;
	
	function stopTimer() {
		clearTimeout(this.timeout);
		this.timeout=null;
	}
	this.stopTimer=stopTimer;

	function move(x,y) {
		if(this.id) {
			if(document.layers) {
				this.id.moveTo(x,y);
			} else {
				this.id.left=x+"px";this.id.top=y+"px";
			}
			this.x=x;
			this.y=y;
		}
	}
	this.move=move;
	
	function isVisible() {
		visual=this.id.visibility;
		var bool=false;
		if(visual=="hide" || visual=="hidden"){
			bool=false;
		} else {
		 	bool=true;
		}
		return bool;
	}
	this.isVisible=isVisible;
	
	function writeText(text) {
		if(document.all){
			eval("document.all."+this.name).innerHTML=text;
		} else if(document.getElementById) {
			this.id.innerHTML=text;
		} else if(document.layers) {
			this.id.open();
			this.id.write(text);
			this.id.close();
		}
	}
	this.writeText=writeText;
	
	function exists() {
		if(this.id==null || this.id=="undefined" || !this.id)
			return false;
		return true;
	}
	this.exists=exists;
	
}

var windowOpen;
function popUp(file,w,h, menubar, scrollbars) {
	if(!w) var w=200;
	if(!h) var h=100;
	if(!menubar) var menubar=0;
	if(!scrollbars) var scrollbars=1;
	windowOpen=window.open(file, 0 , "width="+w+",height="+h+",toolbar=0,location=0,directories=0,status=0,menubar="+menubar+",scrollbars="+scrollbars+",resizable=1,top=10,left=10");
	windowOpen.focus();
}

function deleteTags(text) {
	for(var i=0;i<text.length;i++) {
		var temp=text.charAt(i);
		if(temp=="<") {
			var loop=true;
			for(var j=i;(j<text.length && loop);j++) {
				temp=text.charAt(j);
				if(temp==">") {
					text=text.substring(0,i)+text.substring(j+1,text.length);
					loop=false;
				}
			}
		}
	}
	return text;
}

function format(input) {
	input.value=trim(input.value);
}

function trimInput(element) {
	element.value=trim(element.value);
	return element;
}

function trim(txt) {
	var regex=/^\s*((\S+[\s\S]*\S+)|\S)\s*$/;
	var arr=regex.exec(txt);
	if(!arr) {
		return "";
	} else {
		return arr[1];
	}
}

function isEmail(email) {
	var regex=/^[\w\.]+@[\w\.]+\.\w+$/;
	var arr=regex.exec(email);
	return arr;
}

function isPostcode(postcode) {
	var regex=/^[0-9]{4}[ -]*[A-Za-z]{2}$/;
	var arr=regex.exec(postcode);
	return arr;
}

function deleteTrailingZeros(text) {
	if(!text) return;
	var newtext=text;
	for(var i=0;i<text.length;i++) {
		if(text.charAt(i)=='0') newtext=text.substring(i+1, text.length)
		else return newtext;
	}
	return newtext;
}

function isNumber(text) {
	var regex=/^[0-9]+$/;
	var arr=regex.exec(text);
	return arr;
}

function isHouseNumber(text) {
	var regex=/^[0-9\-]+[a-zA-Z]*$/;
	var arr=regex.exec(text);
	return arr;
}

function replace(string, search, replace){
	string=string.toString();
	search=search.toString();
	replace=replace.toString();
	var endstring="";
	for(var i=0;i<string.length;i++){
		var temp=string.substring(i,i+search.length);
		if(temp==search){
			endstring+=replace;
			i+=search.length-1;
		} else {
			endstring+=temp.charAt(0);
		}
	}
	return endstring;
}


function contains(text, string){
	var bool=false;
	for(var i=0;i<text.length;i++){
		if(text.substring(i,i+string.length)==string)
			bool=true;
	}
	return bool;
}

function incrementValue(element) {
	element=getRootElement(element)
	element.value=(new Number(element.value)).valueOf()+1;
}

function decrementValue(element) {
	element=getRootElement(element)
	element.value=(new Number(element.value)).valueOf()-1;
}
//-->
