function openSignUpWindow(url){
	var openForm = window.open(url,'newslettersignup', 'height=150,width=300,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,status=no,directories=no');
	if(window.focus) openForm.focus();
}

function checkSignUpForm(formname){
	var msg = "";
	var name = formname.name.value;
	var email = formname.email.value;
	var confirmemail = formname.confirmemail.value;

	if(name == "" || name == "Please enter your name") msg += "Please enter your name.\n";
	if(email == "" || email == "Please enter your e-mail address") msg += "Please enter your e-mail address.\n";
	else if(confirmemail == "" || confirmemail == "Confirm your e-mail address") msg += "Please confirm your e-mail address.\n";
	else if(email != confirmemail) msg += "Please ensure you have entered your e-mail address correctly both times.\n";
	else if(!isValidEmail(email)) msg += "The entered e-mail address is invalid.\n";

	if(msg != "")
	{
		alert("You have not completed the required fields:\n\n" + msg);
		return false;
	} else return true;	
}

function isValidEmail(email) {
	//Regex e-mail check; might be some instances where this won't match, but highly unlikely
	if(email.match(/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/)) return true;
	else return false;
}

function clearField(fieldname) {
	fieldname.value = "";
}
