function validate( form )
{
	var inputs = form.getElementsByTagName('input');

	for( var i=0; i<inputs.length; i++ )
	{

		if ( inputs[i].value == "" && inputs[i].type == "text" )
		{
			document.getElementById('err').style.display = 'block';
			inputs[i].focus();

			return false;
		}

		if ( inputs[i].name == "email" )
		{
			if ( !IsEmail(inputs[i].value) )
			{
				document.getElementById('err').innerHTML = "Onjuist e-mailadres.";
				document.getElementById('err').style.display = 'block';
				inputs[i].select();
				inputs[i].focus();
				return false;
			}
		}
	}
	return true;
}

function validate2( form )
{
	var inputs = form.getElementsByTagName('input');

	for( var i=0; i<inputs.length; i++ )
	{

		if ( inputs[i].name == "contactpersoon" )
		{
			if(inputs[i].value == ""){
				document.getElementById('err').innerHTML = "Vul u naam in.";
				document.getElementById('err').style.display = 'block';
				inputs[i].select();
				inputs[i].focus();
				return false;
			}
		}
		
		if(inputs[i].name == "telefoon")
		{
			if(inputs[i].value == ""){
				document.getElementById('err').innerHTML = "Vul u telefoonnummer in.";
				document.getElementById('err').style.display = 'block';
				inputs[i].select();
				inputs[i].focus();
				return false;
			}
		}

		if(inputs[i].name == "email")
		{
			if(inputs[i].value == ""){
				document.getElementById('err').innerHTML = "Vul u e-mailadres in.";
				document.getElementById('err').style.display = 'block';
				inputs[i].select();
				inputs[i].focus();
				return false;
			}
		}
		
		if ( inputs[i].name == "email" )
		{
			if ( !IsEmail(inputs[i].value) )
			{
				document.getElementById('err').innerHTML = "Onjuist e-mailadres.";
				document.getElementById('err').style.display = 'block';
				inputs[i].select();
				inputs[i].focus();
				return false;
			}
		}
	}
	return true;
}

function IsEmail( sText )
{
	return ( sText.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1 || sText == null || sText.length == 0)
}




function UpdateAantal( ArtikelId, Aantal, WebshopModule )
{
	location.href = "?id=webshop," + WebshopModule + "&item=" + ArtikelId + "&aantal=" + Aantal;
}


function send( form, action)
{
	form.action = action;
	form.submit();
}
