Function up (str ){
Str = str. replace (/</ig, '& lt ;');
Str = str. replace (/>/ig, '& gt ;');
Str = str. replace (/n/ig, '<br/> ');
Str = str. replace (/[code] (. + ?) [/Code]/ig, function ($1, $2) {return phpcode ($2 );});
Str = str. replace (/[hr]/ig, 'Str = str. replace (/[/(size | color | font | backcolor)]/ig, '</font> ');
Str = str. replace (/[(sub | sup | u | I | strike | B | blockquote | li)]/ig, '<$1> ');
Str = str. replace (/[/(sub | sup | u | I | strike | B | blockquote | li)]/ig, '</$1> ');
Str = str. replace (/[/align]/ig, '</p> ');
Str = str. replace (/[(/)? H ([1-6])]/ig, '<$1 h $2> ');
Str = str. replace (/[align = (left | center | right | justify)]/ig, '<p align = "$1"> ');
Str = str. replace (/[size = (d +?)] /Ig, '<font size = "$1"> ');
Str = str. replace (/[color = ([^ [<] +?)] /Ig, '<font color = "$1"> ');
Str = str. replace (/[backcolor = ([^ [<] +?)] /Ig, '<font style = "background-color: $1"> ');
Str = str. replace (/[font = ([^ [<] +?)] /Ig, '<font face = "$1"> ');
Str = str. replace (/[list = (a | A | 1)] (. + ?) [/List]/ig, '<ol type = "$1"> $2 </ol> ');
Str = str. replace (/[(/)? List]/ig, '<$ 1ul> ');
Str = str. replace (/[s :( d +)]/ig, function ($1, $2) {return smilepath ($2 );});
Str = str. replace (/[img] ([^ [] *) [/img]/ig, ' ');
Str = str. replace (/[url = ([^] +)] ([^ [] +) [/url]/ig, '<a href = "$1">' + '$2' + '</a> ');
Str = str. replace (/[url] ([^ [] +) [/url]/ig, '<a href = "$1">' + '$1' + '</a> ');
Return str;
}
Function ubbtohtml (){
Str = up (document. getElementById ("ubbsource"). value );
Document. getElementById ("htmlresult"). value = str;
}