/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 18 April 2005 16:26:58
 Comment auto-previewing facility
 Allowed tags: a,i,em,b,strong,p
 - - - - - - - - - - - - - - - - - - - - - - - */

function reloadComment(source,target)
{
   text = document.getElementById(source).value;

   text = text.replace(/</g,"&lt;");
   text = text.replace(/>/g,"&gt;");
   text = text.replace(/\n/g,"<br />");
   text = text.replace(/&lt;a(.*)href=[\'\"]?([^\"\'>]+)[\'\"]?(.*)&gt;(.*)&lt;\/a&gt;/gi,"<a $1 href=\"$2\" $3>$4</a>");
   text = text.replace(/&lt;a(.*)href=[\'\"]?([^\"\'>]+)[\'\"]?(.*)&gt;/gi,"<a $1 href=\"$2\" $3>$2</a>");
   text = text.replace(/&lt;i&gt;(.*)&lt;\/i&gt;/gi,"<em>$1</em>");
   text = text.replace(/&lt;b&gt;(.*)&lt;\/b&gt;/ig,"<strong>$1</strong>");
   text = text.replace(/&lt;em&gt;(.*)&lt;\/em&gt;/ig,"<em>$1</em>");
   text = text.replace(/&lt;strong&gt;(.*)&lt;\/strong&gt;/gi,"<strong>$1</strong>");
   text = text.replace(/&lt;p&gt;(.*)&lt;\/p&gt;/gi,"<p>$1</p>");

   output = document.getElementById(target);

   output.innerHTML = text;
}