/*  Loki Javascript API
 *  Ryan Sarver <rsarver@skyhookwireless.com>
 *
 *  This is a helper script to help you detect and gracefully handle
 *  users with Loki installed
 *
/*--------------------------------------------------------------------------*/

// Borrowed from the Prototype Library
var Try = {
  these: function() {
    var returnValue;

    for (var i = 0; i < arguments.length; i++) {
      var lambda = arguments[i];
      try {
        returnValue = lambda();
        break;
      } catch (e) {}
    }

    return returnValue;
  }
}

function LokiAPI()
{
	return Try.these(
					function() {return new ActiveXObject("Loki.LocationFinder.1")},
					function() {return new Loki()}
				) || false;
}