function getURL(u, t)
{
	setTimeout("location.href='"+u+"';", t*1000);	
}
function showBox(elem)
{
	document.getElementById('overlay').style.visibility 	= 'visible';
	document.getElementById(elem).style.visibility 			= 'visible';
}
function hideBox(elem)
{
	document.getElementById(elem).style.visibility 			= 'hidden'; 
	document.getElementById('overlay').style.visibility 	= 'hidden';							
}
function getxmlHttpObject()
{
	xmlHttp = null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	return xmlHttp;
}
function cmdContact(form)
{
	if ( checkContactForm(form) )
	{
		urchinTracker('/actie/contact_formulier');
		xmlHttp = getxmlHttpObject();
		xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4)
			{
				document.getElementById('contactBox').innerHTML = xmlHttp.responseText;
			}
		}
		parameters = "naam="+form.naam.value+"&email="+form.email.value+"&bedrijf="+form.bedrijf.value+"&telefoon="+form.telefoon.value+"&bericht="+form.bericht.value+"&referentie="+form.referentie.value+"&f="+location.href;
		xmlHttp.open("POST","_cmd.contact.php",true);      
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", parameters.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.send(parameters);	
		document.getElementById('contactBox').innerHTML = "<center><br><br><img src=\"images/ani-busy.gif\"><h3>Bezig met versturen</h3></center>";
	}
}
function cmdSend(form)
{
	urchinTracker('/actie/pagina_verzenden');
	xmlHttp = getxmlHttpObject();
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{
			document.getElementById('sendBox').innerHTML = xmlHttp.responseText;
		}
	}
	parameters = "b="+form.bericht.value+"&rn="+form.name_recipient.value+"&re="+form.email_recipient.value+"&sn="+form.name_sender.value+"&se="+form.email_sender.value+"&f="+location.href;
	xmlHttp.open("POST","/site/_cmd.send.php",true);      
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parameters);	
}
function checkContactForm(form)
{
	if (form.naam.value.length < 1)
	{
		alert('vul a.u.b. uw naam in');
		return false;
	}
	if (!validateEmail(form.email.value))
	{
		alert('vul a.u.b. een geldig e-mailadres in');
		return false;
	}
	if (form.bericht.value.length < 1)
	{
		alert('vul a.u.b. een bericht in');
		return false;
	}
	return true;
}
function validateEmail(s) 
{
	var i1,i2;
	// @ must be present and not as first char
	if ( (i1 = s.indexOf("@")) < 1 ) return false;
	// domain name dot after @ must be present but not (only) as last char
	if ( (i2 = s.lastIndexOf(".",s.length-2)) == -1 || i2 < i1 ) return false;	
	// there must be something between @ and .
	if ( i1+1 == i2 ) return false;
	// space in domain name not allowed
	if ( (i2 = s.lastIndexOf(" ")) >= 0 && i2 > i1 ) return false;
	// ensure there are no ? marks in the address
	if ( s.indexOf("?") != -1) return false;
	return true;
}