CODE
$statement = "SELECT cid, cname FROM {$config['table_prefix']}categories WHERE cshow=1 AND parent=-1";
and replace it with
CODE
$statement = "SELECT cid, cname FROM {$config['table_prefix']}categories WHERE cshow=1 AND parent=-1 ORDER BY cname ASC";