var members = function() {
	this.__construct = function(manager, name) {
		comments.prototype.__construct.call(this, manager, name);

		this.ErrorMsg = new Array();
		this.ErrorMsg[0] = "<h3>Success</h3><p>Congratulations, your email-address been added to our newsletter list.</p>";
		this.ErrorMsg[1] = "<h3>Captcha error</h3><p>You've entered the wrong code. Please try again.</p>";
		this.ErrorMsg[2] = "<h3>Email-address error</h3><p>Your name and email-address can't be compiled to a valid address string.</p><p>Please try to avoid special characters in your name and ensure that you've entered<br />your email-address correctly.</p>";
		this.ErrorMsg[3] = "<h3>Email-address error</h3><p>The email-address you've entered is already in our list.</p>";
	}
	
	this.confirm = function(id) {
		if (document.forms[id].elements["code"].value == "")
			return alert("Please enter your code.");
		if (document.forms[id].elements["email"].value == "")
			return alert("Please enter your email address.");
		
		swx_Dialog.show("membersUNIQUEconfirmResult");
		var result = this.execute("confirm", document.forms[id].elements["code"].value, document.forms[id].elements["email"].value);
		document.forms[id].elements["code"].value = "";
		swx_Dialog.update("membersUNIQUEconfirmResult", "<p>"+result+"</p><p class=\"Footer\"><button type=\"submit\">OK</button></p>", "javascript:swx_Dialog.hide('membersUNIQUEconfirmResult');");
	}
	
	this.register = function(id) {
		var dialog = document.getElementById(id);
		
		if (document.forms[id].elements["name"].value == "")
			return alert("Please enter your name.");
		if (document.forms[id].elements["email"].value == "")
			return alert("Please enter your email address.");
		if (document.forms[id].elements["SWX_CAPTCHA"].value == "")
			return alert("Please enter the captcha code.");
			
		var formName = document.forms[id].elements["name"].value;
		var formEmail = document.forms[id].elements["email"].value;
		var formCaptcha = document.forms[id].elements["SWX_CAPTCHA"].value;
			
		swx_Dialog.update(id, "<p>Registration in progress...</p>");
		
		var result = this.execute("register", formName, formEmail, formCaptcha);
		swx_Dialog.update(id, this.ErrorMsg[result]+"<p class=\"Footer\"><button type=\"submit\">OK</button></p>", "javascript:swx_Dialog.hide('"+id+"');");
	}
	
	this.ErrorMsg = undefined;
};
members.prototype = new swx_BloxFrontendModule();

