function GetRandomTitle() {
	var title = Analyze(Structure());
	title = title.replace(" \'s","\'s");
	title = title.replace(" !", "!");
	title = title.replace(" ?", "?");
	title = title.replace(" :", ":");
 	return ('<li>' + title + '<\/li>');
}

function Structure(){
       var structures = [ "[noun_tech_plural] Are Absolutely Useless", 
                            "[number_mid] New Ways To [verb_tech]", 
                            "[number_mid] Ways That [noun_people] Use [noun_tech_plural]", 
                            "Why Are We Still Using [noun_tech_plural] ?", 
                            "[number_small] Reasons [noun_company] Should [verb_business]", 
                            "Why [noun_company] Should [verb_business]", 
                            "Top [number_small] Ways To [verb_tech]", 
                            "[noun_tech_plural] : Looking Beyond Web 2.0", 
                            "Making Sense Of [noun_program]", 
                            "Is [noun_program] Already Outdated?",
                            "Are You Using [noun_program] ? [noun_people] Are!",
                            "[verb_tech] In Less Than [number_mid] Minutes",
                            "How To [verb_tech] Using [noun_language]", 
                            "The [number_small] [adjective_attention] Ways To [verb_tech]", 
                            "[number_mid] Reasons I Don\'t Use [noun_website]" ,
                            "[number_small] Reasons You Should Be Using [noun_website]", 
                            "How To Make Money On [noun_website]", 
                            "[noun_website] v. [noun_website] : Which Is Better?", 
                            "[noun_company] Should Develop New [noun_tech_general_single]", 
                            "Why [noun_language] Is Better Than [noun_language]", 
                            "Promote Your Website Using [noun_website]", 
                            "[noun_program] Explained In Under [number_big] Words", 
                            "How To Waste An Afternoon On [noun_website]", 
                            "Why [noun_people] Hate [noun_website]", 
                            "Why [noun_person] Loves [noun_website]", 
                            "Why [noun_people] Love [noun_website]", 
                            "Why [noun_person] Hates [noun_website]", 
                            "How [noun_people] Are Using [noun_website] To [verb_attention]", 
                            "How To Find A Job Using [noun_website]", 
                            "How [noun_website] Will Change In 2010", 
                            "The Single [adjective_attention] New [noun_tech_general_single] Of 2009",
                            "[number_mid] Things That Every New [noun_tech_general_single] Must Have", 
                            "The Downfall Of [noun_tech_plural]", 
                            "[number_mid] Reasons To Love [noun_company]",
                            "[number_mid] Simple Ways To [verb_attention]", 
                            "How The Open Source Revolution Will Affect [noun_company]", 
                            "Why [noun_company] Should Worry About Cloud Computing", 
                            "[number_small] Things You Didn\'t Know About [noun_company]", 
                            "[number_small] Secrets About The Future Of [noun_program]", 
                            "[number_mid] Ways To Use [noun_program] To [verb_attention]",
                            "[number_mid] Alternatives To [noun_website]",
                            "[number_small] Simple Hacks To Make Money On [noun_website]",
                            "Challenge: Don\'t Use [noun_website] For [number_small] Days", 
                            "Top [number_small] Add-ons For [noun_program]", 
                            "[number_small] Things That MUST Be In The Next [noun_program] Update" ,
                            "[number_mid] Ways To [verb_attention] Before Lunch" ,
                            "[number_mid] Things Wrong With [noun_program]",
                            "[noun_people] And [noun_tech_general_plural]",
                            "[noun_person] And [noun_tech_single]",
                            "The [number_mid] Best [noun_tech_general_plural] Of 2009", 
                            "[number_small] [noun_tech_general_plural] To Watch For In 2010",
			    "The [number_mid] Best [noun_nerd] Moments",
			    "Top [number_small] [noun_nerd] Videos",
			    "[noun_nerd] : Top [number_mid] Quotes", 
			    "Seriously, Follow [noun_person] On Twitter",
			    "Following [noun_person] On Twitter: [number_small] Weeks Later",
			    "Why [noun_people] Love [noun_nerd]" ,
			    "Top [number_mid] People To Follow On Twitter: Including [noun_person] !",
			    "Do NOT Follow [noun_person] On Twitter!",
			    "A Comprehensive Analysis Of [noun_person] \'s Facebook Profile",
			    "Why [noun_person] And [noun_person] Don\'t Mix",
			    "The [number_mid] Best [noun_tech_general_plural] As Chosen By [noun_person]",
			    "Hollywood Should Reboot [noun_nerd] Again",
			    "Top [number_mid] Tech Flaws In [noun_nerd]",
			    "[noun_people] And [noun_tech_general_plural] : Why We\'re Screwed.",
			    "Why [noun_person] Loves [noun_tech_general_plural] And You Should Too! ",
			    "Flashback: Top [number_mid] [noun_tech_general_plural] Of 1995",
			    "[noun_people] And [noun_weird_plural]",
			    "My [adjective_attention] [noun_tech_general_single] Purchases Of 2009",
			    "We Need An Official [noun_nerd] iPhone App!",
			    "The Top [number_big] iPhone Apps",
			    "[number_mid] Reasons Twitter Should Switch To [number_big] Characters Per Tweet",
			    "Do You Really Need To Follow More Than [number_mid] People on Twitter?",
			    "The Next [noun_website] Craze",
			    "Top [number_mid] [adjective_attention] FOX News Moments!",
			    "[number_small] Wasted Days On [noun_website] that I Won't Be Getting Back",
			    "New Scam: Using [noun_website] To Steal Identities",
			    "The [number_small] Best YouTube Videos On [noun_weird_plural]",
			    "Reinventing [noun_tech_general_plural] From Scratch",
			    "[noun_weird_plural] : A Retrospect",
			    "Mourning the Death Of [noun_weird_plural]",
			    "A Social Network Dedicated To [noun_weird_plural] ?",
			    "[noun_weird_plural] In The 90\'s",
			    "[number_small] New Rules About [noun_weird_plural]",
			    "[number_mid] Things You Didn't Know About [noun_weird_plural]",
			    "I Hate [noun_weird_plural]",
			    "An iPhone App Dedicated To [noun_weird_plural]",
			    "[noun_company] : [number_mid] Years From Now",
			    "New FOX Show: Starring [noun_person] ?",
			    "What Was [noun_person] Thinking?",
			    "Customer Service Horror Stories: [noun_company] Edition",
			    "Top [number_small] Ads Featuring [noun_weird_plural]",
			    "[number_small] Things You Didn't Know About [noun_people]",
			    "[noun_tech_general_plural] : [number_mid] Years From Now",
			    "Spoiler Alert! The Future Of [noun_nerd]",
			    ];



	return (GetRandom(structures));

}









function Analyze(theString) {
	var outstring = "";
	var words = theString.split(" ");
	var nWords = words.length;
	for (var i = 0; i < nWords; i++)
	{
		if(words[i][0] == "[") {
			if(words[i].indexOf("noun") >= 0) {
				var noun = Noun(words[i]);
				outstring = outstring + " " + noun;
			}
			else if(words[i].indexOf("verb") >= 0) {
				var verb= Verb(words[i]);
				outstring = outstring + " " + verb;
			}
			else if(words[i].indexOf("adjective") >= 0) {
				var adjective = Adjective(words[i]);
				outstring = outstring + " " + adjective;
			}
			else if(words[i].indexOf("number") >= 0) {
				var number = theNumber(words[i]);
				outstring = outstring + " " + number;
			}
			else {
				outstring = outstring + " " + words[i];
			}
		}
		else {
			outstring = outstring + " " + words[i];
		}
	}
	
	return outstring;
}

	
	




function Noun(theType) {
	var out = theType.toString();
        var noun_tech_single = ["The iPhone", "The Internet", "Twitter", "Facebook", "MySpace", 
				"The Blog", "The iPhone App", "The MP3", "Android"];
        var noun_tech_plural = ["iPhones", "Black Berries" , "Tweets" , "Computers" , "Websites" ,
				"Facebook Profiles", "Cameras","iPhone Apps", "CDs", "Floppy Disks", 
				"Ringtones", "Cell Phones", "Hybrid Cars", "Computer Monitors", "Laptops",
				"MP3 Players", "iPods", "Zunes", "Screensavers"];
        var noun_company = ["Apple" , "Microsoft" , "Google", "Twitter", "Facebook" , "MySpace" , 
				"eBay" , "Amazon", "Mozilla", "Adobe", "HP", "Dell", "Intel", 
				"Starbucks", "RadioShack", "Best Buy", "Home Depot", "Walmart", "GameStop",
				"NASA", "YouTube"];
        var noun_tech_general_single = ["Phone" , "Browser" , "Software" , "Computer", 
				"Camera", "Video Game", "Operating System", "Hard Drive"];
        var noun_tech_general_plural = ["Phones" , "Browsers" , "Computers", 
				"Cameras", "Video Games", "Operating Systems" , "Hard Drives"];
        var noun_people = ["Nerds" , "Engineers" , "Your Parents" , "People" , "Women", "Men" , "Republicans" ,
				"Apple Fanboys", "Spammers", "Fortune 500 Companies", "Industry Insiders", 
				"Silicon Valley Twenty-Somethings", "Children", "Nigerians", "Teenagers" , 
				"Scientologists" , "US Businesses", "The Chinese" ];
        var noun_person = ["Steve Jobs" , "Bill Gates" , "Obama", "The RIAA", "The Media", "Your Employer", 
				"The Government", "My Wife", "Your Wife", "Your Future Boss" ,  "Adam Savage", 
				"Jeff Goldblum", "Keifer Sutherland", "Chuck Norris", "Batman", "Steven Hawking",
				"Tina Fey" , "David Cross", "NASA" , "George Lucas", "FOX News" , "FOX",
				"The Octo Mom", "The Discovery Channel", "Sarah Palin", "Morgan Webb" , "North Korea"];
        var noun_language = ["C++" , "C#" , "JavaScript" , "Python" , "Apple Basic", "Ruby", "AJAX", 
				"HTML", "ASP.NET", "MATLAB", "Binary", "J#", "Objective-C"];
        var noun_program = ["Twitter" , "Facebook" , "MySpace" , "Google Maps", 
				"Google" ,"Firefox" , "iTunes", "Internet Explorer", "Google Voice", "Chrome", 
				"Google OS", "Photoshop", "MATLAB", "Ubuntu", "Linux"];
        var noun_website = ["Twitter" , "Google" , "Bing" , "Yahoo", "Facebook" , "MySpace" , "Digg" , 
				"Reddit", "Amazon" , "eBay","NeoSprockets", "Craigslist" , "Slashdot", 
				"LinkedIn", "CNN.com" , "FOX News", "DrudgeReport", "Woot.com" , "YouTube"];
	var noun_nerd = ["\"Star Wars\"" , "\"Battlestar Galactica\"" , "\"Lord of the Rings\"" , "\"Star Trek\"" , "\"X-Files\"",
				"\"Fringe\"" , "\"Terminator\"", "\"Back to the Future\"", "\"Mythbusters\"", "\"Arrested Development\"",
				"\"Firefly\"", "\"Monty Python\'s Holy Grail\"", "\"The Simpsons\""];
	var noun_weird_plural = [ "Tattoos", "Haircuts" , "Calculators" , "Pick-up Lines" , "Mouse Pads" , "Carbon Emissions",
				"Carpal Tunnel Syndrome" , "Business Cards" , "Shoes" , "Aviator Sunglasses" , "Sarcasm",
				"Movie Soundtracks" , "VHS Tapes" , "Collectible Star Wars Toys", "Exercise" , "Weird Al Concerts", "Troll Dolls",
				"Slap-on Braclets", "Hang Nails", "Spin Doctor CDs", "Wikipedia Articles" , "80's Movies" , "90's Movies" , 
				"Batman Villians" , "Cosplay" , "\"CSI: Miami\"", "Moon Landing Conspiracies"];

	if (out.indexOf("tech_single") >= 0)
	{
		out = GetRandom(noun_tech_single);
	}
	if (out.indexOf("tech_plural") >= 0)
	{
		out = GetRandom(noun_tech_plural);
	}
	if (out.indexOf("company") >= 0)
	{
		out = GetRandom(noun_company);
	}	
	if (out.indexOf("tech_general_single") >= 0)
	{
		out = GetRandom(noun_tech_general_single);
	}	
	if (out.indexOf("tech_general_plural") >= 0)
	{
		out = GetRandom(noun_tech_general_plural);
	}
	if (out.indexOf("people") >= 0)
	{
		out = GetRandom(noun_people);
	}
	if (out.indexOf("person") >= 0)
	{
		out = GetRandom(noun_person);
	}	
	if (out.indexOf("language") >= 0)
	{
		out = GetRandom(noun_language);
	}	
	if (out.indexOf("program") >= 0)
	{
		out = GetRandom(noun_program);
	}
	if (out.indexOf("website") >= 0)
	{
		out = GetRandom(noun_website);
	}
	if (out.indexOf("nerd") >= 0)
	{
		out = GetRandom(noun_nerd);
	}
	if (out.indexOf("weird_plural") >= 0)
	{
		out = GetRandom(noun_weird_plural);
	}


	return Analyze(out);

}
function Verb(theType) {
	var out = theType.toString();
        var verb_tech = ["Web Surf" , "Use [noun_program]" , "Program In [noun_language]", "Advertise Your Website", "[verb_attention]", 
			"Compete With [noun_website]", "Get A Job With [noun_company]", "Waste A Saturday", "Hack"];
        var verb_business = ["Merge With [noun_company]", "File Lawsuit Against [noun_company]", "Compete With [noun_company]", "Invest In [noun_company]", "Partner With [noun_company]", "Integrate With [noun_company]", "Start New Business With [noun_company]", "Go Bankrupt", "Succeed In 2010"];
        var verb_exagerate = ["Explode When Used", "Corrupt Children", "Destroy Humanity As We Know It"];
        var verb_attention = ["Get Rich", "Retire", "Go Green" , "Make It Big" , "Attract Visitors To Your Site", "Fight Global Warming" , 
				"Make Millions" ,"Build A Website", "Start A Company", "Save the Planet" , "Get Laid", "Reduce Carbon Emmissions", "Attract Members Of The Opposite Sex",
			        "Get Dates" ];


	if (out.indexOf("tech") >= 0)
	{
		out = GetRandom(verb_tech);
	}
	if (out.indexOf("business") >= 0)
	{
		out = GetRandom(verb_business);
	}
	if (out.indexOf("exagerate") >= 0)
	{
		out = GetRandom(verb_exagerate);
	}
	if (out.indexOf("attention") >= 0)
	{
		out = GetRandom(verb_attention);
	}


	return Analyze(out);

}

function Adjective(theType) {
	var out = theType.toString();
        var adjective_simple = ["Amazing", "Awful", "Interesting", 
                           "Useless", "Invaluable", "Important", 
                           "Powerful", "Complex", "Obsolete"];
        
        var adjective_attention = ["Cheapest" , "Most Expensive" , "Easiest", 
                                    "Hardest", "Most \"WTF\"", "Most Obvious", "Most Obnoxious" ,
                                    "Most Significant", "Least Significant", "Best", 
                                    "Worst", "Most Disapointing", "Most Surprising", 
                                    "Sexiest" , "Stupidest" , "Lamest" , "Most Embarassing"];
        
	if (out.indexOf("simple") >= 0)
	{
		out = GetRandom(adjective_simple);
	}
	if (out.indexOf("attention") >= 0)
	{
		out = GetRandom(adjective_attention);
	}

	return Analyze(out);

}

function theNumber(theType) {
	var out = theType.toString();

        var number_mid = ["10", "20", "50"];
        var number_small = ["3" , "5", "8", "10"];
        var number_big = ["100" , "250" , "300" ];

	if (out.indexOf("mid") >= 0)
	{
		out = GetRandom(number_mid);
	}
	if (out.indexOf("small") >= 0)
	{
		out = GetRandom(number_small);
	}
	if (out.indexOf("big") >= 0)
	{
		out = GetRandom(number_big);
	}

	return Analyze(out);





}

function GetRandom(myArray) {
	var l = myArray.length;
	var n = Math.floor(Math.random()*(l));
	var i = myArray[n];

	return i;

}

