title: Show Joomla system messages in popup
body: <p>I am not very experienced with Joomla. That is why I need your advice. The idea is to show system messages in popup.
  <p>The solution:
  <p>1. I removed next lines in file libraries\joomla\document\html\renderer\message.php, because I dont need this div</p>
  
  <pre><code>$buffer .= "\n&lt;div id=\"system-message-container\"&gt;";
  $buffer .= "\n&lt;/div&gt;";
  </code></pre>
  
  <p><p>2. In index.php I replaced</p>
  
  <pre><code>&lt;jdoc:include type=”message” /&gt;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>&lt;?php if ($this-&gt;getBuffer('message')) : ?&gt;
  &lt;?php
      $message = $this-&gt;getBuffer('message');
      $script  = '&lt;div id="popup"&gt;&lt;div id="popup-inner"&gt;'.$message.'&lt;/div&gt;&lt;/div&gt;&lt;div id="popup-mask"&gt;&lt;/div&gt;';
      echo $script;
  ?&gt;
  &lt;?php endif; ?&gt; 
  </code></pre>
  
  <p>div#popup is used for popup itself and div#popup-mask for overlay</p>
  
  <p><p>3. I styled #popup and #popup-mask in css</p>
  
  <pre><code>#popup-mask {position: absolute; top: 0; left: 0; z-index: 9997; background: url(../images/bg-overlay.png);}
  #popup {position: fixed; width: 400px; top: 40%; left: 50%; margin-left: -200px; z-index: 9999; background: #e6e6e6; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px;}
  </code></pre>
  
  <p><p>4. And added some jQuery</p>
  
  <pre><code>jQuery.fn.showMask = function () {
      var maskHeight = jQuery(document).height();
      var maskWidth = jQuery(window).width();
      jQuery(this).css({'width':maskWidth,'height':maskHeight});
  };
  jQuery(document).ready(function() {
      if (jQuery('#popup-mask').length){
          jQuery('#popup-mask').showMask();
          jQuery('#popup-mask').click(function () {
              jQuery(this).hide();
              jQuery('#popup').hide();
          });
          jQuery(window).resize (function() {
             jQuery('#popup-mask').showMask();
          });
  }
  });
  </code></pre>
  
  <p><p>It works, but as I have already mentioned I am quite new to Joomla.
  <p><strong>So, the question is:</strong>
  <p>- is this solution ok?
  <p>- how can it be improved?</p>