Change this slightly:

```javascript
localized.ready(function(){
    navigator.idSSO.app.onlogin = function( assert ){
      var $button = $('.loggedout-expand-form-button')
      .removeClass('loggedout-expand-form-button')
      .addClass('expand-form-button')
      .click(function(ev) {
        ev.preventDefault();
        toggleCreateForm();
      });
      $('.event-button-text', $button).text( localized.get("Add an Event") );
      if( document.referrer.indexOf( 'login' ) !== -1 ){
        toggleCreateForm();
        $( '#event_title' ).focus();
      }
    };
    navigator.idSSO.app.onlogout = function(){
      var $button = $('.expand-form-button')
      .addClass('loggedout-expand-form-button')
      .removeClass('expand-form-button')
      .unbind('click');
      $('.event-button-text', $button).text( localized.get("Log in to add an Event") );
    };
});
```