function HMXSignInWidget (post_url, dom_ids)
{
	this.post_url = post_url;
	this.dom_ids  = dom_ids;
}

HMXSignInWidget.prototype.show_form = function ()
{
	$(this.dom_ids.form_container).show ();
}

HMXSignInWidget.prototype.submit = function ()
{
	username_value = $(this.dom_ids.username_input).val ();
	password_value = $(this.dom_ids.password_input).val ();
	remember_value = (typeof ($(this.dom_ids.remember_input + ':checked').val ()) != 'undefined');

	this_ref = this;

	$.ajax ({
		type:     'POST',
		dataType: 'json',
		url:      this.post_url,
		success:  function (data, status) { this_ref.handleResponse (data); },
		data: {
			username: username_value,
			password: password_value,
			remember: remember_value }});

	return false;
}

HMXSignInWidget.prototype.handleResponse = function (authenticated)
{
	if (authenticated)
		location.reload ();
	else
		$(this.dom_ids.error_container).show ();
}

