Moved phase specified event and form handlers to separate javascript file.