	/*-----------------------------------------------------------------*/
	function StringBuilder() {
			this.buffer = [];
		}
		
			StringBuilder.prototype.append = function append(string) {
				this.buffer.push(string);
				return this;
			};
			
			StringBuilder.prototype.toString = function toString() {
				return this.buffer.join("");
			};

	/*-----------------------------------------------------------------*/  
	function printMarque(){
		var str=new StringBuilder();
		var gameNumber = 1;

		str.append("<marquee scrolldelay='130'>");
		for(var i =0; i<GAMEDATA.length; i++){
			for(var x=0; x<GAMEDATA[i][2].length; x++){
				str.append( "<a href=\"finals/games/game");
				str.append(gameNumber);
				str.append("/\" title=\"View Results\"/><strong>Game ")
				str.append(gameNumber);
				str.append("</strong>");

				if( false == GAMEDATA[i][2][x][GAME_IS_DONE] ){
					str.append("( ");
					str.append(GAMEDATA[i][0]);
					str.append(" - ");
					str.append(GAMEDATA[i][2][x][GAME_TIME]);
					str.append(" ) ");
				}

				str.append(":</a><span style=\"text-decoration: none;\">&nbsp; ");

				 	
				str.append(GAMEDATA[i][2][x][SCHOOL_1]);
				str.append(" ");
				str.append(GAMEDATA[i][2][x][SCHOOL_1_RECORD]);
				str.append(" &nbsp;  - &nbsp; ");
				str.append(GAMEDATA[i][2][x][SCHOOL_2]);
				str.append(" ");
				str.append(GAMEDATA[i][2][x][SCHOOL_2_RECORD]);

				
				str.append(" &nbsp; &nbsp; &nbsp; &#149;  &nbsp; &nbsp; &nbsp; </span></a>");
				gameNumber++;
			}
		} 
		str.append("</marquee>");
		document.write( str.toString() );
	}

	/*-----------------------------------------------------------------*/ 
	function chooseWideOrNarrowDisplay(){
		var NS4, IE4, IE5, NS6, W3C;
		NS4 =(navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
		IE4 = (document.all && !document.getElementById)? true : false;
		IE5 = (document.getElementById && document.all)? true : false;
		NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
		W3C = (document.getElementById)? true : false;


		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			/*myHeight = window.innerHeight;*/
		} else if( document.documentElement && ( 
			document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
			/*myHeight = document.documentElement.clientHeight;*/
		} else if( document.body && ( 
			document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			/*myHeight = document.body.clientHeight;*/
		}
		/*window.alert( 'Width = ' + myWidth );*/
		/*window.alert( 'Height = ' + myHeight );*/

		if ( myWidth < 850 ){
			document.location = "index-800.html";
		} }


	/*-----------------------------------------------------------------*/ 
	function ref( id ) {
		return document.getElementById(id); }


	/*GAME_TIME=0,  SCHOOL_1=1, SCHOOL_1_RECORD=2, SCHOOL_2=3, SCHOOL_2_RECORD=4;*/

	/*-----------------------------------------------------------------*/  
	function printGameTimeForBracket(day, game, gamenumber){ 
		var title = "Game #" + gamenumber + " &#149; " + GAMEDATA[day][2][game][GAME_TIME] + " &#149; " + GAMEDATA[day][0] + " &#149; " + GAMEDATA[day][0];
		document.write( "<span title='" + title + "'><strong>Game # " + gamenumber + "</strong><br/>" + 
			GAMEDATA[day][2][game][GAME_TIME] + "<br/>" + GAMEDATA[day][0] + "</span>"); }

	/*-----------------------------------------------------------------*/  
 	function printTopTeamForBracket(day, game, gamenumber){ 
		var title = GAMEDATA[day][2][game][SCHOOL_1] +  " " + GAMEDATA[day][2][game][SCHOOL_1_RECORD];
		document.write( "<span title='" + title + "'><strong>" + GAMEDATA[day][2][game][SCHOOL_1] +  " " + GAMEDATA[day][2][game][SCHOOL_1_RECORD] + "</strong></span>"  ); }

	/*-----------------------------------------------------------------*/  
 	function printBottomTeamForBracket(day, game, gamenumber){ 
		var title = GAMEDATA[day][2][game][SCHOOL_2] +  " " + GAMEDATA[day][2][game][SCHOOL_2_RECORD];
		document.write( "<span title='" + title + "'><strong>" + GAMEDATA[day][2][game][SCHOOL_2] +  " " + GAMEDATA[day][2][game][SCHOOL_2_RECORD] + "</strong></span>"  ); }



	var MY_GAME_COUNTER = 1;
	/*-----------------------------------------------------------------*/  
	function printThisDay(  GAMEDATA, i, widthtofcontent, hightofcontent, modulemargin ){
	
		var str = new StringBuilder(); 
		

			 
			if( true == GAMEDATA[i][1] ){
				str.append('<div class="module-current" style="width:' + widthtofcontent + ';margin:' + modulemargin + '"><div class="module-contaier">');
				str.append('<div class="module-header-current"> '); 
			}else{
				str.append('<div class="module" style="width:' + widthtofcontent + ';margin:' + modulemargin + '"><div class="module-contaier">');
				str.append('<div class="module-header"> ');
			}

			/*
			str.append('onclick="showHideModule(\'game-day-'); 
			str.append(i);
			str.append('\', \'arrow_');
			str.append(i);
			str.append('\')"');
			str.append('title="Click to show and hide">');
	 
			str.append('<div class="arrow" id="arrow_');
			str.append(i);
			str.append('"></div>');

			*/

			str.append(GAMEDATA[i][0]);
			str.append(' Schedule</div>');
			str.append('<div id="game-day-'); 
			str.append(i);
			str.append('" class="');
			

			

			//if( true == GAMEDATA[i][1] ){
				str.append('visible');
			//}else{
			//	str.append('hidden'); }

			str.append('" style="height:' + hightofcontent + ';">');


			for ( var x = 0; x < GAMEDATA[i][2].length; x++ ){
				

				if( "TBA" == GAMEDATA[i][2][x][2] ){
					/* If teams are unknown */
					str.append( '<p id="game');
					str.append( MY_GAME_COUNTER  );
					str.append('"><strong>Game #' );
					str.append( MY_GAME_COUNTER );
					str.append(' &#149; <span class="game-time">');
					str.append( GAMEDATA[i][2][x][0] );
					str.append('</span></strong><br/>');
					//str.append( GAMEDATA[i][2][x][1] );
					//str.append( ' ' );
					str.append( GAMEDATA[i][2][x][2] );
					
					
					if( true == GAMEDATA[i][2][x][5] ){
						str.append(',');
					}else{ 
						str.append(' vs. ');
					}
					 
					//str.append(' vs.,<br/>');
					str.append( GAMEDATA[i][2][x][3] );
					//str.append( ' ' );
					//str.append( GAMEDATA[i][2][x][4] );
					str.append('</p>');

				}else{ 
					 
					str.append( '<p ');

					if( MY_GAME_COUNTER == CURRENT_LIVEGAME ){
						str.append(' onclick="document.location=\'http://www.titans.uwosh.edu/NCAAChampionship/2007/livestats/xlive.htm\'" ');
					}

					str.append(' id="game');
					str.append( MY_GAME_COUNTER  );
					str.append('"><strong>');
					
					if( true == GAMEDATA[i][2][x][5] ){
						str.append('<a href="finals/games/game' + MY_GAME_COUNTER + '/"  title="View Results">');
					} 
					str.append('Game #' );
					str.append( MY_GAME_COUNTER ) 
					str.append(' &#149; <span class="game-time">');
					str.append( GAMEDATA[i][2][x][0] );
					str.append('</span></strong>');

					if( true == GAMEDATA[i][2][x][5] ){
						str.append('</a>');
					} 

					str.append('<br/>');
					str.append( GAMEDATA[i][2][x][1] );
					str.append( ' ' );
					str.append( GAMEDATA[i][2][x][2] ); 
					 
					if( true == GAMEDATA[i][2][x][5] ){
						str.append(',<br/>');
					}else{ 
						str.append(' vs.<br/>');
					}
					

					str.append( GAMEDATA[i][2][x][3] );
					str.append( ' ' );
					str.append( GAMEDATA[i][2][x][4] );
					str.append('</p>');
				}
				MY_GAME_COUNTER++;
			}
			/*<br/>( if necessary ) */
			str.append('</div></div></div>'); 

		document.write( str.toString() ); }


	/*-----------------------------------------------------------------*/  
	function printDays( GAMEDATA ){

		var str = new StringBuilder(); 
		var count = 1;
		for( var i = 0; i < GAMEDATA.length; i++ ){
			 
			if( true == GAMEDATA[i][1] ){
				str.append('<div class="module-current"><div class="module-contaier">');
				str.append('<div class="module-header-current"> '); 
			}else{
				str.append('<div class="module"><div class="module-contaier">');
				str.append('<div class="module-header"> ');
			}

			/*
			str.append('onclick="showHideModule(\'game-day-'); 
			str.append(i);
			str.append('\', \'arrow_');
			str.append(i);
			str.append('\')"');
			str.append('title="Click to show and hide">');
	 
			str.append('<div class="arrow" id="arrow_');
			str.append(i);
			str.append('"></div>');

			*/

			str.append(GAMEDATA[i][0]);
			str.append(' Schedule</div>');
			str.append('<div id="game-day-'); 
			str.append(i);
			str.append('" class="');
			

			

			//if( true == GAMEDATA[i][1] ){
				str.append('visible');
			//}else{
			//	str.append('hidden'); }

			str.append('" >');


			for ( var x = 0; x < GAMEDATA[i][2].length; x++ ){
				

				if( "TBA" == GAMEDATA[i][2][x][2] ){
					/* If teams are unknown */
					str.append( '<p id="game');
					str.append( count  );
					str.append('"><strong>');

					if( true == GAMEDATA[i][2][x][5] ){
						str.append('<a href="finals/games/game' + count + '/"  title="View Results">');
					}

					str.append('Game #' );
					str.append( count );
					str.append(' &#149; <span class="game-time">');
					str.append( GAMEDATA[i][2][x][0] );
					str.append('</span>');

					if( true == GAMEDATA[i][2][x][5] ){
						str.append('</a>');
					}

					str.append('</strong><br/>');
					//str.append( GAMEDATA[i][2][x][1] );
					//str.append( ' ' );
					str.append( GAMEDATA[i][2][x][2] );

					if( true == GAMEDATA[i][2][x][5] ){
						str.append(',');
					}else{ 
						str.append(' vs.');
					}

					//str.append(' vs.,<br/>');
					str.append( GAMEDATA[i][2][x][3] );
					//str.append( ' ' );
					//str.append( GAMEDATA[i][2][x][4] );
					str.append('</p>');

				}else{ 
					 
					str.append( '<p ');

					if( count == CURRENT_LIVEGAME ){
						str.append(' onclick="document.location=\'http://www.titans.uwosh.edu/NCAAChampionship/2007/livestats/xlive.htm\'" ');
					}

					str.append(' id="game');
					str.append( count  );
					str.append('"><strong>');
					
					if( true == GAMEDATA[i][2][x][5] ){
						str.append('<a href="finals/games/game' + count + '/"  title="View Results">');
					}
					str.append('Game #' );
					str.append( count ) 
					str.append(' &#149; <span class="game-time">');
					str.append( GAMEDATA[i][2][x][0] );
					str.append('</span>');
					
					if( true == GAMEDATA[i][2][x][5] ){
						str.append('</a>');
					}

					str.append('</strong><br/>');
					str.append( GAMEDATA[i][2][x][1] );
					str.append( ' ' );
					str.append( GAMEDATA[i][2][x][2] ); 

					if( true == GAMEDATA[i][2][x][5] ){
						str.append(',<br/>');
					}else{ 
						str.append(' vs.<br/>');
					}

					str.append( GAMEDATA[i][2][x][3] );
					str.append( ' ' );
					str.append( GAMEDATA[i][2][x][4] );
					str.append('</p>');
				}
				count++;
			}
			/*<br/>( if necessary ) */
			str.append('</div></div></div>'); }

		document.write( str.toString() ); }

	/*-----------------------------------------------------------------*/  
	function showHideModule( moduleid, imageid ){
		var e = ref( moduleid);
		var a = ref( imageid );

		if( e.className != 'hidden' ){
			e.className = 'hidden';
			a.className = 'arrow-down';
		}else{
			e.className = 'visible'; 
			a.className = 'arrow'; }  }

	/*-----------------------------------------------------------------*/ 
	/* Photo, Name, Position, Institution, Website*/
	function printHeadshot( photo, name, position, institution, website ){
		var str = new StringBuilder(); 

		str.append('<div class="author-photo" title="');
		str.append(name);
		str.append(', ')
		str.append(position);
		str.append(', ');
		str.append(institution);
		str.append('"><div class="author">Author</div><div class="photo"><img src="includes/images/authors/');
		str.append(photo);
		str.append('" alt=""/></div><div class="caption"><strong>');
		str.append(name);
		str.append('</strong><br/>');
		str.append(position);
		str.append('<br/>');
		
		if("" != website){
			str.append('<a href="');
			str.append(website);
			str.append('" title="Website of  ');
			str.append(institution);
			str.append('">');
			str.append(institution);
			str.append('</a>');
		}else{
			str.append(institution);
		}
		
		str.append('</div></div>');

		document.write( str.toString() );

	}

	/*-----------------------------------------------------------------*/ 
	var CURRENTSCHOOLCOUNTER = 0; 
	function printRecordsTable( i ){ 

		if( RECORDS.length - 1 < i  ){  return; }

		var e = ref('school-info');
		var str = new StringBuilder(); 

		str.append('<div class="school-logo"><img src="includes/images/schools/logos/small/');
		str.append(RECORDS[i][3]);
		str.append('"/></div><div class="win-loss" title="Won - Loss Record"><br/><a href="finals/participants/teams/');
		str.append(RECORDS[i][5]);
		str.append('.xml" title="Meet the Team"/>');
		str.append(RECORDS[i][0]);
		str.append('</a><br/> ');
		str.append(RECORDS[i][1]);
		str.append(' - ');
		str.append(RECORDS[i][2]);
		str.append('</div>');  

		 e.innerHTML = str.toString(); 
	}

  

	/*-----------------------------------------------------------------*/ 
	function nextSchoolRecord(){
		CURRENTSCHOOLCOUNTER = ( CURRENTSCHOOLCOUNTER + 1 ) % RECORDS.length; 
		printRecordsTable(  CURRENTSCHOOLCOUNTER );
	}


	/*-----------------------------------------------------------------*/  
	function previousSchoolRecord(){
		CURRENTSCHOOLCOUNTER--;
		if( CURRENTSCHOOLCOUNTER < 0 ){
			CURRENTSCHOOLCOUNTER = RECORDS.length-1; }
		printRecordsTable(  CURRENTSCHOOLCOUNTER );
	}

	/*-----------------------------------------------------------------*/ 
	function showall(){
		var str = new StringBuilder();  
		str.append('<a href="javascript:stop();shownextandright();"/>Slideshow</a>'); 
		ref("school-menu").innerHTML = str.toString();
		tabularSchoolRecords();
	}


	/*-----------------------------------------------------------------*/ 
	function shownextandright(){
		var str = new StringBuilder(); 
 
		str.append('<a href="javascript:stop();previousSchoolRecord();"/>Previous</a>&nbsp;  &nbsp; &nbsp;  &nbsp;');
		str.append('<a href="javascript:stop();showall();"/>All Teams</a>&nbsp;  &nbsp; &nbsp;  &nbsp;'); 
		str.append('<a href="javascript:stop();nextSchoolRecord();"/>Next</a>');

		ref("school-menu").innerHTML = str.toString();
		play();
	}


	/*-----------------------------------------------------------------*/  
	function tabularSchoolRecords(){

		 var e = ref('school-info');
		var str = new StringBuilder(); 
		var s = "rowitem";
		str.append('<table cellspacing="0" style="width:90%; margin-left:auto; margin-right:auto;"><tr><td class="schoolname"><strong>School<strong></td><td style="width:20px;text-align:center;"><strong>W<strong></td><td style="width:20px;text-align:center;"><strong>L<strong></td></tr>'); 
		for( var i=0; i< RECORDS.length; i++){ 

			if ( i % 2 == 1 ){
				s = "rowitem"; 
			}else{
				s = "rowitem-alternate"; }

 
			str.append('<tr><td  class="schoolname ' + s + '"><a style="text-decoration:none;" href="finals/participants/teams/');
			str.append(RECORDS[i][5]);
			str.append('.xml" title="Meet the Team"/>');
			str.append(RECORDS[i][4]);
			str.append('</a></td><td  class="center ' + s + '">');
			str.append(RECORDS[i][1]);
			str.append('</td><td  class="center ' + s + '">');
			str.append(RECORDS[i][2]);
			str.append('</td></tr>');  
		}
		str.append('</table>'); 
		e.innerHTML = str.toString(); 
	}

 
 
	var TIMEOUTID;					// ID used to clear the timeout, gotten from ID = setTimeout(...)
	var MILISECONDDELAY = 4000;		// Length of slideshow delay in  milliseconds
	 
	  

	/* Starts playing the slide show */
	function play(){
		CURRENTSCHOOLCOUNTER = CURRENTSCHOOLCOUNTER  % RECORDS.length;
		printRecordsTable( CURRENTSCHOOLCOUNTER ); 
		TIMEOUTID = setTimeout("play(" + (CURRENTSCHOOLCOUNTER++)  +  ")", MILISECONDDELAY); 
	}

	/* Stops the slide show */
	function stop(){  
		if( RECORDS.lengnth < 1 ){  return; }

		if( 0 < TIMEOUTID ){
			clearTimeout( TIMEOUTID );
		}
	}
 
 