function popup(mylink, windowname)
{
	if (!window.focus)
	{
		return true;
	}
	var href;
	if (typeof(mylink) == 'string')
	{
		href = mylink;
	}
	else
	{
		href = mylink.href;
	}
	window.open(href, windowname, 'width=624px, scrollbars=yes, resizable=yes');
	return false;
}

function targetopener(mylink, closeme, closeonly)
{
	if (!(window.focus && window.opener))
	{
		return true;
	}
	window.opener.focus();
	if (!closeonly)
	{
		window.opener.location.href = mylink.href;
	}
	if (closeme)
	{
		window.close();
	}
	return false;
}

window.onload = function()
{
	setEvents();
}

function setEvents()
{
	var contactForm;
	if (contactForm = document.getElementById('ContactForm'))
	{
		contactForm.onsubmit = function()
		{
			return validateForm(this);
		}
	}
}

function validateForm(contactForm)
{
	var errors = false;
	if (contactForm.firstname.value == '')
	{
		errors = true;
	}
	if (contactForm.emailadd.value == '')
	{
		errors = true;
	}
	if (contactForm.message.value == '')
	{
		errors = true;
	}
	if (!errors)
	{
		return true;
	}
	else
	{
		alert('Please fill in the required fields')
		return false;
	}
}