function popup(href)
{
	window.open(href, "popup", 'width=300,height=200,scrollbars=yes,resizable=yes');
}

var W3CDOM = (document.getElementsByTagName && document.createElement);

function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1) return false;
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
	if (str.indexOf(at,(lat+1))!=-1) return false;
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
	if (str.indexOf(dot,(lat+2))==-1) return false;
	if (str.indexOf(" ")!=-1) return false;
	return true					
}

function validate()
{
	validForm = true;
	errorstring = '';
	var x = document.forms[0].elements;
	for (var i=0;i<x.length;i++)
	{
		if (!x[i].value)
		{
			if (x[i].className == 'required')
			{
				writeError(x[i],'* verplicht veld');
				validForm = false;
			}
		}
	}
	if (!echeck(x['email'].value))
	{
		writeError(x['email'],'* ongeldig e-mailadres');
		validForm = false;
	}
	if (!W3CDOM)
		alert(errorstring);
	if (firstError)
		firstError.focus();
	return validForm;
}

function writeError(obj,message)
{
	if (obj.hasError) return;
	if (W3CDOM)
	{
		obj.className += ' error';
		obj.onchange = removeError;
		var sp = document.createElement('span');
		sp.className = 'error';
		sp.appendChild(document.createTextNode(message));
		obj.parentNode.appendChild(sp);
		obj.hasError = sp;
	}
	else
	{
		errorstring += obj.name + ': ' + message + '\n';
		obj.hasError = true;
	}
	if (validForm)
	{
		firstError = obj;
	}
}

function removeError()
{
	this.className = this.className.substring(0,this.className.lastIndexOf(' '));
	this.parentNode.removeChild(this.hasError);
	this.hasError = null;
	this.onchange = null;
}

function initialize () {
	var breadcrumb = document.getElementById('bread-crum');
    if(breadcrumb !== null) {
        var oldBreadcrumb = breadcrumb.parentNode.removeChild(breadcrumb);
        document.getElementById('header').appendChild(oldBreadcrumb);
		document.body.style.display = 'none';
		document.body.style.display = 'block';
		breadcrumb.style.display = 'block';
    }
        
    if (self.init) self.init();
}

window.onload = initialize; 

