Your IP : 216.73.216.124


Current Path : /home/hrpsychology/public_html/soulfood.gr/psychology.soulfood.gr/tests710/eutuxia1/
Upload File :
Current File : /home/hrpsychology/public_html/soulfood.gr/psychology.soulfood.gr/tests710/eutuxia1/scripts.js

var totalQs = document.querySelectorAll(".quiz-question").length; //this counts how many questions are on the test
var Quest = new Array(totalQs);  //this sets up an array for all of the answers that are given

function populate() {
    // alert("function populate started"); 
    // this function gives each of the answers 0 points so if someone doesn't answer a question 
    // the whole thing will continue to work
    for (var i = 0; i < totalQs; i++) { Quest[i] = 0; }
}

function total() {
    // alert("function total started"); 
    // this function adds the number of points each answer is worth together 
    myScore = 0;
    for (var i = 0; i < totalQs; i++) { myScore = myScore + Quest[i]; }
    analyzer(myScore);
}

// these are the the estimations based on score for the test
Outcome = new Array();
Outcome[0] = "Δείχνετε να μην είστε πολύ ικανοποιημένος από τη ζωή και να μη βρίσκετε χαρά σε αυτή. Ωστόσο, αν κοιτάξετε καλύτερα θα δείτε ότι υπάρχουν πολύ όμορφα πράγματα  γύρω σας που περιμένουν την προσοχή σας.";
Outcome[1] = "Σίγουρα αναγνωρίζετε θετικά στοιχεία στη ζωή σας αλλά μάλλον δεν μπορείτε να πείτε με σιγουριά ότι είστε ευτυχισμένος. Μη φοβάστε να απολαύσετε τη ζωή και να χαρείτε με ό,τι σας συμβαίνει. Αυτό είναι που θα φέρει περισσότερη χαρά στην καθημερινότητά σας.";
Outcome[2] = "Δείχνετε ένας ευτυχής άνθρωπος, που απολαμβάνει τη ζωή σε κάθε της πτυχή.  Συνεχίστε έτσι!";


function analyzer(myScore) {
    // this function uses the total calculated score to figure out which personality type they are 
                if (myScore > 30) { OutcomePtr = 2; } //Outcome [2]
                else {
                    if (myScore > 18) { OutcomePtr = 1; } //Outcome [1]
                    else { OutcomePtr = 0; } //Outcome[0]
                }
    myDisplay(Outcome[OutcomePtr])
}


function myDisplay(Outcome) {
    //This function will open a new window and show the results calculated 
    // alert(Outcome); **use alert for testing only**.
    document.getElementById("result").innerHTML = (Outcome);
}

function saver(q, points) {
    // this function puts the points that each answer is worth into the array 
    q = q - 1;
    Quest[q] = points
}