function open_header_log_in_popup_lightbox(Action, LoginMessage) {
	if (Action=='login' && $$('textarea.comment_textarea')[0] && $$('textarea.comment_textarea')[0].value.length) {
		ajax_submit_comment($('comment_submit').parentNode,$('comment_submit'));
		return false;
	}
	if (Action=='comment' && GetArticleId()) Action+='|'+GetArticleId();

	Authentication.Authenticate(Action, "footer_login", {Login:"FooterBar.Login",Register:"FooterBar.Register",ForgotPassword:"FooterBar.ForgotPassword"}, {Login:LoginMessage, Close:""});
}

var FooterBar={};

FooterBar.Login=function (Response) {
	var sAction=Response.split('|')[0];
	
	switch (sAction) {
		case 'email':
			top.location.href='/account/email_preferences';
			break;

		case 'portfolio':
			top.location.href='/account/edit_portfolio';
			break;

		case 'write_post':
			top.location.href='/account/write_post';
			break;

		case 'stocktalk':
			var user_id=readCookie('user_id');

			top.location.href='/user/'+user_id+'/stocktalk';
		break;

		case 'login':
			window.location.href = window.location.href;
			break;
	}
}

FooterBar.Register=function () {
	var aHtml=[];

	aHtml.push("<div id='readlater_register_login'>");
		aHtml.push("<div class='email_sent'><h4>Email sent!</h4><div>We've sent confirmation email to your inbox - it includes a link you should follow<br/>to activate your account. If you can't find it, please check your spam filter.</div></div>");
		aHtml.push("<div class='close_quickread_stretchable' onclick='AlphaBox.Close();'><span class='close_left'></span><span class='close_text'>Close</span><span class='close_right'></span></div>");
	aHtml.push("<br class='cleaner'/></div>");

	AlphaBox.Loading();
	AlphaBox.AddHtml(aHtml.join(""));

	if (oRefresher) { oRefresher.Activate() };
}

FooterBar.ForgotPassword=function () {
	var aHtml=[];

	aHtml.push("<div id='readlater_register_login'>");
		aHtml.push("<div class='email_sent'><h4>Email sent!</h4><div>We've sent instructions on how to reset your password to your email inbox.<br/>If you can't find it, please check your spam filter.</div></div>");
		aHtml.push("<div class='close_quickread_stretchable' onclick='AlphaBox.Close();'><span class='close_left'></span><span class='close_text'>Close</span><span class='close_right'></span></div>");
	aHtml.push("<br class='cleaner'/></div>");

	AlphaBox.Loading();
	AlphaBox.AddHtml(aHtml.join(""));

	if (oRefresher) { oRefresher.Activate() };
}