ok, this is really hard to say, so, please, try and stay with me laugh.
I'm thinking of something that coun's how many ) and ('s you have, For Example: (Script may not make sense, just making one as an example)
$replace($gettok(whatever here,2,32),$findtok($gettok($left.................and so on 

trust me, sometimes it can get that far, and, most of the times, I miscount the amount of ('s, so, let's say if I have this:
then, it would have 1 at the top (it can change at any time), or, lets' say I have
it would be -1, so, 0 is the balanced number, so,

*NOTE:* everytime I type a ( or a ) it changes, ( = postive 1, ) = negative 1.
understand, please try and stick with me, it's really hard to say.
maybe the same thing for } and { as well, who knows laugh