First I'd like to suggest you edit your post and put your code in the code tags (# button) so that it will be easier to read.

The other odd thing I see is it looks like you've modified the UDF to pull different information, but its not returning anything, ie the ADSearch variable is not being defined with a return value.

As for your error, You might try changing this:
   $homeMDB=split($recordset.fields("homemdb"),",")
to (untested)
   $homeMDB=$recordset.fields("homemdb")
   $homeMDB=split($homeMDB,",")

Also, your for loop could be much easier...
$test="abernade","dbullock"
for each $x in $test
   ? $x
   ;do stuff
next