<%= javascript_tag %Q{
    var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    document.write(unescape("%3Cscript src='" + notifierJsScheme + "#{host}/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
  }
%>

<%= javascript_tag %Q{
    Airbrake.setKey('#{api_key}');
    Airbrake.setHost('#{host}');
    Airbrake.setEnvironment('#{environment}');
    Airbrake.setErrorDefaults({ url: "#{escape_javascript url}", component: "#{controller_name}", action: "#{action_name}" });
  } 
%>

<%= javascript_tag %Q{
  (function(){
    var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    document.write(unescape("%3Cscript src='" + notifierJsScheme + "#{host}/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
  })();
}%>

<%= javascript_tag %Q{
    window.Airbrake = Airbrake || Hoptoad;
    Airbrake.setKey('#{api_key}');
    Airbrake.setHost('#{host}');
    Airbrake.setEnvironment('#{environment}');
    Airbrake.setErrorDefaults({ url: "#{escape_javascript url}", component: "#{controller_name}", action: "#{action_name}" });
  }
%>

Use either Airbrake or Hoptoad object.
Use either Airbrake or Hoptoad object.

The current http://airbrakeapp.com/javascripts/notifier.js (v0.1.0)
defines a Hoptoad object, which Airbrake 3.0 expects an Airbrake object.
Add Hoptoad as a fall-back. Also wrap the first javascript with a
closure so it won't pollute the global namespace.
