+
+ /*****************************************************/
+ /* Add event handlers for all of the functions above */
+ /*****************************************************/
+
+ /* Center the ticket once when the page has loaded */
+ window.addEventListener("load", center_ticket);
+
+ /* Re-center the ticket when the window is resized */
+ window.addEventListener("resize", center_ticket);
+
+ /* Set the security code text when the page has loaded */
+ window.addEventListener("load", set_code);
+
+ /* Center the security code text when the page has loaded;
+ * in particular, after we set it. And then center it again.
+ * Why? I'm glad you asked. Because it doesn't actually get
+ * centered the first time; it's off by a few pixels. But then
+ * if we center it _again_, I guess we're so close to begin with
+ * that any errors aren't noticeable. Anyway, just running it
+ * twice in a row avoids a major headache. We need the wrapper
+ * because the spec says that duplicate handlers are discarded. */
+ window.addEventListener("load", center_code);
+ window.addEventListener("load", center_code_wrapper);
+
+ /* Re-center the security code when the window is resized,
+ * and in particular after the ticket is re-centered */
+ window.addEventListener("resize", center_code);
+
+ /* Set the ticket expiration date/time upon page load */
+ window.addEventListener("load", set_ticket_expiry);
+
+ /* Swap colors when the screen is tapped */