﻿//document.oncontextmenu = new Function('return false;');
function trim(s) {
	return s.replace(/^\s*|\s*$/g,"");
}
function stripSpaces(s) {
	return s.replace(/\s+/g, "");
}
function isEmail(s, b) {
	if (!b && trim(s) == '') {
		return true;
	}
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(s)) {
		return false;
	}
	return true;
}
/* search */
function srchgo() {
	var e = document.forms.search;
	if (e.srch.value != 'zoeken...') { 
		if (trim(e.srch.value).length < 2) {
			alert('Geef tenminste 2 karakters om naar te zoeken...');
			e.srch.focus();
			return;
		} 
		e.submit(); 
		return;
	} 
	e.srch.focus();
}
function srchout(e) {
	e.className = 'd';
	if (trim(e.value) == '') {
		e.value = 'zoeken...';
	}
}
function srchin(e) {
	e.className = '';
	if (e.value == 'zoeken...') {
		e.value = '';
	}
}
/* menu */
function mnin(b,id) {
	e=document.getElementById('mnu'+id);
	e.style.display='block';
	//var p = findPos(b);
	//e.style.top = (p[1]) + 'px';
}
function mnout(id) {
	document.getElementById('mnu'+id).style.display='none';
}
/* nav */
function go(url) {
	self.location.href = url;
}
function gopop(url) {
	window.open(url)
}
/* isnumericrange */
function inr(obj, min, max) {
	obj.value = obj.value.replace(/\D+/g, "");
	if (obj.value == "") obj.value = min;
	if (obj.value < min) obj.value = min;
	if (obj.value > max) obj.value = max;
}
/* googlemaps */
function gmap(s) {
	window.open("http://maps.google.nl/maps?f=d&daddr=" + s + "&saddr=" + stripSpaces(document.getElementById('routepc').value.toUpperCase()) + ", " + stripSpaces(document.getElementById('routepl').value) + "&hl=nl")
}
/* flash */
function flashObject(name, url, width, height, vars, bgcolor, wmode, title) {
	var html = "";
	vars = (vars == null) ? "" : vars;
	bgcolor = (bgcolor == null)? "#FFFFFF" : bgcolor;
	wmode = (wmode == null) ? "window" : wmode;
	title = (title == null) ? "" : title;
 	if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
		html = '<embed title="' + title + '" type="application/x-shockwave-flash" src="' + url + '" flashvars="' + vars + '" width="' + width + '" height="' + height + '"';
		html += ' id="' + name + '" name="' + name + '" bgcolor="' + bgcolor + '" wmode="' + wmode + '" allowfullscreen="true" quality="high" menu="false"';
	} else {
		html = '<object title="' + title + '" id="' + name + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '">';
		html += '<param name="allowFullScreen" value="true">';
		html += '<param name="bgcolor" value="' + bgcolor + '">';
		html += '<param name="movie" value="' + url + '">';
		html += '<param name="flashvars" value="' + vars + '">';
		html += '<param name="quality" value="high">';
		html += '<param name="wmode" value="' + wmode + '">';
		html += '<param name="menu" value="false">';
		html += '</object>';
	}
	document.write(html);
}
/* unused 
function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft;
		curtop  = obj.offsetTop;
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft;
			curtop  += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}*/