function checkform() {
	var boolError = true;
	document.RegisterIRM.firstname.style.borderColor = '';
	document.RegisterIRM.firstname.style.backgroundColor = '';
	document.RegisterIRM.lastname.style.borderColor = '';
	document.RegisterIRM.lastname.style.backgroundColor = '';
	document.RegisterIRM.email.style.borderColor = '';
	document.RegisterIRM.email.style.backgroundColor = '';
	document.getElementById('recaptcha_response_field').style.borderColor = '';
	document.getElementById('recaptcha_response_field').style.backgroundColor = '';
	
	// Check the parameters in the form submission.
	if (document.RegisterIRM.firstname.value == "") {
		document.RegisterIRM.firstname.style.borderColor = 'Red';
		document.RegisterIRM.firstname.style.backgroundColor = 'DarkSalmon';
		boolError = false;
	}
	if (document.RegisterIRM.lastname.value == "") {
		document.RegisterIRM.lastname.style.borderColor = 'Red';
		document.RegisterIRM.lastname.style.backgroundColor = 'DarkSalmon';
		boolError = false;
	}
	if (document.RegisterIRM.email.value == "" || !isValidEmail(document.RegisterIRM.email.value)) {
		document.RegisterIRM.email.style.borderColor = 'Red';
		document.RegisterIRM.email.style.backgroundColor = 'DarkSalmon';
		if (!isValidEmail(document.RegisterIRM.email.value)) {	alert ("Please enter a valid email address, e.g. yourname@domain.com");	}
		boolError = false;	
	}
	if (document.getElementById('recaptcha_response_field').value == "") {
		document.getElementById('recaptcha_response_field').style.borderColor = 'Red';
		document.getElementById('recaptcha_response_field').style.backgroundColor = 'DarkSalmon';
		boolError = false;	
	}
	return boolError;
}

function isValidEmail(str) {
   return (str.indexOf(".") >= 1) && (str.indexOf("@") > 0);
}

function checkError () {
	var objQueryString = new Querystring()
	if (objQueryString.get("error","") != "") {
		document.getElementById('errorMessage').innerHTML = objQueryString.get("error","");
	}
}

// Functions to put into HEAD section of page:
function Querystring()
{
// get the query string, ignore the ? at the front.
	var querystring=location.search.substring(1,location.search.length);

// parse out name/value pairs separated via &
	var args = querystring.split('&');

// split out each name = value pair
	for (var i=0;i<args.length;i++)
	{
		var pair = args[i].split('=');

		// Fix broken unescaping
		temp = unescape(pair[0]).split('+');
		name = temp.join(' ');

		temp = unescape(pair[1]).split('+');
		value = temp.join(' ');

		this[name]=value;
	}
	this.get=Querystring_get;
}

function Querystring_get(strKey,strDefault)
{
	var value=this[strKey];
	if (value==null)
	{
		value=strDefault;
	}

	return value;
}
