function redirectthankyoupage(languageId) 
{ 
	if (languageId == 1)
	{
		document.location.href="index.php?view=page&id=8"; 
	}
	else
	{
		document.location.href="index.php?view=page&id=24";
	}
}

function ClearTextBox(id)
{
	var textBox = document.getElementById(id);
	
	if (textBox != null)
	{
		if (textBox.value == 'Zoek op trefwoord' || textBox.value == 'Suche nach Stichwort')
		{
			textBox.value = '';
		}
	}
}

function FillTextBox(id, languageId)
{
	var textBox = document.getElementById(id);
	
	if (textBox != null)
	{
		if (textBox.value == '')
		{
			if (languageId == 1)
			{
				textBox.value = 'Zoek op trefwoord';
			}
			else if (languageId == 3)
			{
				textBox.value = 'Suche nach Stichwort';
			}
		}
	}
}

function setFocus(id)
{
	setTimeout("focusObject('" + id + "');", 100);
}

function focusObject(id)
{
	var obj = document.getElementById(id);
	obj.focus();
}

function validateFormReact()
{
	var result = true;
	var _name, _email, _reaction;
	with(window.document.react)
	{
		_name = name;
		_email = email;
		_reaction = reaction;
	}
	
	if (trim(_name.value) == '')
	{
		document.getElementById('name_validationfield').style.display = 'block';
		_name.focus();
		result = false;
	}
	else
	{
		document.getElementById('name_validationfield').style.display = 'none';
	}

	if (trim(_email.value) == '')
	{
		document.getElementById('email_validationfield').style.display = 'block';
		_email.focus();
		result = false;
	}
	else
	{
		document.getElementById('email_validationfield').style.display = 'none';
	}

	if (!trim(_reaction.value))
	{
		document.getElementById('reaction_validationfield').style.display = 'block';
		_reaction.focus();
		result = false;
	}
	else
	{
		document.getElementById('reaction_validationfield').style.display = 'none';
	}
	
	_name.value = trim(_name.value);
	_email.value = trim(_email.value);
	_reaction.value = trim(_reaction.value);

	return result;
}

function validateFormSendEmail()
{
	var result = true;
	var _name, _email, _friendsname, _friendsemail;
	with(window.document.email)
	{
		_name = name;
		_email = email;
		_friendsname = friendsname;
		_friendsemail = friendsemail;
	}
	
	if (trim(_name.value) == '')
	{
		document.getElementById('name_validationfield').style.display = 'block';
		_name.focus();
		result = false;
	}
	else
	{
		document.getElementById('name_validationfield').style.display = 'none';
	}

	if (!isEmail(trim(_email.value)))
	{
		document.getElementById('email_validationfield').style.display = 'block';
		_email.focus();
		result = false;
	}
	else
	{
		document.getElementById('email_validationfield').style.display = 'none';
	}

	if (trim(_friendsname.value) == '')
	{
		document.getElementById('friendsname_validationfield').style.display = 'block';
		_friendsname.focus();
		result = false;
	}
	else
	{
		document.getElementById('friendsname_validationfield').style.display = 'none';
	}
	
	if (!isEmail(trim(_friendsemail.value)))
	{
		document.getElementById('friendsemail_validationfield').style.display = 'block';
		_friendsemail.focus();
		result = false;
	}
	else
	{
		document.getElementById('friendsemail_validationfield').style.display = 'none';
	}

	_name.value = trim(_name.value);
	_email.value = trim(_email.value);
	_friendsname.value = trim(_friendsname.value);
	_friendsemail.value = trim(_friendsemail.value);

	return result;
}

function validateFormZakelijk()
{
	var result = true;
	var _company, _contactperson, _email, _phone;
	with(window.document.zakelijk)
	{
		_company = company;
		_contactperson = contactperson;
		_email = email;
		_phone = phone;
	}
	
	if (trim(_company.value) == '')
	{
		document.getElementById('company_validationfield').style.display = 'block';
		_company.focus();
		result = false;
	}
	else
	{
		document.getElementById('company_validationfield').style.display = 'none';
	}

	if (trim(_contactperson.value) == '')
	{
		document.getElementById('contactperson_validationfield').style.display = 'block';
		_contactperson.focus();
		result = false;
	}
	else
	{
		document.getElementById('contactperson_validationfield').style.display = 'none';
	}

	if (!isEmail(trim(_email.value)))
	{
		document.getElementById('email_validationfield').style.display = 'block';
		_email.focus();
		result = false;
	}
	else
	{
		document.getElementById('email_validationfield').style.display = 'none';
	}
	
	if (trim(_phone.value) == '')
	{
		document.getElementById('phone_validationfield').style.display = 'block';
		_phone.focus();
		result = false;
	}
	else
	{
		document.getElementById('phone_validationfield').style.display = 'none';
	}

	_company.value = trim(_company.value);
	_contactperson.value = trim(_contactperson.value);
	_email.value = trim(_email.value);
	_phone.value = trim(_phone.value);

	return result;
}

function validateFormParticulier()
{
	var result = true;
	var _name, _address, _zipcode, _city, _phone, _email, _boattype, _dimensions, _boatcity;
	with(window.document.particulier)
	{
		_name = name;
		_address = address;
		_zipcode = zipcode;
		_city = city;
		_phone = phone;
		_email = email;
		_boattype = boattype;
		_dimensions = dimensions;
		_boatcity = boatcity;
	}
	
	if (trim(_name.value) == '')
	{
		//alert('Naam is verplicht');
		document.getElementById('name_validationfield').style.display = 'block';
		_name.focus();
		result = false;
	}
	else
	{
		document.getElementById('name_validationfield').style.display = 'none';
	}
	
	if (trim(_address.value) == '')
	{
		document.getElementById('address_validationfield').style.display = 'block';
		_address.focus();
		result = false;
	}
	else
	{
		document.getElementById('address_validationfield').style.display = 'none';
	}
	
	if (trim(_zipcode.value) == '')
	{
		document.getElementById('zipcode_validationfield').style.display = 'block';
		_zipcode.focus();
		result = false;
	}
	else
	{
		document.getElementById('zipcode_validationfield').style.display = 'none';
	}
	
	if (trim(_city.value) == '')
	{
		document.getElementById('city_validationfield').style.display = 'block';
		_city.focus();
		result = false;
	}
	else
	{
		document.getElementById('city_validationfield').style.display = 'none';
	}
	
	if (trim(_phone.value) == '')
	{
		document.getElementById('phone_validationfield').style.display = 'block';
		_phone.focus();
		result = false;
	}
	else
	{
		document.getElementById('phone_validationfield').style.display = 'none';
	}
	
	if (!isEmail(trim(_email.value)))
	{
		document.getElementById('email_validationfield').style.display = 'block';
		_email.focus();
		result = false;
	}
	else
	{
		document.getElementById('email_validationfield').style.display = 'none';
	}
	
	if (trim(_boattype.value) == '')
	{
		document.getElementById('boattype_validationfield').style.display = 'block';
		_boattype.focus();
		result = false;
	}
	else
	{
		document.getElementById('boattype_validationfield').style.display = 'none';
	}
	
	if (trim(_dimensions.value) == '')
	{
		document.getElementById('dimensions_validationfield').style.display = 'block';
		_dimensions.focus();
		result = false;
	}
	else
	{
		document.getElementById('dimensions_validationfield').style.display = 'none';
	}
	
	if (trim(_boatcity.value) == '')
	{
		document.getElementById('boatcity_validationfield').style.display = 'block';
		_boatcity.focus();
		result = false;
	}
	else
	{
		document.getElementById('boatcity_validationfield').style.display = 'none';
	}

	_name.value = trim(_name.value);
	_address.value = trim(_address.value);
	_zipcode.value = trim(_zipcode.value);
	_city.value = trim(_city.value);
	_phone.value = trim(_phone.value);
	_email.value = trim(_email.value);
	_boattype.value = trim(_boattype.value);
	_dimensions.value = trim(_dimensions.value);
	_boatcity.value = trim(_boatcity.value);

	return result;
}

function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}

function isEmail(str)
{
	var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;

	return regex.test(str);
}