<?
function splitcolor($color)
{
    if (
substr($color, 0, 1) == "#" ) {
        
$color = substr($color, 1);
    }

    
$r = hexdec(substr($color, 0, 2));
    
$g = hexdec(substr($color, 2, 2));
    
$b = hexdec(substr($color, 4, 2));

    return(array(
"r" => $r, "g" => $g, "b" => $b));
}

function
box($im, $x1, $y1, $x2, $y2, $thick, $color)
{
    
$tpx = $thick - 1;
    
imagefilledrectangle($im, $x1, $y1, $x2, $y1 + $tpx, $color);
    
imagefilledrectangle($im, $x2 - $tpx, $y1, $x2, $y2, $color);
    
imagefilledrectangle($im, $x1, $y2 - $tpx, $x2, $y2, $color);
    
imagefilledrectangle($im, $x1, $y1, $x1 + $tpx, $y2, $color);
}
?>