function article_tools_hide() {
    var popout = $(".article_tools_popout");
    popout.add(popout.parent()).add(popout.children()).css('z-index', 0);
    popout.hide();
}

function article_tools_popout(id, area) {
    var popout = $("#toolbar_"+id+" .article_tools_"+area);
    article_tools_hide();
    popout.show();
	popout.css({ 'top' : popout.parent().css('top'), 'left' : popout.parent().css('left') });
    popout.add(popout.parent()).add(popout.children()).css('z-index', 200000);
    return false;
}

function article_tools_email_submit(theForm) {
    var from_email = $(theForm).find(".email_from").val();
    var to_email = $(theForm).find(".email_to").val();
    var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
    if(!re_mail.test(from_email) || !re_mail.test(to_email)) {
	email_setStatus(theForm, 'Please check the email addresses.');
	return false;
    }
    email_submit_ticket(theForm);
    return false;
}

var set_article_tools_document_click_event = false;

function toolhover(id, area) {
    $("#toolbar_"+id+" .action_"+area).click(
      function () {
	article_tools_popout(id, area);
    });
    $("#toolbar_"+id+" .article_tools_"+area).hover(
      function () {

      },
      function () {
	article_tools_hide();
      }
    );

}
