function GameSetup(GameNumber, GameName) {

	this.GameNumber = GameNumber;
	this.GameName = GameName;

}

function GameInitialize() {

	GameTitle = new Array();

	GameTitle[0]= new GameSetup(1, "Monday Morning (Intermediate)");
	GameTitle[1]= new GameSetup(2, "Monday Evening (Open)");
	GameTitle[2]= new GameSetup(3, "Tuesday Morning (Novice)");
	GameTitle[3]= new GameSetup(4, "Tuesday Evening (1000 MP Max)");
	GameTitle[4]= new GameSetup(5, "Wednesday Evening (Non–Life Master)");
	GameTitle[5]= new GameSetup(6, "Thursday Evening (Novice)");
	GameTitle[6]= new GameSetup(7, "Friday Afternoon (Novice/Intermediate)");
	GameTitle[7]= new GameSetup(8, "Friday Evening (Open)");
	GameTitle[8]= new GameSetup(9, "Saturday Afternoon (Open)");
	GameTitle[9]= new GameSetup(10, "Party Night");

}

function ResultsSetup(Number, Date, NS1, NS2, NS3, NS4, NS5, EW1, EW2, EW3, EW4, EW5) {

	this.Number = Number;
	this.Date = Date;
	this.NS1 = NS1;
	this.NS2 = NS2;
	this.NS3 = NS3;
	this.NS4 = NS4;
	this.NS5 = NS5;
	this.EW1 = EW1;
	this.EW2 = EW2;
	this.EW3 = EW3;
	this.EW4 = EW4;
	this.EW5 = EW5;
}

function ResultsInitialize() {

	GameResult = new Array();

	GameResult[0] = new ResultsSetup(1, "July 28", "Connie and Don Tigert", "Rosemary Miller, Bob Saunders", "Jim Johnson, Beryle Patterson", "", "", "Gerry Fuchs, John Henry", "Marlene Pritchard, Lenore Pastuzak", "Miriam Gaskin, Joy Woodward", "", "");

	GameResult[1] = new ResultsSetup(2, "July 28", "Ross White, Jack Shinehoft", "Mary Jagodinski, Dan Perco", "Joan Wriedt, Helen Kirkpatrick", "Rod McLeod, John Darracott", "Marg Nash, Jean Brownbill", "June Millington, Gene Thom", "Andrew Deby, Eileen Grady", "Layna Skovmose, Don Donoahue", "Rosemary Miller, Viktoria Renaud", "Peter Moore, Laurie Due");

	GameResult[2] = new ResultsSetup(3, "July 29", "Sue Darracott, Cynthia Kay", "Leona Langill, Marg Collins", "Tina Montgomery, Bob Saunders", "", "", "Peggy Ferguson, Flo Crozier", "Olive Matthie, Margaret Smith", "Marie Thompson, Sandra Giammichele", "", "");

	GameResult[3] = new ResultsSetup(4, "July 29", "Pam Eves, Jim Wolsey", "Mark Fairlamb, John Parker", "Michelle and Gord Ellis", "Bonnie Bond, Bob Saunders", "Eileen Grady, Barry Petrie", "Ruth Roe, Viktoria Renaud", "Lois Donat, Brian Bond", "Christine and Gene Fitzpatrick", "Anne Pennington, Bruce Ritchie", "Barbara Gifford, June Millington");

	GameResult[4] = new ResultsSetup(5, "July 30", "Michelle Ellis, Eileen Grady", "Beryle Patterson, Gail Livingstone", "Don Mallory, Gerry Whelaton", "Linda Young, Bob Saunders", "Kelly and Doug Gowland", "Corinne White, Anne Pennington", "Laura Ludwin, Jean Prior", "Fred Kivell, Susan Meek", "Morag Horseman, Bonnie Hugill", "Mary Morelli, Bruce Ritchie");

	GameResult[5] = new ResultsSetup(6, "July 31", "Carolle Lyons, Nancy Haykin", "Mary Stott, Andrea Cichra", "Joan and Vern Sorensen", "", "", "Carla Wallace, Sandy Campbell", "Bella Muller, Russ Fletcher", "Nora Crawford, Marg Collins", "", "");

	GameResult[6] = new ResultsSetup(7, "August 1", "Margaret Smith, Olive Matthie", "Mary Stott, Andrea Cichra", "Len Trickey, Kris Kalia", "", "", "Dorothy Pollington, Pat Smith", "Sue and John Darracott", "Lenore Pastuzak, Johanna Westenberg", "", "");

	GameResult[7] = new ResultsSetup(8, "August 1", "Helen Kirkpatrick, Frieda Horning", "JoAnne Kitchen, Barry Petrie", "Joy and Jim Dundas", "Betty McLeod, Rod McLeod", "John Parker, Milt Payne", "", "", "", "", "");

	GameResult[8] = new ResultsSetup(1, "August 4", "Jim Johnson, Beryle Patterson", "Marilyn Spate, Jim Reiser", "Miriam Gaskin, Joy Woodward", "Pam Eves, Jim Wolsey", "", "Eileen Grady, Viktoria Renaud", "Rosemary Miller, Bob Saunders", "Cathy Cosgriffe, Flo Crozier", "John Henry, Gerry Fuchs", "");

	GameResult[9] = new ResultsSetup(2, "August 4", "Helen Kirkpatrick, Betty McLeod", "Eileen Grady, Bob Saunders", "Rod McLeod, Frieda Horning", "", "", "Pat Saunders, Vijay Jhamb", "Norma and Brian Bond", "Mike Kammermayer, Laurie Due", "", "");

	GameResult[10] = new ResultsSetup(3, "August 5", "Janet Hunter, Peter Moore", "Pam Eves, Murray Caudle", "Bonnie Bond, Steve Bartlett", "Tina Montgomery, Bob Saunders", "", "Dorothy Pollington, Jean Prior", "Peggy Ferguson, Flo Crozier", "Arley Luke, Ken Dolbear", "Sue Darracott, Cynthia Kay", "");

	GameResult[11] = new ResultsSetup(4, "August 5", "Christine Feaver, Jim Johnson", "Barb Freeth, Brian Bond", "Bonnie Bond, Bob Saunders", "Pat Saunders, Perla Naskar", "Eileen Grady, Barry Petrie", "Mark Rau, Chuck Paulissen", "Jane Guan, Joe Zhao", "Anne Pennington, Corinne White", "Alex Kronenwald, Bob Kammermayer", "Helene Lemieux-Moore, Beryle Patterson");

	GameResult[12] = new ResultsSetup(5, "August 6", "Beryle Patterson, Jim Johnson", "Susan Meek, Wayne Cruickshanks", "Eileen Grady, Michelle Ellis", "Brian Bond, Barry Petrie", "", "Bob Saunders, Gord Ellis", "Marilyn Spate, June Millington", "Morag Horseman, Bonnie Hugill", "Greg Meek, Russ Fletcher", "");

	GameResult[13] = new ResultsSetup(6, "August 7", "Steve Kuczerepa, Keith Dakgleish", "John and Lynda Siba", "Mary Stott, Andrea Cichra", "", "", "Carla Wallace, Sandy Campbell", "Nora Crawford, Marg Collins", "Tamara Foell, Una Gelly", "", "");

	GameResult[14] = new ResultsSetup(7, "August 8", "Kris Kalia, Viktoria Renaud", "Keith Dalgleish, Chuck Renaud", "Joan Newton, Bob Lister", "", "", "Dorothy Pollington, Margaret Selinger", "Leona Langill, Marg Collins", "Sue and John Darracott", "", "");

	GameResult[15] = new ResultsSetup(1, "August 11", "Eileen Grady, Viktoria Renaud", "Rosemary Miller, Bob Saunders", "Jean Hader, Marie Gallacher", "Pam Eves, Jim Wolsey", "John Henry, Gerry Fuchs", "", "", "", "", "");

	GameResult[16] = new ResultsSetup(2, "August 11", "Ian Budge, Brian Warry", "Helen Kirkpatrick, Betty McLeod", "Rod McLeod, Frieda Horning", "Viktoria Renaud, Billy Mellon", "", "Eileen Grady, Bob Saunders", "Barbara Gifford, Geri Saindon", "Janet Perigo, Cay North", "Gene Thom, Vijay Jhamb", "");

	GameResult[17] = new ResultsSetup(3, "August 12", "Tina Montgomery, Bob Saunders", "Sue Darracott, Cynthia Kay", "Marg Collins, Leona Langill", "Barb Wilson, Mary Mills", "", "Peggy Ferguson, Flo Crozier", "Dorothy Pollington, Jean Prior", "Arley Luke, Winslow Pilgrim", "Margaret Selinger, Margaret Vanderzanden", "");

	GameResult[18] = new ResultsSetup(4, "August 12", "Jane Guan, Joe Zhao", "Sandy Dennison, Wally Kirkpatrick", "Tom Peckham, John Parker", "Lois Donat, Brian Bond", "Mary Morelli, Ognian Marinov", "Corinne and Ross White", "Doug North, Andy Deby", "Marg Nash, June Millington", "Frank Logan, Elmer Schurter", "Phyllis Morelli, Ray O'Connor");

	GameResult[19] = new ResultsSetup(5, "August 13", "Len Trickey, June Millington", "Jim Reiser, Jim Jenks", "Bonnie Bond, Anne Ferguson", "Kelley and Doug Gowland", "Marjorie Letwin, Barry Petrie", "Leona Langill, Myrna Dawson", "Pat Woolcott, Pat Hunter", "Susan Meek, Fred Kivell", "Barbara Gifford, Jim Johnson", "John Darracott, Seamus Darracott");

	GameResult[20] = new ResultsSetup(6, "August 14", "Sally Tindale, Russ Fletcher", "Sandy Campbell, John Roberts", "Bonnie Bond, Anne Ferguson", "", "", "Joan and Vern Sorensen", "Nora Crawford, Marg Collins", "Bella Muller, Nancy Haykin", "", "");

	GameResult[21] = new ResultsSetup(7, "August 15", "Bonnie Bond, Anne Ferguson", "Joan Newton, Bob Lister", "Andrea Cichra, Mary Stott", "Margaret Selinger, Mary Antolich", "", "Dorothy Pollington, Pat Smith", "Sally Tindale, Yvonne Cruden", "Sandy Campbell, Russ Fletcher", "Nancy Haykin, Ethel Lapp", "");

	GameResult[22] = new ResultsSetup(8, "August 15", "Tom Cowles, Billy Mellon", "Betty McLeod, Rod McLeod", "Art Somers, Joe Zhao", "Helen Kirkpatrick, Rita Poder", "Cay and Doug North", "", "", "", "", "");

	GameResult[23] = new ResultsSetup(1, "August 18", "Pam Eves, Jim Wolsey", "Steve Bartlett, Viktoria Renaud", "Layna Skovmose, Mary Jagodinski", "", "", "Marlene Pritchard, Lenore Pastuzak", "Miriam Gaskin, Joy Woodward", "Pat Woolcott, Pat Hunter", "", "");

	GameResult[24] = new ResultsSetup(2, "August 18", "Roger Snowling, Jack Shinehoft", "Vijay Jhamb, Jim McGuire", "Don Morrison, Tom McColclough", "Norma and Brian Bond", "Ian Budge, Brian Warry", "", "", "", "", "");

	GameResult[25] = new ResultsSetup(3, "August 19", "Chuck and Viktoria Renaud", "Pam Eves, Murray Caudle", "David Levy, Mike Vanderzanden", "Mirdza Jaunzemis, Janet Hunter", "", "Marg Collins, Leona Langill", "Marguerite Varrasso, Marie Thompson", "Berthe Rodger, Barb Wilson", "Peggy Ferguson, Flo Crozier", "");

	GameResult[26] = new ResultsSetup(4, "August 19", "Sandy Dennison, Wally Kirkpatrick", "Ruth Roe, Viktoria Renaud", "Bonnie Bond, Bob Saunders", "Rosemary Miller, Linda Young", "Barb Freeth, Brian Bond", "Betty Metcalfe, Glennys Weatherston", "Bob Kammermayer, Alex Kronenwald", "Corinne White, Anne Pennington", "Barbara Gifford, Barry Petrie", "Chuck Paulissen, Mark Rau");

	GameResult[27] = new ResultsSetup(5, "August 20", "Mary Lou Gitschner, Viktoria Renaud", "Len Trickey, Peter Moore", "Pam Eves, Jim Wolsey", "Marilynne Weadick, Chuck Renaud", "Doug North, Barry Petrie", "Mary Louise Beecroft, Art Johnston", "June Millington, Barbara Gifford", "Russ Fletcher, Greg Meek", "Susan Meek, Fred Kivell", "Michelle and Gord Ellis");

	GameResult[28] = new ResultsSetup(6, "August 21", "Ginny and Mitch Levine", "John Roberts, Steve Kuczerepa", "Andrea Cichra, Dawn Little", "", "", "Sandy Campbell, Janet Wagstaffe", "Sally Tindale, Russ Fletcher", "Joyce Mitchell, Keith Dalgleish", "", "");

	GameResult[29] = new ResultsSetup(7, "August 22", "Lisa Pilgrim, Joyce Gaudette", "Margaret Selinger, Mary Antolich", "Bonnie Bond, Carolle Lyons", "", "", "Joan Newton, Bob Lister", "Marg Collins, Leona Langill", "Greg Meek, Russ Fletcher", "", "");

	GameResult[30] = new ResultsSetup(8, "August 22", "Helen Kirkpatrick, Viktoria Renaud", "Joy and Jim Dundas", "Connie and Don Tigert", "Elizabeth Rideout, Syed Ahmad", "Mary Weaver, Barry Petrie", "", "", "", "", "");

	GameResult[31] = new ResultsSetup(6, "August 11", "", "", "", "", "", "", "", "", "", "");

	GameResult[32] = new ResultsSetup(6, "August 11", "", "", "", "", "", "", "", "", "", "");


/*




*/

}

function ResultsForm() {

	GameInitialize();
	ResultsInitialize();

	ResultForm = "<form name='ResultsSelect'><h2>Select A Game:</h2><table border=0 width=100% cellpadding=3 cellspacing=0><tr><td class='middle' width=3%><input type='radio' name='Game' value='All'></td><td class='middle' width=30%><b>All</b></td><td class='middle' width=3%><input type='radio' name='Game' value='MondayMorning'></td><td class='middle' width=30%>Monday Morning</td><td class='middle' width=3%><input type='radio' name='Game' value='MondayEvening'></td><td class='middle'>Monday Evening</td></tr>";

	ResultForm += "<tr><td class='middle'><input type='radio' name='Game' value='TuesdayMorning'></td><td class='middle'>Tuesday Morning</td><td class='middle'><input type='radio' name='Game' value='TuesdayEvening'></td><td class='middle'>Tuesday Evening</td><td class='middle'><input type='radio' name='Game' value='WednesdayEvening'></td><td class='middle'>Wednesday Evening</td></tr>";

	ResultForm += "<tr><td class='middle'><input type='radio' name='Game' value='ThursdayEvening'></td><td class='middle'>Thursday Evening</td><td class='middle'><input type='radio' name='Game' value='FridayAfternoon'></td><td class='middle'>Friday Afternoon</td><td class='middle'><input type='radio' name='Game' value='FridayEvening'></td><td class='middle'>Friday Evening</td></tr>";

	ResultForm += "<tr><td class='middle'><input type='radio' name='Game' value='SaturdayAfternoon'></td><td class='middle'>Saturday Afternoon</td><td class='middle'><input type='radio' name='Game' value='PartyNight'></td><td class='middle'>Party Night</td><td class='middle'>&nbsp;</td><td class='middle'>&nbsp;</td></tr></table><p><input type='Submit' value='Go' onClick='ResultsCalculate()'></p></form>";

	document.all.ResultsCell.innerHTML = ResultForm;

}

function ResultsCalculate() {

	Choice = 0;

	for (i = 0; i < document.ResultsSelect.Game.length; i++) {
		if(document.ResultsSelect.Game[i].checked) {
			Choice = i;
		}
	}

	GameSelect(Choice);
}

function GameSelect(Selection) {

	j = 0;

	SelectedGame = new Array();

	for(i = 0; i < GameResult.length; i++) {

		SelectedGame[j] = new ResultsSetup(GameResult[i].Number, GameResult[i].Date, GameResult[i].NS1, GameResult[i].NS2, GameResult[i].NS3, GameResult[i].NS4, GameResult[i].NS5, GameResult[i].EW1, GameResult[i].EW2, GameResult[i].EW3, GameResult[i].EW4, GameResult[i].EW5);

		if(SelectedGame[j].NS1 == "") {
			SelectedGame[j].NS1 = "No game";
		}
		if(SelectedGame[j].EW1 == "") {
			SelectedGame[j].EW1 = "&nbsp;";
			SelectedGame[j].EW2 = "&nbsp;";
			SelectedGame[j].EW3 = "&nbsp;";
			SelectedGame[j].EW4 = "&nbsp;";
			SelectedGame[j].EW5 = "&nbsp;";
		}
		j++;
	}

	if(Selection == 0) {
		ResultsDisplayAll();
	}
	else {
		ResultsDisplaySelected(Selection);
	}
}

function ResultsDisplayAll() {

	Title = "All Games";

	ResultDisplay = "<p><table border=0 width=100% cellpadding=3 cellspacing=0><tr><td width=83%><h2>" + Title + "</td><td class='right small' width=3%><a href='Results.html'><img src='Images/Back.gif' border=0></a><td class='right small'><a href='Results.html'>More Results</a></td></tr></table></p>";

	ResultDisplay += "<p>For Howell movements, results are shown in the North/South column.</p>";

	ResultDisplay += "<p><table border=1 cellpadding=3 cellspacing=0 width=100%>";

	ResultDisplay += "<tr><th width=20%>Date</th><th width=10%>Game</th><th colspan=2 width=35%>North/South</th><th colspan=2>East/West</th></tr>";

	for(i = (SelectedGame.length - 1); i >= 0; i--) {

		if(SelectedGame[i].NS1 == "No game") {
		}
		else {

			ResultDisplay += "<tr><td class=topcenter rowspan=5>" + SelectedGame[i].Date + "</td>";

				for(j = 0; j < GameTitle.length; j++) {
					if(SelectedGame[i].Number == GameTitle[j].GameNumber) {
						Title = GameTitle[j].GameName;
					}
				}

			ResultDisplay += "<td class=topcenter rowspan=5>" + Title + "</td>";

			if(SelectedGame[i].NS2 == "") {
				SelectedGame[i].NS2 = "&nbsp;";
			}
			if(SelectedGame[i].NS3 == "") {
				SelectedGame[i].NS3 = "&nbsp;";
			}
			if(SelectedGame[i].NS4 == "") {
				SelectedGame[i].NS4 = "&nbsp;";
			}
			if(SelectedGame[i].NS5 == "") {
				SelectedGame[i].NS5 = "&nbsp;";
			}

			if(SelectedGame[i].EW1 == "") {
				SelectedGame[i].EW1 = "&nbsp;";
			}
			if(SelectedGame[i].EW2 == "") {
				SelectedGame[i].EW2 = "&nbsp;";
			}
			if(SelectedGame[i].EW3 == "") {
				SelectedGame[i].EW3 = "&nbsp;";
			}
			if(SelectedGame[i].EW4 == "") {
				SelectedGame[i].EW4 = "&nbsp;";
			}
			if(SelectedGame[i].EW5 == "") {
				SelectedGame[i].EW5 = "&nbsp;";
			}

			ResultDisplay += "<td class=center width=3%><b>1</b></td><td width=32%>" + SelectedGame[i].NS1 + "</td><td class=center width=3%><b>1</b></td><td>" + SelectedGame[i].EW1 + "</td></tr>";

			ResultDisplay += "<tr><td class=center><b>2</b></td><td>" + SelectedGame[i].NS2 + "</td><td class=center><b>2</b></td><td>" + SelectedGame[i].EW2 + "</td></tr>";

			ResultDisplay += "<tr><td class=center><b>3</b></td><td>" + SelectedGame[i].NS3 + "</td><td class=center><b>3</b></td><td>" + SelectedGame[i].EW3 + "</td></tr>";

			ResultDisplay += "<tr><td class=center><b>4</b></td><td>" + SelectedGame[i].NS4 + "</td><td class=center><b>4</b></td><td>" + SelectedGame[i].EW4 + "</td></tr>";

			ResultDisplay += "<tr><td class=center><b>5</b></td><td>" + SelectedGame[i].NS5 + "</td><td class=center><b>5</b></td><td>" + SelectedGame[i].EW5 + "</td></tr>";

		}
	}

	ResultDisplay += "</table></p>";

	document.all.ResultsCell.innerHTML = ResultDisplay;

}

function ResultsDisplaySelected(Selection) {

	for(i = 0; i < GameTitle.length; i++) {
		if(Selection == GameTitle[i].GameNumber) {
			Title = GameTitle[i].GameName;
		}
	}

	ResultDisplay = "<p><table border=0 width=100% cellpadding=3 cellspacing=0><tr><td width=83%><h2>" + Title + "</td><td class='right small' width=3%><a href='Results.html'><img src='Images/Back.gif' border=0></a><td class='right small'><a href='Results.html'>More Results</a></td></tr></table></p>";

	ResultDisplay += "<p>For Howell movements, results are shown in the North/South column.</p>";

	ResultDisplay += "<p><table border=1 cellpadding=3 cellspacing=0 width=100%>";

	ResultDisplay += "<tr><th width=20%>Date</th><th colspan=2 width=40%>North/South</th><th colspan=2>East/West</th></tr>";

	for(i = (SelectedGame.length - 1); i >= 0; i--) {

	if(Selection == SelectedGame[i].Number) {

		if(SelectedGame[i].NS1 == "No game") {
		}
		else {

			if(SelectedGame[i].NS2 == "") {
				SelectedGame[i].NS2 = "&nbsp;";
			}
			if(SelectedGame[i].NS3 == "") {
				SelectedGame[i].NS3 = "&nbsp;";
			}
			if(SelectedGame[i].NS4 == "") {
				SelectedGame[i].NS4 = "&nbsp;";
			}
			if(SelectedGame[i].NS5 == "") {
				SelectedGame[i].NS5 = "&nbsp;";
			}

			if(SelectedGame[i].EW1 == "") {
				SelectedGame[i].EW1 = "&nbsp;";
			}
			if(SelectedGame[i].EW2 == "") {
				SelectedGame[i].EW2 = "&nbsp;";
			}
			if(SelectedGame[i].EW3 == "") {
				SelectedGame[i].EW3 = "&nbsp;";
			}
			if(SelectedGame[i].EW4 == "") {
				SelectedGame[i].EW4 = "&nbsp;";
			}
			if(SelectedGame[i].EW5 == "") {
				SelectedGame[i].EW5 = "&nbsp;";
			}

			ResultDisplay += "<tr><td class=topcenter rowspan=5>" + SelectedGame[i].Date + "</td>";

			ResultDisplay += "<td width=3%><b>1</b></td><td>" + SelectedGame[i].NS1 + "</td><td width=3%><b>1</b></td><td>" + SelectedGame[i].EW1 + "</td></tr>";

			ResultDisplay += "<tr><td><b>2</b></td><td>" + SelectedGame[i].NS2 + "</td><td><b>2</b></td><td>" + SelectedGame[i].EW2 + "</td></tr>";

			ResultDisplay += "<tr><td><b>3</b></td><td>" + SelectedGame[i].NS3 + "</td><td><b>3</b></td><td>" + SelectedGame[i].EW3 + "</td></tr>";

			ResultDisplay += "<tr><td><b>4</b></td><td>" + SelectedGame[i].NS4 + "</td><td><b>4</b></td><td>" + SelectedGame[i].EW4 + "</td></tr>";

			ResultDisplay += "<tr><td><b>5</b></td><td>" + SelectedGame[i].NS5 + "</td><td><b>5</b></td><td>" + SelectedGame[i].EW5 + "</td></tr>";

		}
	}
	}

	ResultDisplay += "</table></p>";

	document.all.ResultsCell.innerHTML = ResultDisplay;

}
