function ShowMessage(Text)
{
  var Closing = false;
  var CloseBtn = null;
  
  var MsgDiv = $('<table class="error"><tr><td style="width: 64px; vertical-align: middle; padding: 15px; padding-right: 0"><img src="content/images/error.png" height="64" width="64"/></td><td style="vertical-align: middle; padding: 15px" class="msg_text">Текст сообщения</td></tr></table>');
  MsgDiv.find('.msg_text').html(Text);
  MsgDiv.css('height', 'auto').appendTo('body');

  var Height = MsgDiv.height(),
      Width = MsgDiv.width();

  var EscAction = function(e)
  {
    if (e.keyCode == 27)
      CloseBtn.click();
  };
      
  CloseBtn = $('<img src="content/images/cross.png" title="Закрыть окно"/>').appendTo(MsgDiv.find('.msg_text'));
  CloseBtn.css({
    'cursor': 'pointer',
    'position': 'absolute',
    'left': Width - 17,
    'top': 2
  }).click(function() {
    Closing = true;
    MsgDiv.animate({
      'opacity': 0,
      'height': 0,
      'width': 0,
      'top': $(document).scrollTop() + $(window).height(),
      'left': $(window).width()
    }, 500, 'linear', function() { MsgDiv.hide().remove(); });
      
    $(document).unbind('keydown', EscAction);
  });

  $(document).bind('keydown', EscAction);
  MsgDiv.css({
    'opacity': 0,
    'height': 0,
    'width': 0,
    'top': $(document).scrollTop() + $(window).height(),
    'left': 0,
    'z-index': 1
  }).animate({
    'opacity': 1,
    'width': Width,
    'height': Height,
    'top': $(document).scrollTop() + ($(window).height() - Height)/2,
    'left': ($(window).width() - Width)/2
  }, 500);
    
  setTimeout(function()
  { 
    if (!Closing)
    {
      CloseBtn.click();
    }
  }, 2500);
}

