/**
 * Idea Generator JavaScript
 *
 * Written by Chuck Heintzelman
 */
var plots = {
    seven: ["[wo]man vs. nature", "[wo]man vs. man",
            "[wo]man vs. the environment", "[wo]man vs. machines/technology",
            "[wo]man vs. the supernatural", "[wo]man vs. self",
            "[wo]man vs. god/religion"],
    twenty: ["Quest", "Adventure", "Pursuit", "Rescue", "Escape", "Revenge",
            "The Riddle", "Rivalry", "Underdog", "Temptation", "Metamorphosis",
            "Transformation", "Maturation", "Love", "Forbidden Love",
            "Sacrifice", "Discovery", "Wretched Excess", "Ascension",
            "Descension"],
    thirtysix: ["Supplication (in which the Supplicant must beg something from Power in authority)",
            "Deliverance", "Crime Pursued by Vengeance", "Crimes of Love",
            "Vengeance taken for kindred upon kindred", "Pursuit", "Disaster",
            "Falling Prey to Cruelty of Misfortune", "Revolt", "Daring Enterprise",
            "Abduction", "The Enigma (temptation or a riddle)", "Obtaining",
            "Enmity of Kinsmen", "Rivalry of Kinsmen", "Murderous Adultery",
            "Madness", "Fatal Imprudence", "Rivalry of Superior and Inferior",
            "Involuntary Crimes of Love (example: discovery that one has married one’s mother, sister, etc.)",
            "Slaying of a Kinsman Unrecognized", "Self-Sacrificing for an Ideal",
            "Self-Sacrifice for Kindred", "All Sacrificed for Passion",
            "Necessity of Sacrificing Loved Ones", "Adultery", "An Enemy Loved",
            "Discovery of the Dishonor of a Loved One", "Obstacles to Love",
            "Ambition", "Conflict with a God", "Mistaken Jealousy",
            "Erroneous Judgement", "Remorse", "Recovery of a Lost One",
            "Loss of Loved Ones"],
    generate: function () {
        $('conflict1').innerHTML = this.seven[Math.floor(Math.random() * 7)];
        $('conflict2').innerHTML = this.twenty[Math.floor(Math.random() * 20)];
        $('conflict3').innerHTML = this.thirtysix[Math.floor(Math.random() * 36)];
    },
    doRandom: function (num) {
        var array = [];
        var i;
        for (i = 0; i < 7; i++)
            array.push(this.seven[i]);
        for (i = 0; i < 20; i++)
            array.push(this.twenty[i]);
        for (i = 0; i < 36; i++)
            array.push(this.thirtysix[i]);
            
        array.sort(function() {
            return (Math.round(Math.random())-0.5);
            });
        i = 1;
        while (i <= num) {
            $('conflict-' + i).innerHTML = array[i-1];
            Element.show('conflict-' + i);
            i++;
        }
        while (i <= 10) {
            Element.hide('conflict-' + i);
            i++;
        }
    }
};

