function checkRegistrationForm(theForm) {
	if(theForm.firstname.value==""){
		alert("You must enter your firstname.");
		return(false);
	}

	if(theForm.surname.value==""){
		alert("You must enter your surname.");
		return(false);
	}

	if(theForm.email.value==""){
		alert("You must enter an email address.");
		return(false);
	}
	
	if(theForm.phone.value==""){
		alert("You must enter a phone number");
		return(false);
	}
	
	
	var emailReg =/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
	if(!emailReg.exec(theForm.email.value)){
		alert("Please enter a valid email address");
		return(false)
	}
	theForm.submit();
}

// http://ejohn.org/apps/jselect/event.html

function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
    obj.attachEvent( "on"+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}

/*

// addEvent code from:
// http://www.jsfromhell.com/contest/quirksmode/addEvent.html

//use it to add infinite event handlers to an element, o = element, e = event name (without the "on" prefix), f = function handler (it receives the event as first param and the "this" references to the element)
function addEvent(o, e, f){
	var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [o[e]] : []), a;
	r[r.length] = f, o[e] = function(e){
		try{
			(e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
			e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
			e.target || (e.target = e.srcElement || null);
			e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
		}catch(f){}
		for(f in r)
			a = r[f], a.call ? a.call(o, e) : (o._ = a, o._(e), o._ = null);
		e = null;
	}
};

//use it to remove an event handler from an element, o = element, e = event name (without the "on" prefix), f = function handler
function removeEvent(o, e, f){
	for(var i in e = o["_on" + e])
		if(e[i] == f)
			return delete e[i];
	return false;
};*/