/*
This is a random sentence generator. It attempts to create sentences in the style 
of Karen Elizabeth Gordon, l337 grammatician and author of "The New Well-
Tempered Sentence," "Paris Out of Hand," and the classic "Deluxe Transitive Vampire: 
The Ultimate Handbook of Grammar for the Innocent, the Eager, and the Doomed"
http://www.amazon.com/exec/obidos/search-handle-url/index=books&field-author=Gordon%2C%20Karen%20Elizabeth/107-3598112-6222913

To execute this script, somewhere between <head> and </head>...
	<script language="JavaScript" src="http://www.automatictaxistop.com/deluxe.js"></script>

And anyplace you want random sentences to show up...
	<script language="javascript">DeluxeTransitiveGenerator(x);</script>
Replace x with number of sentences you'd like.

This is a moderately-heavily modified version of somebody else's script. Unfortunately, 
the name wasn't listed, so I can't credit the poor bastard... 
http://javascript.internet.com/messages/sentence.html

-Cowboy X 6/29/2001 eric@automatictaxistop.com
*/

RandMultiplier = 0x015a4e35
RandIncrement = 1
var now = new Date()
RandSeed = now.getTime() % 0xffffffff
FirstSentence = 1 // marks that first sentence has not been made yet; state altered on line 105
FirstAmerica = 1 // marks that the goofy "...america great" sentence has not been used yet; line 69
	
function qrand(n) 
	{
	RandSeed = (RandMultiplier * RandSeed + RandIncrement) % 0x7fffffff
	return (RandSeed >> 16) % n
	}
	
function DeluxeTransitiveGenerator(sentenceCount) 
	{
	for (x=1; x<=sentenceCount; x++)
		{
		var stemp = GenRandomSentenceTemplate()
		var s = ""
		for ( i=0; i<stemp.length; i++ ) 
			{
			var c = stemp.substring(i,i+1)
			var w = ""
			if      ( c == '0' )    w = GenNoun()
			else if ( c == '1' )    w = GenNounPhrase(0)
			else if ( c == '2' )    w = GenTransitiveVerbPhrase(1)
			else if ( c == '3' )    w = GenConjunction()
			else if ( c == '4' )    w = GenIntransitiveVerbPhrase()
			else if ( c == '5' )    w = GenTransitiveVerbPhrase(0)
			else if ( c == '6' )    w = GenAdjective()
			else if ( c == '7' )    w = GenAdverb()
			else if ( c == '8' )    w = GenProperName()
			else    w = c
			s += w
			}
		document.write(CapFirst(s) + " ");
		}
	}

function GenRandomSentenceTemplate() 
	{
	var w = ""
	var r = qrand(22)
	if ( r > 17 )    w = "1 2 1." // NounPhrase TransitiveVerbPhrase NounPhrase.
	else if ( r == 1 )      w = "1 2 1, 3 1 2 1." // NounPhrase TransitiveVerbPhrase NounPhrase, Conjuction NounPhrase TransitiveVerbPhrase NounPhrase.
	else if ( r == 2 )      w = "When 1 4, 1 4." // When NounPhrase IntransitiveVerbPhrase, NounPhrase IntransitiveVerbPhrase.
	else if ( r == 3 )      w = "If 1 2 1, then 1 4." // If NounPhrase TransitiveVerbPhrase NounPhrase, then NounPhrase IntransitiveVerbPhrase.
	else if ( r == 4 )      w = "Sometimes 1 4, but 1 always 2 1!" // Sometimes NounPhrase IntransitiveVerbPhrase, but NounPhrase always TransitiveVerbPhrase NounPhrase.
	else if ( r == 5 )      w = "Most people believe that 1 2 1, but they need to remember how 7 1 4." // Most... that NounPhrase TransitiveVerbPhrase NounPhrase, but ... how Adverb NounPhrase IntransitiveVerbPhrase
	else if ( r == 6 ) 
		{
		if ( FirstAmerica ) 
			{
			FirstAmerica = 0
			w = "1, 1, and 1 are what got 8 into trouble." 
			} 
		else 
			{w = "1 2 1."} // NounPhrase TransitiveVerbPhrase NounPhrase.
		}
	else if ( r == 7 )      w = "1 4, 3 1 2 1." // NounPhrase IntransitiveVerbPhrase, Conjuction NounPhrase TransitiveVerbPhrase NounPhrase.
	else if ( r == 8 )      w = "Now and then, 1 2 1." // Now and then, NounPhrase TransitiveVerbPhrase NounPhrase.
	else if ( r == 9 )      w = "1 4, and 1 4; however, 1 2 1." // Noun IntransitiveVerbPhrase, and Noun IntransitiveVerbPhrase; however, NounPhrase TransitiveVerbPhrase NounPhrase..
	else if ( r == 10 ) 
		{
		if ( FirstSentence ) 
			{w = "1 2 1."}  // NounPhrase TransitiveVerbPhrase NounPhrase.
		else 
			{w = "Indeed, 1 2 1."} // Indeed, NounPhrase TransitiveVerbPhrase NounPhrase.
		}
	else if ( r == 11 ) 
		{
		if ( FirstSentence ) 
			{w = "0 2 1."} // NounPhrase TransitiveVerbPhrase NounPhrase.
		else 
			{w = "8, although somewhat soothed by 1 and 1, still 2 her from 1, 5 her 1 with 1, and 2 the dark side of her 0."} // 
		}
	else if ( r == 12 ) 
		{
		if ( FirstSentence ) 
			{w = "1 2 1."}  // NounPhrase TransitiveVerbPhrase NounPhrase.
		else 
			{w = "He called her 8 (or was it 8?)."} // For example, NounPhrase indicates that NounPhrase TransitiveVerbPhrase NounPhrase.
		}
	else if ( r == 13 )     w = "Unlike so many 0s who have made their 6 0 abhorrent to us,  0s remain 6." // 
	else if ( r == 14 )     w = "8 and I took 1 (with 1, 1, a few 0s, and 1) to arrive at a state of intimacy where we can 7 5 our 0." // 
	else if ( r == 15 )     w = "1 is 6."  // NounPhrase is Adjective.
	else if ( r == 16 )     w = "8, the friend of 8 and 8, 4 with 1." // When NounPhrase is Adjective, NounPhrase TransitiveVerbPhrase NounPhrase.
	FirstSentence = 0
	return (w);
	}

function GenNoun() 
	{
	w = new Array("menagé à trois","debutante","ballerina","taxidermist","midwife","girl","boy","coward","alchemist","tenor","fetishist","ruffian","onlooker","impresario","somnambulist","starlet","dissident","philosopher","dilettante","maestro","necromancer","bride","cigar","pocket","mirror","bubble","gonad","trombone","marzipan","stalactite","toothpick","shadow","clock","omphalos","snow","cup","swamp","bonbon","piroshki","ribbon","hand","haunch","cream puff","toothache","bubble bath","guardian angel","<i>amour-propre<\/i>","looking glass","tea party","clodhopper","bodice ripper","waif","dahlia","bicep","mastadon","cleavage","gypsy","espadrille","labyrinth","widow","lunatic","curse");
	return w[qrand(w.length)]
	}
	
function GenPreposition() 
	{
	w = new Array("from","near","about","around","for","toward","over","behind","beyond","related to","defined by","inside","living with")
	return w[qrand(w.length)]
	}

function GenNounPhrase(depth) 
	{
	var phraseKind = qrand(3)
	var s = ""
	if ( phraseKind == 0 || depth>0 ) 
		{s = GenNoun()} 
	else if ( phraseKind == 1 ) 
		{s = GenAdjective() + " " + GenNoun()} 
	else if ( phraseKind == 2 ) 
		{s = GenNoun() + " " + GenPreposition() + " " + GenNounPhrase(depth+1)}
	var r = qrand(100)
	if ( r < 30 ) 
		{s = "the " + s} 
	else if ( r < 35 ) 
		{s = "another " + s} 
	else if ( r < 40 ) 
		{s = "some " + s} 
	else 
		{
		var c = s.substring(0,1).toLowerCase()
		if ( (s.substring(0,8) != "Eurasian") && (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') ) 
			{s = "an " + s} 
		else 
			{s = "a " + s}
		}
	return s
	}

function GenProperName() 
	{
	s = new Array("Harpo Marx","Toscanini","Desdemona","Nicolas","Timosha","the Interloper","Mitzi","Jean-Pierre","Jespera","Jacques","Scheherazade","Lila","Kafka","Nimbo");
	return s[qrand(s.length)]
	}
	
function GenAdverb() 
	{
	s = new Array("amorously","knowingly","slyly","greedily","hesitantly","secretly","carelessly","thoroughly","barely","ridiculously","non-chalantly","hardly","eagerly","feverishly","lazily","inexorably","accurately","accidentally","completely","usually","single-handledly","underhandedly","almost","wisely","ostensibly","somewhat","overwhelmingly","seldom","often");
	return s[qrand(s.length)]
	}
	
function GenAdjective() 
	{
	w = new Array("polite","self-actualized","strawberry-blonde","halfhearted","nefarious","botched","likeable","sheepish","unruffled","irreconcilable","darling","placid","comely","sprightly","slovenly","friendly","lowly","niggardly","rascally","gingerly","unseemly","saintly","ungodly","lovely","unsightly","surly","womanly","ghastly","wily","wobbly","curmudgeonly","uxorious","rapacious","chic","sublime","rhetorical")
	if ( qrand(10) > 7 ) 
		{
		return (GenAdverb() + " " + w[qrand(w.length)]);
		}
	else
		{
		return w[qrand(w.length)]
		}
	}
	
function GenTransitiveVerbPhrase(tense) 
	{
	sArray = new Array("admonish*","confess*","boogie$","conquer$","bounce$","mourn*","teach*","prefer$","pour$ freezing cold water on","find$ lice on","seek$","host$","ignore$","dance$ with","recognize$","approach*","negotiate$ a prenuptial agreement with","assimilate$","bestow$ great honor upon","derive$ perverse satisfaction from","steal$ pencils from","tr& to seduce","go* deep sea fishing with","find$ subtle faults with","laugh$ and drink$ all night with","befriend$","make$ a truce with","give$ secret financial aid to","brainwash*","trade$ baseball cards with","sell$ " + GenNounPhrase(0) + " to","caricature$","sanitize$","satiate$","organize$","graduate$ from","give$ lectures on morality to","^ a change of heart about","play$ pinochle with","give$ a pink slip to","share$ a shower with","buy$ an expensive gift for","cook$ cheese grits for","take$ a peek at","pee$ on","write$ a love letter to","fall$ in love with","avoid$ contact with",") a big fan of","secretly admire$","borrow$ money from","operate$ a small fruit stand with","throw$ " + GenNounPhrase(0) + " at","bur&","can be kind to","learn$ a hard lesson from","plan$ an escape from " + GenNounPhrase(0),"make$ love to");
	vt = "" 
	var i
	s = sArray[qrand(sArray.length)];
	for (i=0; i<s.length; i++ ) 
		{
		var c = s.substring(i,i+1)      
		var w = c
		if ( c == '$' ) 
			{
			if ( tense == 0 )       w = ""
			else if ( tense == 1 )  w = "s"
			} 
		else if ( c == '*' ) 
			{
			if ( tense == 0 )       w = ""
			else if ( tense == 1 )  w = "es"
			}
		else if ( c == ')' ) 
			{
			if ( tense == 0 )       w = "be"
			else if ( tense == 1 )  w = "is"
			}
		else if ( c == '^' ) 
			{
			if ( tense == 0 )       w = "have"
			else if ( tense == 1 )  w = "has"
			}
		else if ( c == '&' ) 
			{
			if ( tense == 0 )       w = "y"
			else if ( tense == 1 )  w = "ies"
			}
		vt += w
		}
	if ( qrand(10) < 3 ) 
		{
		vt = GenAdverb() + " " + vt
		}
	return vt
	}

function GenIntransitiveVerbPhrase() 
	{
	w = new Array("leaves","goes to sleep","takes a coffee break","hibernates","reads a magazine","self-flagellates","meditates","starts reminiscing about lost glory","flies into a rage","earns frequent flier miles","sweeps the floor","feels nagging remorse","returns home","rejoices","prays","procrastinates","daydreams","ceases to exist","hides","panics","beams with joy","laughs out loud","gets stinking drunk","wakes up","hesitates","trembles","ruminates","dies","strokes")
	return w[qrand(w.length)]
	}

function GenConjunction() 
	{
	var r = qrand(4)
	var s = ""
	if ( r == 0 )   s = "and"
	else if ( r == 1 )      s = "or"
	else if ( r == 2 )      s = "but"
	else if ( r == 3 )      s = "because"
	return s
	}

function CapFirst(s) 
	{
	return s.substring(0,1).toUpperCase() + s.substring(1,s.length); 
	}

