function onBodyLoad(){
	// to be overridden in specific scripts
}
function epost(who,subject,mailbody){
	monkeytail='@';
	document.location.href='mailto:'+who+monkeytail+'antwerpskookhuis.be?subject='+escape(subject)+'&'+escape(mailbody);
}
function checkEmail(formElement){
	invoer = formElement.value;
	//controle op format
	var reg= /^[A-Za-z0-9._-]*@[A-Za-z0-9.-]*\.[A-Za-z]{2,}$/;
	if (!reg.test(invoer)){
		return false;
	}
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
// Removes leading whitespaces
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}
// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trim( value ) {
	return LTrim(RTrim(value));
}

function checkForm(f){
	x = true;
	for (i=0; i<f.elements.length; i++){
		if (f.elements[i].name == 'E-mail'){
			if (checkEmail(f.elements[i]) == false){
				x = false;
				f.elements[i].style.backgroundColor = '#ff6666';
			}
		}else{
			if (f.elements[i].alt == '*'){
				if (trim(f.elements[i].value) == ''){
					x = false;
					f.elements[i].style.backgroundColor = '#ff6666';
				}
			} // only if marked mandatory (alt="*")
		}
	}
	if (x){
		x = confirm('Bericht versturen?');
	}else{
		alert('Corrigeer de gemarkeerde velden alstublieft.');
	}
	return x
}
