
    // Initialize the vocabulary into appropriate arrays.

    Preposition = new Array("of", "behind", "beyond");

    Adjective = new Array("supreme", "vile", "silent", "hidden", "nuclear", "lost", "mad", "black", "dark", "destroyed", "icy", "exterminating", "withered", "decayed", "white", "metal", "winter", "murderous", "cruel", "interfering", "forbidden", "frozen", "dying", "exterminated", "terrifying", "wrinkled", "jiggling", "cursed", "fateful", "vagrant", "last", "old", "sorrowful", "lonely", "wandering", "dead", "remote controlled");

    Noun1 = new Array("doctor", "planet", "dalek", "abomination", "solar system", "timelord", "human", "galaxy", "world", "earth", "multiverse", "star", "storm", "sun", "enemy", "eye", "death", "skull", "tardis", "eye-stalk", "singularity", "battalion", "army", "explosion");

	Noun2 = new Array("wind", "night", "shadow", "death", "destruction", "time war", "evil", "war",  "smog", "spirit",  "nightmare", "sky", "thunder", "frenzy", "creation", "extermination", "genocide");

    Verb = new Array("is dreaming of", "knows of", "will see", "will destroy", "will exterminate", "dances in", "is dancing in");

    // 'Macros'
    adj = "adj";
    prep = "prep";
    noun1 = "noun1";
    noun2 = "noun2";
    verb = "verb";


    // Returns a number {0 .. (upper - 1)}
    function rand(upper) {
      return ( Math.floor(Math.random() * upper) );
    }

    // Takes a word, and returns that word with a article of speech attached
    // to it.  Namely, 'a' (or 'an'), or 'the'.
    function addArticle(word) {
      firstChar = word.charAt(0);
      returnValue = "";

      randNum = rand(10)

      if (randNum < 5) {
        return Value = "the " + word;
      }

      else {
        if ( firstChar == 'a' || firstChar == 'e' || firstChar == 'i' ||
	     firstChar == 'o' || firstChar == 'u') {
          returnValue = "an " + word;
        }		   
 
        else {
          returnValue = "a " + word;
        }
      }

      return returnValue;
    }

    // Retrieves a word, based on the argument.  The argument types can be:
    // adj (adjective), prep (preposition), noun or verb.
    function getWord(type) {
      if (type == "adj") {
        return Adjective[rand(Adjective.length)];
      }

      else if (type == "prep") {
        return Preposition[rand(Preposition.length)];
      }

      else if (type == "noun1") {
        return Noun1[rand(Noun1.length)];
      }

	 else if (type == "noun2") {
        return Noun2[rand(Noun2.length)];
      }

      else if (type == "verb") {
        return Verb[rand(Verb.length)];
      }

      else {
	return " ";
      }
    }

    // One of three haiku styles
    function haiku1() {
      temp = "";

      temp = addArticle(getWord(adj))  + " " + getWord(noun1) + " " + "-" + "\n" +

             addArticle(getWord(noun1))  + " " + getWord(verb)  + " " +
			  // getWord(prep) + " "  +
             getWord(noun2) + " " + "-" + "\n" +

             getWord(adj) + ","   + " " + getWord(adj);

      return temp;      
    }

    // The second of three haiku styles
    function haiku2() {
      temp = "";

      temp = addArticle(getWord(noun1))  + " " + getWord(prep)  + " " + getWord(noun2) + "\n" +

             getWord(adj)  + " " + getWord(noun1)  + " " + 
			 // getWord(prep)  + 
			 "\n" + 
	     addArticle(getWord(noun1)) + " " + "-" + " " +

             addArticle(getWord(adj)) + " "  + getWord(noun2);

      return temp;
    }

    // The third of three haiku styles
    function haiku3() {
      temp = "";

      temp = addArticle(getWord(adj)) + "," + " " + getWord(adj)  + " " + getWord(noun1) + " " + "-" + "\n" +

	 addArticle(getWord(noun1))  + " " + getWord(verb)  + "\n" 
	 // + getWord(prep) + " "  
	 + getWord(adj) + " "  + getWord(noun2);

            
      
      return temp;
    }


    // The main function called when the button is hit in the form below.
    function makeHaiku() {
      randNum = rand(30) 
      
      if (randNum < 10) {
        document.haikuForm.haikuText.value = haiku1();
      }

      else if ( (randNum >= 10) && (randNum < 20) ) {
        document.haikuForm.haikuText.value = haiku2();        
      }

      else {
        document.haikuForm.haikuText.value = haiku3();
      }

    }

