function Thing($option)
dim $i, $flags, $flag

$option = val($option)
$i = 1

;a data array of avaliable flags
while $i < 50000
$flags = $flags + "$i,"
$i = $i*2
loop
$flags = split($flags,",")
redim preserve $flags[ubound($flags)-1]

;sort throught the flag options.
for each $flag in $flags
if ($option & val($flag))
$thing = $Thing + "$flag,"
endif
next
$thing = substr($thing,1,len($thing)-1)
endfunction

Bryce