//Create MIL namespace, if not already created
if (typeof(MIL)=="undefined") var MIL = {};
//Create MIL.reg namespace, if not already created
if (typeof(MIL.reg)=="undefined") MIL.reg = {};
//Create MIL.reg.validation namespace, if not already created
if (typeof(MIL.reg.validation)=="undefined") MIL.reg.validation = {};
MIL.reg.validation.email = function ( email_address ) {
  var filter = /^([a-zA-Z0-9_\.\-\'])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  if ( filter.test(document.getElementById(email_address).value) ) {
    return true;
  } else {
    return false;
  }
};
MIL.dbURL = "/malvern/malvernreg.nsf";
MIL.setCookie = function (name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = curCookie;
};
MIL.getCookie = function (name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
};
MIL.testCookie = function () {
	MIL.setCookie ( "MalvernTestCookie" , "Testing" );
	if (MIL.getCookie ( "MalvernTestCookie" ) == null) {
		location.replace( MIL.dbURL + '/frmCookieError?openform');
	}
};
MIL.goBack = function () {
	window.location.href = this.getCookie("eventView");
};

