(function () {
    print("Testing Azure Function Call");
    var FUNCTION_URL = "https://sendanentity.azurewebsites.net/api/HttpTriggerJS/";
    var _this;
    var textDisplayEntityID = "{67f692c0-068b-4da1-83d9-a636f3ab39d4}";

    AzureFunctionObject = function () {
        _this = this;
    }
    AzureFunctionObject.prototype = {
        preload: function (entityID) {
            _this.entityID = entityID;
        },
        clickDownOnEntity: function () {
            print("Requesting heart count");
            var req = new XMLHttpRequest();
            req.addEventListener("progress", updateProgress, false)
            req.open("GET", FUNCTION_URL);
            req.send("");
        }
    };

    var CreateHeartParticleEffect = function(count) {

        var heartsProperties = {
            type : "ParticleEffect",
            isEmitting: true,
            position: Entities.getEntityProperties(_this.entityID).position,
            lifetime : count/2,
            "maxParticles" : count,
            "textures" : "https://hifi-content.s3.amazonaws.com/liv/Particles/HeartParticle.png",
            "emitRate" : 2,
            "lifespan" : 0.5,
            "accelerationSpread" : "{x: 0.5, y:1, z:0.5}",
            "emitAcceleration" : "{x: -0.5, y:2.5, z:0.5}",
            "particleRadius" : 0.1,
            "radiusStart" : 0.1,
            "radiusFinish" : 0.1
        };
        return Entities.addEntity(heartsProperties);

    }

    return new AzureFunctionObject();

})