/**********************************************************
  Validation of the contact form
**********************************************************/
function validateContactForm(Object)
{
	var name	=	Object.sender_name.value;	
	var subject	=	Object.subject.value;
	var content	=	Object.email_content.value;
	var from	=	Object.sender_email.value;
	
	if(!(name == null || name == '' || subject == null || subject == '' || content == null || content == '' || from == null || from == ''))
	{
		if(validate_email(from))
		{
			Object.submit();
		} else {
			alert('Det ser ud som om der er et problem med den specificerede email!\n\n(There seems to be a problem with your email!\nThe syntax is not correct.)');
		}
	} else {
		alert('Du skal udfylde alle felter!\n\n(You need to fill in all fields!)');
	}
}

//Validate email syntax
function validate_email(mail)
{
	apos	= 	mail.indexOf('@')
	dotpos	=	mail.lastIndexOf('.')

	if ((apos < 1) || (dotpos-apos < 2)) 
	{
		return false;
	} else {
		return true;
	}	
}

