var m_idx = 0;
var m_max = 7;
var m = new Array(m_max);

// =========================================================================================
m[7] = new moment(2008, 9, 6, 204, 'Rick Yeatts', 'North Texas vs. Tulsa', 
					'Riley Dodge makes an unexpected appearance in a wide receiver capacity, oficially starting his first year of' +
					' eligibility at North Texas.  His entrance into the game was a surprise to fans, but was needed as the WR corps' +
					' were hurting.',
					'');
m[6] = new moment(2007, 11, 10, 217, 'Rick Yeatts', 'North Texas vs. Navy', 
					'North Texas wide receiver Casey Fitzgerald (87) extends his right arm for a touchdown while being tackled by Navy' +
					' safety Wyatt Middleton (8) as Navy defensive back Matt Wimsatt (54) looks on. This was one of Fitzgerald\'s five' +
					' touchdown receptions during the game in which both teams combined for numerous records throughout the game.',
					'');
m[5] = new moment(2007, 11, 10, 211, 'Rick Yeatts', 'North Texas vs. Navy',
					'North Texas wide receiver Casey Fitzgerald (87) dives for a touchdown in the south endzone as Navy cornerback' +
					' Ketric Buffin (11) watches. This was one of Fitzgerald\'s five touchdown receptions during the game in which' +
					' both teams combined for numerous records throughout the game.',
					'');
m[4] = new moment(2007, 11, 10, 82, 'Rick Yeatts', 'North Texas vs. Navy',
					'North Texas freshman running back Micah Mosely (32) breaks free on a run as safety Wyatt Middleton (8) pursues.' +
					' Mosley finished the game with 26 total yards on 7 carries, and the only rushing touchdown for the Mean Green on' +
					' a day that featured eight passing touchdowns by the North Texas offense.',
					'');
m[3] = new moment(2007, 11, 10, 0, 'Jeff Pergola', 'North Texas vs. Navy',
					'During the pregame ceremonies, four F18 Hornets from the MAG-41 Marines at the Ft. Worth Joint Naval Reserve base' +
					' performed a flyover which was amazing, and really provided a great start to a wonderful evening. The invocation' +
					' was exceptionally touching. The attendance was the third best home attendance at Fout\'s Field ever.',
					'http://www.youtube.com/v/N-RCed4-vJI');
m[2] = new moment(2007, 10, 13, 167, 'Rick Yeatts', 'North Texas vs. Louisiana Monroe',
					'North Texas freshman quarterback Giovanni Vizza (15) and senior running back Jamario Thomas (20) look towards the' +
					' sidelines for a possible change in play call.  Vizza completed the game going 16/30 for 202 yards, having one' +
					' touchdown and one interception.  While Thomas was not as productive, rushing seven times for 32 yards.',
					'');
m[1] = new moment(2007, 10, 13, 24, 'Rick Yeatts', 'North Texas vs. Louisiana Monroe',
					'North Texas freshman quarterback Giovanni Vizza (15) throws a pass to wide receiver Casey Fitzgerald (not pictured)' +
					' from deep within the south endzone.  The pass was caught and taken 99-yards for a touchdown, the 16th 99-yard' +
					' touchdown pass in NCAA history, helping pave the way to secure Todd Dodge\'s first win as North Texas head coach.',
					'http://www.youtube.com/v/mKtqFv63clo');
m[0] = new moment(2007, 9, 1, 82, 'Rick Yeatts', 'North Texas at Oklahoma',
					'North Texas walk-on wide receiver Casey Fitzgerald (87) leaps for a catch during the fourth quarter while Oklahoma' +
					' defensive back D.J. Wolfe (25) looks on. The catch resulted in a touchdown for the Mean Green, the only one they' +
					' scored during a rough outing in Norman during Coach Todd Dodge\'s first game as North Texas head coach.',
					'');

// =========================================================================================


/*
Casey Fitzgerald 99-yard touchdown
<object width="300" height="251">
<param name="movie" value="http://www.youtube.com/v/mKtqFv63clo"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/mKtqFv63clo" type="application/x-shockwave-flash" wmode="transparent" width="300" height="251"></embed>
</object>

Navy pregame cermonies and fly-over
<object width="300" height="251">
<param name="movie" value="http://www.youtube.com/v/N-RCed4-vJI"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/N-RCed4-vJI" type="application/x-shockwave-flash" wmode="transparent" width="300" height="251"></embed>
</object>
*/

function moment (yr, mo, dy, img, by, game, caption, youtube) {
	this.yr = yr;
	this.mo = mo;
	this.dy = dy;
	this.img = img;
	this.by = by;
	this.game = game;
	this.caption = caption;
	this.youtube = youtube;
}

var url=location.href;
var lastSlash=url.lastIndexOf("/");
var whereami=url.substring(lastSlash+1, url.length)
var nextDot=whereami.indexOf(".");
var whereami=whereami.substring(0, nextDot)

if (whereami == 'unt') {
//	var x=Math.round(Math.random() * m_max);
	document.write("<div id=\"moments\" style=\"height: 50px; display: none;\">\n");
	for (x = 0; x <= m_max; x++) {
		yr = pad(m[x].yr, 4);
		mo = pad(m[x].mo, 2);
		dy = pad(m[x].dy, 2);
		img = pad(m[x].img, 4);
		photo = yr+mo+dy+'_'+img;
		if (m[x].youtube != '') {
			document.write("<div style=\"background: #fff; height: 50px; cursor: pointer; background: url(\'images/moments/" + photo + ".png\') no-repeat;\" onclick=\"javascript: void(window.open(\'moment.htm?m=" + x + "\',\'moment_" + x + "\',\'toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=904,height=428,resizable=no\'));\">\n");
			document.write("	<div style=\"padding: 3px 0 0 5px;\">\n");
			document.write("		<img align=\"top\" width=\"35\" src=\"images/youtube.gif\" alt=\"\" height=\"15\" />\n");
			document.write("	</div>\n");
		}
		else {
			document.write("<div style=\"background: #fff; height: 50px; cursor: pointer; background: url(\'images/moments/" + photo + ".png\') no-repeat;\" onclick=\"javascript: void(window.open(\'moment.htm?m=" + x + "\',\'moment_" + x + "\',\'toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=502,height=428,resizable=no\'));\">\n");
		}
		document.write("	<img align=\"top\" width=\"300\" src=\"images/1.gif\" alt=\"\" height=\"50\" />\n");
		document.write("</div>\n");
	}
	document.write("</div>\n");
}
else if (whereami == 'moment') {
	var x = gup('m');
	yr = pad(m[x].yr, 4);
	mo = pad(m[x].mo, 2);
	dy = pad(m[x].dy, 2);
	img = pad(m[x].img, 4);
	photo = yr+mo+dy+'_'+img;
	if (m[x].youtube != '') {
		document.write("<div style=\"float: right;\">\n");
		document.write("	<object width=\"402\" height=\"336\">\n");
		document.write("		<param name=\"movie\" value=\"" + m[x].youtube + "\"></param>\n");
		document.write("		<param name=\"wmode\" value=\"transparent\"></param>\n");
		document.write("		<embed src=\"" + m[x].youtube + "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"402\" height=\"336\"></embed>\n");
		document.write("	</object>\n");
		document.write("	<div style=\"width: 402px; height: 92px; text-align: center; background: #fff; margin-top: -4px; padding-top: 20px;\">\n");
		document.write("		<img align=\"top\" width=\"122\" src=\"images/youtube_lg.gif\" alt=\"\" height=\"52\" />\n");
		document.write("	</div>\n");
		document.write("</div>\n");
	}
	document.write("<div>\n");
	if (m[x].img != 0) {
		document.write("	<div style=\"width: 502px; background: url(\'http://www.rjy.com/new/photos/unt/football/" + yr + "/" + mo + dy + "/photos/" + photo + ".jpg\') center no-repeat;\">\n");
	}
	else {
		document.write("	<div style=\"width: 502px; background: url(\'images/moments/" + photo + "_jp.png\') center no-repeat;\">\n");
	}
	document.write("		<img align=\"top\" width=\"502\" src=\"images/1.gif\" alt=\"\" height=\"336\" />\n");
	document.write("	</div>\n");
	document.write("	<div style=\"width: 502px; color: #ccc; text-align: left; line-height: 1.1em; font-family: Tahoma, Verdana, Arial, sans serif; font-size: 11px;\">\n");
	document.write("		<span style=\"float: left; width: 90px; padding: 0 0 0 10px; text-align: left;\">" + m[x].by + "</span>\n");
	document.write("		<span style=\"float: left; width: 302px; padding: 0 0 0 0; text-align: center; font-weight: bold;\">" + m[x].game + "</span>\n");
	document.write("		<span style=\"float: left; width: 90px; padding: 0 10px 0 0; text-align: right;\">" + m[x].mo + "/" + m[x].dy + "/" + m[x].yr + "</span>\n");
	document.write("	</div>\n");
	document.write("	<div style=\"width: 502px; color: #ccc; font-family: Tahoma, Verdana, Arial, sans serif; font-size: 11px;\">\n");
	document.write("		<span style=\"float: left; padding: 8px 10px 0 10px; text-align: left;\">" + m[x].caption + "</span>\n");
	document.write("	</div>\n");
	document.write("	<div style=\"width: 502px; color: #555; font-family: Tahoma, Verdana, Arial, sans serif; font-size: 9px;\" onclick=\"javascript:void(window.close());\">\n");
	document.write("		<span style=\"float: right; padding: 5px 10px 0 10px; text-align: right; cursor: pointer;\">Click here to close this window</span>\n");
	document.write("	</div>\n");
	document.write("</div>\n");

}

// -----------------------------------------------------------------------------------------
// Pad values with leading zeros...
// -----------------------------------------------------------------------------------------
function pad(value, digits) {
	value = value + '';
	if (value.length < digits) {
		while (value.length < digits) {
			value = '0' + value;
		}
	}
	return value;
}

// -----------------------------------------------------------------------------------------
// Retrieve parms passed via URL parameters...
// -----------------------------------------------------------------------------------------
function gup(name) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "";
	else
		return results[1];
	}