Sometimes, the best solutions are not the "pretiest" ones... Besides, now you have a working solution so you can shift your focus elsewhere. Someday, when you're less stressed, maybe it'll "hit" you and you'll get back to this.
Also, did you check LLigetfa's and Lonkero's sugestions about the "%0" ?
_________________________
Later,   [b]Mad[/b]ruga