<?php

//What? Why do I care if admin level isn't set?

if (!isset($cAdminLevel))
{
    print "ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL ADMIN LEVEL";
    EXIT;
}

if ($donefunction != "replace")
{
    function stri_replace( $find, $replace, $string )
    {
       $parts = explode( strtolower($find), strtolower($string) );
       $pos = 0;
       foreach( $parts as $key=>$part ){
           $parts[ $key ] = substr($string, $pos, strlen($part));
           $pos += strlen($part) + strlen($find);
           }
       return( join( $replace, $parts ) );
    }

    $donefunction = "replace";
}


 //first the text formatting

    //Get rid of ALL html Code...

    $postthis = stri_replace ( "<", "&lt;", $postthis);
    $postthis = stri_replace ( ">", "&gt;", $postthis);

    //Add Line Breaks and spaces

    $postthis = nl2br("$postthis");
    $postthis = str_replace ( "  ", " &nbsp;", $postthis);


    //Add a little snippet to display the name of the user reading it in the forums...

    $postthis = stri_replace ( "[USER]", "$gfcookie[1]", $postthis);
    $postthis = stri_replace ( "[NAME]", "$gfcookie[1]", $postthis);

    //...And the PM section... (This line will generate a warning if it is called from anywhere but the PM section.

    $postthis = stri_replace ( "[MAILUSER]", "$a_row->strTo", $postthis);

    //now we can change forum code into HTML

    $postthis = stri_replace ( "[B]", "<b>", $postthis);
    $postthis = stri_replace ( "[/B]", "</b>", $postthis);
    $postthis = stri_replace ( "[I]", "<i>", $postthis);
    $postthis = stri_replace ( "[/I]", "</i>", $postthis);
    $postthis = stri_replace ( "[U]", "<u>", $postthis);
    $postthis = stri_replace ( "[/U]", "</u>", $postthis);
    $postthis = stri_replace ( "[HR]", "<hr>", $postthis);
    $postthis = stri_replace ( "[BR]", "<br>", $postthis);
    $postthis = stri_replace ( "[SIZE1]", "<font size=1>", $postthis);
    $postthis = stri_replace ( "[SIZE2]", "<font size=2>", $postthis);
    $postthis = stri_replace ( "[SIZE3]", "<font size=3>", $postthis);
    $postthis = stri_replace ( "[SIZE4]", "<font size=4>", $postthis);
    $postthis = stri_replace ( "[SIZE5]", "<font size=5>", $postthis);
    $postthis = stri_replace ( "[SIZE6]", "<font size=6>", $postthis);
    $postthis = stri_replace ( "[BLACK]", "<font color=black>", $postthis);
    $postthis = stri_replace ( "[WHITE]", "<font color=white>", $postthis);
    $postthis = stri_replace ( "[RED]", "<font color=red>", $postthis);
    $postthis = stri_replace ( "[GREEN]", "<font color=green>", $postthis);
    $postthis = stri_replace ( "[BLUE]", "<font color=blue>", $postthis);
    $postthis = stri_replace ( "[NAVY]", "<font color=navy>", $postthis);
    $postthis = stri_replace ( "[CURL]", "<a ", $postthis);
    $postthis = stri_replace ( "[IURL]", "<a ", $postthis);
    $postthis = stri_replace ( "[URL]", "<a target=\"_blank\" ", $postthis);
    $postthis = stri_replace ( "[LINK]=", "href=\"", $postthis);
    $postthis = stri_replace ( "[/LINK]", "\">", $postthis);
    $postthis = stri_replace ( "[/URL]", "</a>", $postthis);
    $postthis = stri_replace ( "[CENTER]", "<center>", $postthis);
    $postthis = stri_replace ( "[/CENTER]", "</center>", $postthis);
    $postthis = stri_replace ( "[LEFT]", "<left>", $postthis);
    $postthis = stri_replace ( "[/LEFT]", "</left>", $postthis);
    $postthis = stri_replace ( "[RIGHT]", "<p align=right>", $postthis);
    $postthis = stri_replace ( "[/RIGHT]", "</p>", $postthis);
    $postthis = stri_replace ( "[IMG SRC]=", "<img border=0 src=\"", $postthis);
    $postthis = stri_replace ( "[H]=", " height=", $postthis);
    $postthis = stri_replace ( "[W]=", "\" width=", $postthis);
    $postthis = stri_replace ( "[/IMG]", "\">", $postthis);
    $postthis = stri_replace ( "[LIST]", "<ul><li>", $postthis);
    $postthis = stri_replace ( "[/LIST]", "</li></ul>", $postthis);
    $postthis = stri_replace ( "[UL]", "<ul>", $postthis);
    $postthis = stri_replace ( "[LI]", "<li>", $postthis);
    $postthis = stri_replace ( "[/UL]", "</ul>", $postthis);
    $postthis = stri_replace ( "[/LI]", "</li>", $postthis);
    $postthis = stri_replace ( "[MARQUEE]", "<marquee>", $postthis);
    $postthis = stri_replace ( "[/MARQUEE]", "</marquee>", $postthis);
    $postthis = stri_replace ( "[QUOTE]", "<center><table border=0 width=100% bgcolor=\"$quotebackcolor\"><tr><td><font face=\"$font\" color=\"$quotefontcolor\" size=1>", $postthis);
    $postthis = stri_replace ( "[/QUOTE]", "</td></tr></table></center>", $postthis);
    $postthis = stri_replace ( "[CODE]", "<br><br><center><table border=0 width=100% bgcolor=$afgcolour><tr><td><font face=\"Courier New\" color=#666666 size=2>", $postthis);
    $postthis = stri_replace ( "[/CODE]", "</td></tr></table></center><font face=\"$font\" size=2 color=\"$fontcolor\">", $postthis);

    $pos = strpos($postthis, "/me");
    if ($pos === false)
    {
        //not found
    }
    else
    {
        // The code below makes /me act like its IRC equivelent...
        if ($a_row->strFrom != "")
        {
            $postthis = stri_replace ( "/me", "<font color=\"$swearcolor\">* $a_row->strFrom", $postthis);
        }
        else
        {
            $postthis = stri_replace ( "/me", "<font color=\"$swearcolor\">* $a_row->strName", $postthis);
        }

        $postthis = stri_replace ( "<br />", "<font color=\"$fontcolor\"><br />", $postthis);
    }

    if ($cAdminLevel > 1)
    {
        $postthis = stri_replace ( "[swear]", "<font color=\"$swearcolor\">", $postthis);
        $postthis = stri_replace ( "[/swear]", "<font color=\"$fontcolor\">", $postthis);
    }
    else
    {
        $postthis = stri_replace ( "[swear]", "", $postthis);
        $postthis = stri_replace ( "[/swear]", "", $postthis);
    }


    $postthis = stri_replace ( "[EDITBOX]", "<br><br><center><table width=100% bgcolor=\"#D2FFE9\" cellspacing=0 cellpadding=3 border=1 bordercolor=\"#00C462\"><tr><td><font color=#444444 size=2>", $postthis);
    $postthis = stri_replace ( "[/EDITBOX]", "</td></tr></table></center><font face=$font size=2 color=black><br>", $postthis);

    $postthis = stri_replace ( "\"http://", "\"htt*p:/*/", $postthis); // for images and forum links


   $postthis = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i",    "$1http://$2", $postthis); //make sure there is an http:// on all URLs
    $postthis = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i", "<A TARGET=\"_blank\" HREF=\"$1\">$1</A>", $postthis); //make all URLs links

    //$postthis = preg_replace("/(([\w\.]+))(@)([\w\.]+)\b/i","<a href=\"mailto:$0\">$0</a>",$postthis);

    $postthis = stri_replace ( "\"htt*p:/*/", "\"http://", $postthis);





 //now the smilies! (This was sooooooooooo labourious!) - Grim...

    $postthis = stri_replace ( "?:(", "<IMG SRC=\"images/smilies/confused[1].gif\">", $postthis);
    $postthis = stri_replace ( ":)", "<IMG SRC=\"images/smilies/smile[1].gif\">", $postthis);
    $postthis = str_replace ( ":D", "<IMG SRC=\"images/smilies/teeth[1].gif\">", $postthis);
    $postthis = str_replace ( ":P", "<IMG SRC=\"images/smilies/tongue[1].gif\">", $postthis);
    $postthis = stri_replace ( ":(", "<IMG SRC=\"images/smilies/worry[1].gif\">", $postthis);
    $postthis = stri_replace ( ":'(", "<IMG SRC=\"images/smilies/cry-anim[1].gif\">", $postthis);
    $postthis = stri_replace ( ":angry:", "<IMG SRC=\"images/smilies/angryfire[1].gif\">", $postthis);
    $postthis = stri_replace ( ":[)", "<IMG SRC=\"images/smilies/biggrin1[1].gif\">", $postthis);
    $postthis = stri_replace ( ":talk:",
    "<IMG SRC=\"images/smilies/talker[1].gif\">", $postthis);
    $postthis = stri_replace ( ":laugh:",
    "<IMG SRC=\"images/smilies/laughing[1].gif\">", $postthis);
    $postthis = stri_replace ( " LOL ", " <IMG SRC=\"images/smilies/laughing[1].gif\"> ", $postthis);
    $postthis = stri_replace ( " Lol ", " <IMG SRC=\"images/smilies/laughing[1].gif\"> ", $postthis);
    $postthis = stri_replace ( " lol ", " <IMG SRC=\"images/smilies/laughing[1].gif\"> ", $postthis);
    $postthis = stri_replace ( " LOl ", " <IMG SRC=\"images/smilies/laughing[1].gif\"> ", $postthis);
    $postthis = stri_replace ( ":rolleyes:", "<IMG SRC=\"images/smilies/rolleyes[1].gif\">", $postthis);
    $postthis = stri_replace ( ":trippy:", "<IMG SRC=\"images/smilies/pulse[1].gif\">", $postthis);
    $postthis = stri_replace ( ":stareup:", "<IMG SRC=\"images/smilies/stareup[1].gif\">", $postthis);
    $postthis = stri_replace ( ":spin:", "<IMG SRC=\"images/smilies/Spiny[1].gif\">", $postthis);
    $postthis = stri_replace ( ":grr:", "<IMG SRC=\"images/smilies/mad[1].gif\">", $postthis);
    $postthis = stri_replace ( ":x", "<IMG SRC=\"images/smilies/kiss[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bang:", "<IMG SRC=\"images/smilies/boom[1].gif\">", $postthis);
    $postthis = stri_replace ( ";)", "<IMG SRC=\"images/smilies/wink[1].gif\">", $postthis);
    $postthis = stri_replace ( ":sp1n:", "<IMG SRC=\"images/smilies/spin[1].gif\">", $postthis);
    $postthis = stri_replace ( ":nonono:", "<IMG SRC=\"images/smilies/nono[1].gif\">", $postthis);
    $postthis = stri_replace ( ":nooo:", "<IMG SRC=\"images/smilies/banghead[1].gif\">", $postthis);
    $postthis = stri_replace ( ":eek:", "<IMG SRC=\"images/smilies/eek[1].gif\">", $postthis);
    $postthis = stri_replace ( ":naughty:", "<IMG SRC=\"images/smilies/naughty[1].gif\">", $postthis);
    $postthis = stri_replace ( ":burp:", "<IMG SRC=\"images/smilies/oh[1].gif\">", $postthis);
    $postthis = stri_replace ( ":18:", "<IMG SRC=\"images/smilies/18[1].gif\">", $postthis);
    $postthis = stri_replace ( ":afr0:", "<IMG SRC=\"images/smilies/afr0[1].gif\">", $postthis);
    $postthis = stri_replace ( ":afro:", "<IMG SRC=\"images/smilies/afro[1].gif\">", $postthis);
    $postthis = stri_replace ( ":alien:", "<IMG SRC=\"images/smilies/alien[1].gif\">", $postthis);
    $postthis = stri_replace ( ":amidala:", "<IMG SRC=\"images/smilies/amidala[1].gif\">", $postthis);
    $postthis = stri_replace ( ":angel:", "<IMG SRC=\"images/smilies/angel[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bagpuss:", "<IMG SRC=\"images/smilies/bagpuss[1].gif\">", $postthis);
    $postthis = stri_replace ( ":banana:", "<IMG SRC=\"images/smilies/banana[1].gif\">", $postthis);
    $postthis = stri_replace ( ":amigo:", "<IMG SRC=\"images/smilies/bandit[1].gif\">", $postthis);
    $postthis = stri_replace ( ":batman:", "<IMG SRC=\"images/smilies/batman[1].gif\">", $postthis);
    $postthis = stri_replace ( ":beer:", "<IMG SRC=\"images/smilies/beer[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bigcry:", "<IMG SRC=\"images/smilies/bigcry2[1].gif\">", $postthis);
    $postthis = stri_replace ( ":b1gcry:", "<IMG SRC=\"images/smilies/bigcry[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bomb:", "<IMG SRC=\"images/smilies/bomb[1].gif\">", $postthis);
    $postthis = stri_replace ( ":hulk:", "<IMG SRC=\"images/smilies/bonce[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bond:", "<IMG SRC=\"images/smilies/bond[1].gif\">", $postthis);
    $postthis = stri_replace ( ":borg:", "<IMG SRC=\"images/smilies/borg[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bounce:", "<IMG SRC=\"images/smilies/bounce[1].gif\">", $postthis);
    $postthis = stri_replace ( ":b0unce:", "<IMG SRC=\"images/smilies/bounce2[1].gif\">", $postthis);
    $postthis = stri_replace ( ":cartman:", "<IMG SRC=\"images/smilies/cartman[1].gif\">", $postthis);
    $postthis = stri_replace ( ":cheesy:", "<IMG SRC=\"images/smilies/cheese[1].gif\">", $postthis);
    $postthis = stri_replace ( "8)", "<IMG SRC=\"images/smilies/cool[1].gif\">", $postthis);
    $postthis = stri_replace ( ":crow:", "<IMG SRC=\"images/smilies/crow[1].gif\">", $postthis);
    $postthis = stri_replace ( ":cry:", "<IMG SRC=\"images/smilies/cry-anim[1].gif\">", $postthis);
    $postthis = stri_replace ( ":daisy:", "<IMG SRC=\"images/smilies/daisy[1].gif\">", $postthis);
    $postthis = stri_replace ( ":dalek:", "<IMG SRC=\"images/smilies/dalek[1].gif\">", $postthis);
    $postthis = stri_replace ( ":dead:", "<IMG SRC=\"images/smilies/dead[1].gif\">", $postthis);
    $postthis = stri_replace ( ":d3ad:", "<IMG SRC=\"images/smilies/deadhead[1].gif\">", $postthis);
    $postthis = stri_replace ( ":deviant:", "<IMG SRC=\"images/smilies/deviant[1].gif\">", $postthis);
    $postthis = stri_replace ( ":devil:", "<IMG SRC=\"images/smilies/devil[1].gif\">", $postthis);
    $postthis = stri_replace ( ":disgust:", "<IMG SRC=\"images/smilies/disgust[1].gif\">", $postthis);
    $postthis = stri_replace ( ":dog:", "<IMG SRC=\"images/smilies/doggy-anim[1].gif\">", $postthis);
    $postthis = stri_replace ( ":doom:", "<IMG SRC=\"images/smilies/doom[1].gif\">", $postthis);
    $postthis = stri_replace ( ":sleepy:", "<IMG SRC=\"images/smilies/dozey[1].gif\">", $postthis);
    $postthis = stri_replace ( ":duel:", "<IMG SRC=\"images/smilies/duel[1].gif\">", $postthis);
    $postthis = stri_replace ( ":elmo:", "<IMG SRC=\"images/smilies/elmo[1].gif\">", $postthis);
    $postthis = stri_replace ( ":embarrass:", "<IMG SRC=\"images/smilies/embarass[1].gif\">", $postthis);
    $postthis = stri_replace ( ":farmer:", "<IMG SRC=\"images/smilies/farmer[1].gif\">", $postthis);
    $postthis = stri_replace ( ":boba:", "<IMG SRC=\"images/smilies/fett[1].gif\">", $postthis);
    $postthis = stri_replace ( ":fish:", "<IMG SRC=\"images/smilies/fish[1].gif\">", $postthis);
    $postthis = stri_replace ( ":flamer:", "<IMG SRC=\"images/smilies/flamer[1].gif\">", $postthis);
    $postthis = stri_replace ( "&gt;8(", "<IMG SRC=\"images/smilies/frown[1].gif\">", $postthis);
    $postthis = stri_replace ( ":mad:", "<IMG SRC=\"images/smilies/furious[1].gif\">", $postthis);
    $postthis = stri_replace ( ":gimp:", "<IMG SRC=\"images/smilies/gimp[1].gif\">", $postthis);
    $postthis = stri_replace ( ":cool:", "<IMG SRC=\"images/smilies/glasses[1].gif\">", $postthis);
    $postthis = stri_replace ( ":gnome:", "<IMG SRC=\"images/smilies/gnome[1].gif\">", $postthis);
    $postthis = stri_replace ( ":monster:", "<IMG SRC=\"images/smilies/greedo[1].gif\">", $postthis);
    $postthis = stri_replace ( ":grenade:", "<IMG SRC=\"images/smilies/grenade[1].gif\">", $postthis);
    $postthis = stri_replace ( ":huh:", "<IMG SRC=\"images/smilies/hmph[1].gif\">", $postthis);
    $postthis = stri_replace ( ":homer:", "<IMG SRC=\"images/smilies/homer[1].gif\">", $postthis);
    $postthis = stri_replace ( ":fluff:", "<IMG SRC=\"images/smilies/imu2[1].gif\">", $postthis);
    $postthis = stri_replace ( ":fluffbash:", "<IMG SRC=\"images/smilies/imubashing[1].gif\">", $postthis);
    $postthis = stri_replace ( ":|", "<IMG SRC=\"images/smilies/indiff[1].gif\">", $postthis);
    $postthis = stri_replace ( ":jester:", "<IMG SRC=\"images/smilies/jester[1].gif\">", $postthis);
    $postthis = stri_replace ( ":jigga:", "<IMG SRC=\"images/smilies/jigga[1].gif\">", $postthis);
    $postthis = stri_replace ( ":pussy:", "<IMG SRC=\"images/smilies/kitty[1].gif\">", $postthis);
    $postthis = stri_replace ( ":lippy:", "<IMG SRC=\"images/smilies/liplick[1].gif\">", $postthis);
    $postthis = stri_replace ( ":love:", "<IMG SRC=\"images/smilies/love[1].gif\">", $postthis);
    $postthis = stri_replace ( ":luke:", "<IMG SRC=\"images/smilies/luke3[1].gif\">", $postthis);
    $postthis = stri_replace ( ":munkeh:", "<IMG SRC=\"images/smilies/m0nk33[1].gif\">", $postthis);
    $postthis = stri_replace ( ":maul:", "<IMG SRC=\"images/smilies/maul[1].gif\">", $postthis);
    $postthis = stri_replace ( ":monkey:", "<IMG SRC=\"images/smilies/monkee[1].gif\">", $postthis);
    $postthis = stri_replace ( ":dance:", "<IMG SRC=\"images/smilies/monkeedance2[1].gif\">", $postthis);
    $postthis = stri_replace ( ":danc3:", "<IMG SRC=\"images/smilies/monkeydance[1].gif\">", $postthis);
    $postthis = stri_replace ( ":scary:", "<IMG SRC=\"images/smilies/monster[1].gif\">", $postthis);
    $postthis = stri_replace ( ":arse:", "<IMG SRC=\"images/smilies/moon[1].gif\">", $postthis);
    $postthis = stri_replace ( ":moose:", "<IMG SRC=\"images/smilies/moose[1].gif\">", $postthis);
    $postthis = stri_replace ( ":t:", "<IMG SRC=\"images/smilies/mrT[1].gif\">", $postthis);
    $postthis = stri_replace ( ":ninja:", "<IMG SRC=\"images/smilies/ninja1[1].gif\">", $postthis);
    $postthis = stri_replace ( ":notmyfather:", "<IMG SRC=\"images/smilies/notmyfather[1].gif\">", $postthis);
    $postthis = stri_replace ( ":p1mp:", "<IMG SRC=\"images/smilies/p1mp[1].gif\">", $postthis);
    $postthis = stri_replace ( ":pants:", "<IMG SRC=\"images/smilies/pants[1].gif\">", $postthis);
    $postthis = stri_replace ( ":piggy:", "<IMG SRC=\"images/smilies/peeg2[1].gif\">", $postthis);
    $postthis = stri_replace ( ":pika:", "<IMG SRC=\"images/smilies/pikachu[1].gif\">", $postthis);
    $postthis = stri_replace ( ":pimp:", "<IMG SRC=\"images/smilies/pimp[1].gif\">", $postthis);
    $postthis = stri_replace ( ":pinky:", "<IMG SRC=\"images/smilies/pinkie[1].gif\">", $postthis);
    $postthis = stri_replace ( ":r2d2:", "<IMG SRC=\"images/smilies/r2d2[1].gif\">", $postthis);
    $postthis = stri_replace ( ":rainbow:", "<IMG SRC=\"images/smilies/Rain[1].gif\">", $postthis);
    $postthis = stri_replace ( ":flash:", "<IMG SRC=\"images/smilies/rainbow[1].gif\">", $postthis);
    $postthis = stri_replace ( ":book:", "<IMG SRC=\"images/smilies/read[1].gif\">", $postthis);
    $postthis = stri_replace ( ":red:", "<IMG SRC=\"images/smilies/redface[1].gif\">", $postthis);
    $postthis = stri_replace ( ":reflect:", "<IMG SRC=\"images/smilies/reflect[1].gif\">", $postthis);
    $postthis = stri_replace ( ":ohyeah:", "<IMG SRC=\"images/smilies/ride[1].gif\">", $postthis);
    $postthis = stri_replace ( ":robocop:", "<IMG SRC=\"images/smilies/robo[1].gif\">", $postthis);
    $postthis = stri_replace ( ":robot:", "<IMG SRC=\"images/smilies/robot[1].gif\">", $postthis);
    $postthis = stri_replace ( ":crazy:", "<IMG SRC=\"images/smilies/rolling_eyes[1].gif\">", $postthis);
    $postthis = stri_replace ( ":sailor:", "<IMG SRC=\"images/smilies/sailor[1].gif\">", $postthis);
    $postthis = stri_replace ( ":santa:", "<IMG SRC=\"images/smilies/santa[1].gif\">", $postthis);
    $postthis = stri_replace ( ":shakit:", "<IMG SRC=\"images/smilies/shakin[1].gif\">", $postthis);
    $postthis = stri_replace ( ":o", "<IMG SRC=\"images/smilies/shock[1].gif\">", $postthis);
    $postthis = stri_replace ( ":shrom:", "<IMG SRC=\"images/smilies/shroom_4[1].gif\">", $postthis);
    $postthis = stri_replace ( ":skull:", "<IMG SRC=\"images/smilies/skull[1].gif\">", $postthis);
    $postthis = stri_replace ( ":sleep:", "<IMG SRC=\"images/smilies/sleep[1].gif\">", $postthis);
    $postthis = stri_replace ( ":slide:", "<IMG SRC=\"images/smilies/slider[1].gif\">", $postthis);
    $postthis = stri_replace ( ":smoke:", "<IMG SRC=\"images/smilies/smokin[1].gif\">", $postthis);
    $postthis = stri_replace ( ":smurf:", "<IMG SRC=\"images/smilies/smurf[1].gif\">", $postthis);
    $postthis = stri_replace ( ":spidey:", "<IMG SRC=\"images/smilies/spiderman[1].gif\">", $postthis);
    $postthis = stri_replace ( ":stan:", "<IMG SRC=\"images/smilies/stan[1].gif\">", $postthis);
    $postthis = stri_replace ( ":stare:", "<IMG SRC=\"images/smilies/stare[1].gif\">", $postthis);
    $postthis = stri_replace ( ":three:", "<IMG SRC=\"images/smilies/threeheaded_animated[1].gif\">", $postthis);

    $postthis = stri_replace ( ":storm:", "<IMG SRC=\"images/smilies/trooper[1].gif\">", $postthis);
    $postthis = stri_replace ( ":tweety:", "<IMG SRC=\"images/smilies/tweetie[1].gif\">", $postthis);
    $postthis = stri_replace ( ":movin:", "<IMG SRC=\"images/smilies/twister[1].gif\">", $postthis);
    $postthis = stri_replace ( ":vader:", "<IMG SRC=\"images/smilies/vader[1].gif\">", $postthis);
    $postthis = stri_replace ( ":vampire:", "<IMG SRC=\"images/smilies/vampire-anim[1].gif\">", $postthis);
    $postthis = stri_replace ( ":wah:", "<IMG SRC=\"images/smilies/wail[1].gif\">", $postthis);
    $postthis = stri_replace ( ":wave:", "<IMG SRC=\"images/smilies/wavey[1].gif\">", $postthis);
    $postthis = stri_replace ( ":wiggle:", "<IMG SRC=\"images/smilies/wiggle[1].gif\">", $postthis);
    $postthis = stri_replace ( ":wink:", "<IMG SRC=\"images/smilies/wink-anim[1].gif\">", $postthis);
    $postthis = stri_replace ( ":w00t:", "<IMG SRC=\"images/smilies/woot[1].gif\">", $postthis);
    $postthis = stri_replace ( ":woot:", "<IMG SRC=\"images/smilies/woot[1].gif\">", $postthis);
    $postthis = stri_replace ( ":wub:", "<IMG SRC=\"images/smilies/wub[1].gif\">", $postthis);
    $postthis = stri_replace ( ":bow:", "<IMG SRC=\"images/smilies/bow.gif\">", $postthis);
    $postthis = stri_replace ( ":girl:", "<IMG SRC=\"images/smilies/girl.gif\">", $postthis);
    $postthis = stri_replace ( ":helpdesk:", "<IMG SRC=\"images/smilies/helpdesk.gif\">", $postthis);
    $postthis = stri_replace ( ":jesus:", "<IMG SRC=\"images/smilies/jesus.gif\">", $postthis);
    $postthis = stri_replace ( ":n00b:", "<IMG SRC=\"images/smilies/noob.gif\">", $postthis);
    $postthis = stri_replace ( ":noob:", "<IMG SRC=\"images/smilies/noob.gif\">", $postthis);
    $postthis = stri_replace ( ":brap:", "<IMG SRC=\"images/smilies/brap.gif\">", $postthis);
    $postthis = stri_replace ( ":hell:", "<IMG SRC=\"images/smilies/devil.gif\">", $postthis);
    $postthis = stri_replace ( ":dj:", "<IMG SRC=\"images/smilies/dj.gif\">", $postthis);
    $postthis = stri_replace ( ":guinness:", "<IMG SRC=\"images/smilies/guinness.gif\">", $postthis);
    $postthis = stri_replace ( ":laidies:", "<IMG SRC=\"images/smilies/laidies.gif\">", $postthis);
    $postthis = stri_replace ( ":lol:", "<IMG SRC=\"images/smilies/lol.gif\">", $postthis);
    $postthis = stri_replace ( ":mohawk:", "<IMG SRC=\"images/smilies/mohawk.gif\">", $postthis);
    $postthis = stri_replace ( ":pc:", "<IMG SRC=\"images/smilies/pc.gif\">", $postthis);
    $postthis = stri_replace ( ":round:", "<IMG SRC=\"images/smilies/round.gif\">", $postthis);
    $postthis = stri_replace ( ":shh:", "<IMG SRC=\"images/smilies/ssh.gif\">", $postthis);
    $postthis = stri_replace ( ":tash:", "<IMG SRC=\"images/smilies/tash.gif\">", $postthis);
    $postthis = str_replace ( ":d", "<IMG SRC=\"images/smilies/teeth[1].gif\">", $postthis);
    $postthis = str_replace ( ":p", "<IMG SRC=\"images/smilies/tongue-anim[1].gif\">", $postthis);


    // phew!

    // search highlighting...
    if ($searchword != "")
    {
        $arraytime = explode(" ", "$searchword");
        $counter = count($arraytime);
        $count = -1;
        while ($count < $counter)
        {
            $count++;
            $sword = $arraytime[$count];
            if ($sword == "style")
            {
                continue;
            }
            if ($sword == "color")
            {
                continue;
            }
            if ($sword == "black")
            {
                continue;
            }
            if ($sword == "back")
            {
                continue;
            }
            if ($sword == "background")
            {
                continue;
            }
            if ($sword == "ground")
            {
                continue;
            }
            if ($sword == " ")
            {
                continue;
            }
            if ($sword == "")
            {
                continue;
            }
            if (strlen($sword) < 4)
            {
                $sword = " ".$arraytime[$count];
            }
            $postthis = highlight("$sword", "$postthis");

        }

    }




?>