function lokiGetLocation()
{
  var loki = LokiAPI();
  if (loki) {
    loki.onSuccess = function(location) {
    	var locationStr = ''+
    	//		location.latitude+', '+
        //        location.longitude+', '+
        //        location.accuracy+', '+
                location.house_number+' '+
                location.street+', '+
                location.city+', '+
                location.region+', '+
        //        location.region_code+', '+
         //       location.postal_code+', '+
                location.country//+', '+
        //        location.country_code
        ;
    	onLokiResult(locationStr, location.accuracy);
    }
    loki.onFailure = function(error, message) {
    	onLokiResult('An error was encountered. '+message+'. Error Code '+error, error);
    }
    loki.setKey('skout.com');
    var latLonLookup = false;

    loki.requestLocation(latLonLookup, loki.FULL_STREET_ADDRESS_LOOKUP);
  } else {
  	onLokiResult("No loki found. Error Code -1", -1);
  }
}

function lokiGetIPLocation()
{
  var loki = LokiAPI();
  if (loki) {
    loki.onSuccess = function(location) {
    	var locationStr = ''+
                location.city+', '+
                location.region+', '+
        //        location.region_code+', '+
         //       location.postal_code+', '+
                location.country//+', '+
        //        location.country_code
        ;
    	onLokiResult(locationStr, 0);
    }
    loki.onFailure = function(error, message) {
    	onLokiResult('An error was encountered. '+message+'. Error Code '+error, error);
    }
    loki.setKey('skout.com');
    var latLonLookup = false;

    loki.requestIPLocation(latLonLookup, loki.LIMITED_STREET_ADDRESS_LOOKUP);
  } else {
  	onLokiResult("No loki found. Error Code -1", -1);
  }
}

function onLokiResult(locationStr, accuracy) {
	getSwf('StartWichroV2').lokiResult(locationStr, accuracy);
}

function isLokiInstalled() {
	return LokiAPI.isInstalled();	
}
