Fault tolerant loading remote javascript with YUI

The registration form of the MyOwnDB app was simplified this week, but an information I wanted to keep is the country where registered people are located, notably to know which translation of the UI to provide next (currently, it looks like it will be spanish).

I decided to use the Geoplugin.com service, but it appears it's unreachable at this time, making for a less than engaging experience when loading the sign-up page.

Luckily, the solution with YUI is very easy, as it provides the Get utility to load remote javascript, with an optional timeout. Exactly what I needed!

Here's the code :

YUI().use("event","node", function(Y) {
      Y.on("domready", function() {
            Y.Get.script("http://www.geoplugin.net/javascript.gp", {
              timeout: 2000,
              onSuccess: function() {
                          var country = geoplugin_countryName();
                          var country_select = Y.one("#account_country");
                          country_select.set("value", country);