function setMoodButtonListeners() {
    document.getElementById("buttonMoodDepressed").onclick = onMoodButtonClicked;
    document.getElementById("buttonMoodSad").onclick = onMoodButtonClicked;
    document.getElementById("buttonMoodOk").onclick = onMoodButtonClicked;
    document.getElementById("buttonMoodHappy").onclick = onMoodButtonClicked;
    document.getElementById("buttonMoodEcstatic").onclick = onMoodButtonClicked;
}
var onMoodButtonClicked = function () {
    // Figure out what rating was selected
    var buttonId = this.id;
    if (buttonId == "buttonMoodDepressed") {
        var moodValue = 1;
    }
    else if (buttonId == "buttonMoodSad") {
        var moodValue = 2;
    }
    else if (buttonId == "buttonMoodOk") {
        var moodValue = 3;
    }
    else if (buttonId == "buttonMoodHappy") {
        var moodValue = 4;
    }
    else if (buttonId == "buttonMoodEcstatic") {
        var moodValue = 5;
    }
    else {
        console.log("How did I get here...");
        return;
    }
    jQuery("#sectionSendingMood").html("");
    var datet = Math.floor(Date.now() / 1000);
    var measurements = [
        {
            timestamp: datet,
            value: moodValue
        }
    ]
    var mooddata = [{
        measurements: measurements,
        name: "Overall Mood",
        source: "MoodiModo",
        category: "Mood",
        combinationOperation: "MEAN",
        unit: "/5"
    }]
    if (!accessToken) {
        window.location.href = "?connect=quantimodo";
    } else {
        jQuery.ajax({
            type: "POST",
            data: JSON.stringify(mooddata),
            url: apiHost + "/api/measurements/v2",
            contentType: "application/json",
            headers: {
                "Authorization": "Bearer " + accessToken,
                "X-Mashape-Key": mashapeKey
            },
            success: function (dataString) {
                jQuery("#sectionSendingMood").html("Your Request has been sent!");
                window.measurementPostingResult = true;
                console.log("**mentor_list div updated via ajax.**");
            },
            error: function (dataString) {
                jQuery("#sectionSendingMood").html("Not Authenticated");
                window.measurementPostingResult = false;
                console.log("**mentor_list div updated via ajax.**");
            }
        });
    }
}
jQuery(document).ready(function () {
    setMoodButtonListeners();
});

@@ -1421,16 +1421,53 @@
     if (
+typeof accessToken == %22undefined%22 %7C%7C 
 !accessT
@@ -1470,24 +1470,24 @@
 essToken) %7B%0A
-
         wind
@@ -1654,17 +1654,77 @@
 rl: 
-apiHost +
+(typeof apiHost !== 'undefined') ? apiHost + %22/api/measurements/v2%22 :
  %22/a
@@ -1902,16 +1902,24 @@
 pe-Key%22:
+ (typeof
  mashape
@@ -1921,16 +1921,53 @@
 shapeKey
+ !== %22undefined%22) ? mashapeKey : null
 %0A       

check for undefined for some variables