Created functions for much of vote.php. Separated Javascript into a dedicated file.