sigh... some days I hate JavaScript (ok, most)