A badly written javascript paint program i've just started