Just some JavaScript I have written for reference.