function Option(text, value, selected) {
	this.text = text;
	this.value = value;
	this.selected = selected;
	
	this.print = function() {
		document.write('<option value="'+this.value+'"'+(selected ? " SELECTED" : "")+'>'+this.text+'</option>');
	};
}

function Category(name) {
	if (!name) name = "";
	this.optGroupName = name;
	this.options = new Array();
	
	this.addOption = function(text, value, selected) {
		if (!value) value = text;
		if (!selected) selected = false;
		this.options[this.options.length] = new Option(text, value, selected);
	};
	
	this.print = function() {
		if (this.name != "")
			document.write('<optgroup label="'+this.optGroupName+'">\n');
		
		for (var i = 0; i < this.options.length; i++)
		{
			this.options[i].print();
		}
		
		if (this.name != "")
			document.write('</optgroup>');
	};
}

/* Categories Class */
function CategoryList() {
	this.cats = new Array();
	
	this.print = function() {
		for (var i = 0; i < this.cats.length; i++)
		{
			this.cats[i].print();
		}
	};
	
	var len = this.cats.length;
	this.cats[len] = new Category();
	this.cats[len].addOption("Please Select...", "Please Select...", true); /* prompt for selection */
	
	len = this.cats.length;
	this.cats[len] = new Category("Most Popular");
	this.cats[len].addOption("General");
	this.cats[len].addOption("General Sport");
	this.cats[len].addOption("Movies");
	this.cats[len].addOption("TV Trivia");
	
	len = this.cats.length;
	this.cats[len] = new Category("Factual");
	this.cats[len].addOption("Acronyms");
	this.cats[len].addOption("Animals");
	this.cats[len].addOption("Astrology");
	this.cats[len].addOption("Crime");
	this.cats[len].addOption("Customs");
	this.cats[len].addOption("Famous Firsts");
	this.cats[len].addOption("History");
	this.cats[len].addOption("Ideas & Beliefs");
	this.cats[len].addOption("Latin Phrases");
	this.cats[len].addOption("Living World");
	this.cats[len].addOption("Religious Fervour");
	this.cats[len].addOption("Science");
	this.cats[len].addOption("Technology");
	this.cats[len].addOption("The Bible");
	this.cats[len].addOption("The Human Body");
	this.cats[len].addOption("The Plant World");
	this.cats[len].addOption("Time & Space");
	this.cats[len].addOption("Transport");
	this.cats[len].addOption("True or False");
	this.cats[len].addOption("Wartime");
	this.cats[len].addOption("What Year");
	this.cats[len].addOption("World Leaders");
	this.cats[len].addOption("World Records");
	this.cats[len].addOption("World War II");
	this.cats[len].addOption("World at War");
	
	len = this.cats.length;
	this.cats[len] = new Category("Food & Drink");
	this.cats[len].addOption("Food & Drink");
	this.cats[len].addOption("Herbs & Spices");
	this.cats[len].addOption("Spirits & Cocktails");
	this.cats[len].addOption("Wine");
	
	len = this.cats.length;
	this.cats[len] = new Category("Entertainment");
	this.cats[len].addOption("80's Movies");
	this.cats[len].addOption("90's Movies");
	this.cats[len].addOption("Disney Films");
	this.cats[len].addOption("James Bond");
	this.cats[len].addOption("Movie Stars");
	this.cats[len].addOption("Movies");
	this.cats[len].addOption("Sci Fi & Fantasy");
	this.cats[len].addOption("Star Marriges");
	this.cats[len].addOption("The Beatles");
	this.cats[len].addOption("TV Sitcoms");
	this.cats[len].addOption("TV Trivia");
	
	len = this.cats.length;
	this.cats[len] = new Category("Geography/Places");
	this.cats[len].addOption("Around Europe");
	this.cats[len].addOption("Around UK");
	this.cats[len].addOption("Capital Cities");
	this.cats[len].addOption("Flags");
	this.cats[len].addOption("Geography");
	this.cats[len].addOption("Ireland");
	this.cats[len].addOption("Islands");
	this.cats[len].addOption("Mountains");
	this.cats[len].addOption("Places");
	this.cats[len].addOption("Rivers");
	this.cats[len].addOption("Where in the World");
	
	len = this.cats.length;
	this.cats[len] = new Category("USA");
	this.cats[len].addOption("General");
	this.cats[len].addOption("Geography");
	this.cats[len].addOption("History");
	this.cats[len].addOption("New York");
	this.cats[len].addOption("Presidents");
	this.cats[len].addOption("Where in the USA");
	
	len = this.cats.length;
	this.cats[len] = new Category("Sport");
	this.cats[len].addOption("Baseball");
	this.cats[len].addOption("Basketball");
	this.cats[len].addOption("Football");
	this.cats[len].addOption("Golf");
	this.cats[len].addOption("Soccer");
	this.cats[len].addOption("Sport (general)");
	this.cats[len].addOption("Tennis");
	this.cats[len].addOption("The Olympics");
	
	len = this.cats.length;
	this.cats[len] = new Category("Music");
	this.cats[len].addOption("Karaoke");
	this.cats[len].addOption("Music & Musicals");
	this.cats[len].addOption("Musical Greats");
	this.cats[len].addOption("Popular Music");
	this.cats[len].addOption("Sinatra");
	
	len = this.cats.length;
	this.cats[len] = new Category("Christian");
	this.cats[len].addOption("The Bible");
	this.cats[len].addOption("Old Testament");
	this.cats[len].addOption("New Testament");
	this.cats[len].addOption("Early history in US");
	this.cats[len].addOption("Reformation");
	this.cats[len].addOption("Popes");
	this.cats[len].addOption("Christian General");
	
	len = this.cats.length;
	this.cats[len] = new Category("Words/Literature");
	this.cats[len].addOption("Alphabet");
	this.cats[len].addOption("Books");
	this.cats[len].addOption("Crossword Clues");
	this.cats[len].addOption("Harry Potter");
	this.cats[len].addOption("Latin Phrases");
	this.cats[len].addOption("Literature");
	this.cats[len].addOption("Names the Same");
	this.cats[len].addOption("Scrabble");
	this.cats[len].addOption("Shakespeare");
	this.cats[len].addOption("Spelling Bee");
	this.cats[len].addOption("Words");
	
	this.print();
}