var perlLastMod = "January 2, 2010"; 
var mmtEntrants = 160; 

//Menu extension for News Archives

function expand(section, heading){
	if (document.getElementById){
		var elementStyle = document.getElementById(section).style;
		if (elementStyle.display == "inline"){
			elementStyle.display = "none";
			document.getElementById(heading).innerHTML = "+ Prior Years";
		} else {
			elementStyle.display = "inline"
			document.getElementById(heading).innerHTML = "- ";
		}
		return false;
	} else {
	return true;
	}

}

//master date stuff
var toDay = new Date();
var zoneOffset = toDay.getTimezoneOffset();
zoneOffset *= 60*1000;

//Begin Month and Day of Week Arrays

monthNames = new Array(12)
monthNames[0]  = "Jan"
monthNames[1]  = "Feb"
monthNames[2]  = "Mar"
monthNames[3]  = "Apr"
monthNames[4]  = "May"
monthNames[5]  = "June"
monthNames[6]  = "July"
monthNames[7]  = "Aug"
monthNames[8]  = "Sept"
monthNames[9]  = "Oct"
monthNames[10] = "Nov"
monthNames[11] = "Dec"
   
dayNames = new Array(7)
dayNames[0]  = "Sun"
dayNames[1]  = "Mon"
dayNames[2]  = "Tues"
dayNames[3]  = "Wed"
dayNames[4]  = "Thur"
dayNames[5]  = "Fri"
dayNames[6]  = "Sat"

//cookie stuff
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
 return getCookieVal (j);
 i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
//end cookie stuff

//set last modified date
var lastmodDate;
if (perlLastMod == ""){
lastmodDate = document.lastModified;} else
	{lastmodDate = perlLastMod};	
var modDate = new Date(lastmodDate);
var modMonth = modDate.getMonth();
var modDayofMonth = modDate.getDate();
var modDay = modDate.getDay();
var modDateString = "<div class='small'>Last updated: " + dayNames[modDay] + ", " + monthNames[modMonth] + " " + modDayofMonth + "</div>"; 
//var modDateString = "<div class='small'>Last updated: " + dayNames[modDay] + ", " + monthNames[modMonth] + " " + modDayofMonth + "</div>"; 

//end last modified date

function nothing(){}

//welcome back repeat visitors
if(document.cookie){
var oldLast = GetCookie("LastVisit");
var VisitorName = GetCookie('VisitorName');
var newWin = GetCookie('newWindow');
var weather = GetCookie('weather');
var weatherSwitch = "Toggle Weather Button";
if (weather == "yes"){
	weatherSwitch = "Kill Weather Button"}
if (weather == "no"){
	weatherSwitch = "Display Weather Button"}
} else {
	var weatherSwitch =	""}
var msgName;
var msgWeather = "";	

if (VisitorName){
msgName = "<div class='small'>Hi! <strong>" + GetCookie("VisitorName") + "<\/strong><br><a href='givename.htm'>Edit your settings.<\/a><\/div>";
 var nMonth = toDay.getMonth() + 1;
 var nDay = toDay.getDate();
 var nYear = toDay.getYear();
 if (nYear < 1900){nYear += 1900};
 var newTime = nMonth + "/" + nDay + "/" + nYear;
 var expdate = toDay;
 FixCookieDate (expdate); 
 expdate.setTime (expdate.getTime() + (60*24*60*60*1000));
 SetCookie ('LastVisit', newTime, expdate);
 var email = GetCookie('email');
 SetCookie ('email', email, expdate); 
 SetCookie ('VisitorName', VisitorName, expdate);
 SetCookie ('oldLast', oldLast);
 SetCookie ('newWindow', newWin, expdate);
 SetCookie ('weather', weather, expdate);
} 
else {
msgName = "<div class='small'><a href='givename.htm'>Personalize this page!<\/a><\/div>"}

function setWelcome(){
if(1){
document.write(modDateString + msgName)
}
}


var expdate = new Date ();

//End welcome back

//external link stuff
var where = "_self";

function hyperlinks(target){
	if(target != "first"){
		if (target) {
		where = "_blank"}
   		else {where = "_self";}
		} else {
   if (newWin == "yes"){	
	where = "_blank";
   document.winToggle.targetnew.checked = true;}
   }
   for (var i=0; i<=(document.links.length-1); i++)
   {
   if (document.links[i].hostname != "www.vhtrc.org" && document.links[i].hash.indexOf("#") < 0){
   document.links[i].target = where;
   }
   }
}

//Weather stuff

var weatherCode ="<div align='right' class='small'><a href='http://www.wunderground.com/US/VA/Arlington.html'><img src='http://banners.wunderground.com/banner/gizmotimetemp/US/VA/Arlington.gif' alt='Click for Arlington, Virginia Forecast' width='127' height='41' border='0'></a></div>";

if (GetCookie('weather') == "no"){
	weatherCode = "<img src='gifs/blank.gif' width='125' height='1'>"};

msgWeather = "<div align='center' class='small'><a href='javascript\:nothing()' onClick='showWeather(); return false'>" + weatherSwitch + "<\/a></div>";

function setFirstWeather(){
	if (1){
	document.write(weatherCode);
	//document.write(msgWeather);
	}
	}
function showWeather(){
	if (GetCookie('weather') == "no"){
	SetCookie('weather','yes')} else {
	SetCookie('weather','no')};
	location.reload()
	}
	
	
//What's new date icon
function dateIcon(effDate) 
{
 if (VisitorName) {
 visDate = new Date(GetCookie('oldLast'));
 modDate = new Date(effDate);
 days = Math.round((visDate.getTime() - modDate.getTime())/ (24 * 60 * 60 * 1000));
 document.write("<img src='gifs/");
 if (days < 1) {
 document.write("red-dot.gif' width=10 height=10 alt='NEW' border=0>")
 }
 else {
 document.write("green-dot.gif' width=10 height=10 alt='Green Dot' border=0>");
 }
 return 0;};
 if (!VisitorName) {
 document.write("<img src='gifs/green-dot.gif' width=10 height=10 alt='Green Dot' border=0>");
 return 0;}
}

function newIcon()
{
var lastDate;
if(lastDate = GetCookie('oldLast')){
var myArray = lastDate.split("/");
var myMonth = monthNames[myArray[0]-1];
var myLastDate = myMonth + " " + myArray[1];

 if (VisitorName) {
document.write("<div class='small' align='center'>Your last visit: " + myLastDate + "<br>New items = <img src='gifs/red-dot.gif' width=10 height=10 alt='NEW' border='0'><\/div>");
 }
 }
}


//End what's new date icon

	 //Add number of MMT entrants
function mmtEnts(){
	if (mmtEntrants){
		document.write(
			"<div class='small' style='margin-bottom: .5em' align='center'>[<a href='mmt/entrants.htm'>MMT Entrants: " + mmtEntrants + "</a>]</div>"
		);
	}
}



//set the text on load

//Begin Words Section

//random sayings

var words = new Array(81)
words[0] = "\"There is more to life than increasing its speed.\"  --Mahatma Gandhi"
words[1] = "A thing not worth doing isn't worth doing well."
words[2] = "Conscience is what hurts when everything else feels so good."
words[3] = "I wonder how much deeper the ocean would be without sponges."
words[4] = "I think sex is better than logic, but I can't prove it."
words[5] = "Please wear your seat belt. It makes it harder for the aliens to suck you out of your car."
words[6] = "Remember, amateurs built the Ark, professionals built the Titanic."
words[7] = "Good Health is merely the slowest possible rate at which one can die."
words[8] = "Sometimes too much to drink isn't enough."
words[9] = "Honk if you love peace and quiet."
words[10] = "\"Always do what is right.  This will surprise some people and astonish the rest.\"  --Mark Twain"
words[11] = "\"Happiness makes up for in height what it lacks in length.\" --Robert Frost"
words[12] = "\"You gain strength, courage, and confidence by every experience in which you really stop to look fear in the face.\"  --Eleanor Roosevelt"
words[13] = "\"Destiny is no matter of chance.  It is a matter of choice.  It is not a thing to be waited for, it is a thing to be achieved.\"  --William Jennings Bryan"
words[14] = "\"They can conquer who believe they can.\"  --Virgil"
words[15] = "\"The way to become boring is to say everything.\"  --Voltaire"
words[16] = "Growing Old is Inevitable; Growing Up is Optional."
words[17] = "Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
words[18] = "An optimist thinks that this is the best possible world. A pessimist fears that this is true."
words[19] = "\"Between friends, differences in taste or opinion are irritating in direct proportion to their triviality.\"  --W.H. Auden"
words[20] = "A day without sunshine is like night."
words[21] = "In just two days, tomorrow will be yesterday."
words[22] = "Indecision is the key to flexibility."
words[23] = "\"Give me a woman who loves beer and I will conquer the world.\" --Kaiser Wilhelm"
words[24] = "Half of all marriages end in divorce. That's not as bad as it sounds. The other half end in death."
words[25] = "\"The problem with the world is that everyone is a few drinks behind.\" --Humphrey Bogart"
words[26] = "\"Always remember that I have taken more out of alcohol than alcohol has taken out of me.\" --Winston Churchill"
words[27] = "\"If God had intended us to drink beer, He would have given us stomachs.\" --David Daye"
words[28] = "Reality is an illusion that occurs due to lack of alcohol."
words[29] = "\"I feel sorry for people who don't drink. When they wake up in the morning, that's as good as they're going to feel all day.\" --Frank Sinatra"
words[30] = "99 percent of lawyers give the rest a bad name."
words[31] = "If at first you don't succeed, skydiving is not for you."
words[32] = "Eagles may soar, but weasels aren't sucked into jet engines."
words[33] = "A clear conscience is usually the sign of a bad memory."
words[34] = "Change is inevitable.... except from vending machines."
words[35] = "Hard work pays off in the future. Laziness pays off now."
words[36] = "It may be that your sole purpose in life is simply to serve as a warning to others."
words[37] = "\"After I am dead I would rather have people ask why I have no monument than why I have one.\"  --Cato the Elder"
words[38] = "He who laughs last, thinks slowest."
words[39] = "Everyone has a photographic memory.  Some don't have film."
words[40] = "I just got lost in thought. It was unfamiliar territory."
words[41] = "When the chips are down, the buffalo is empty."
words[42] = "Why is the third hand on the watch called a second hand?"
words[43] = "Have you ever imagined a world with no hypothetical situations?"
words[44] = "How do you get off a non-stop flight?"
words[45] = "If peanut butter cookies are made from peanut butter, then what are Girl Scout cookies made out of?"
words[46] = "\"I don't want to achieve immortality through my work. I want to achieve immortality through not dying.\"  -- Woody Allen"
words[47] = "How many mice does it take to screw in a light bulb?\n Two.  The hard part is getting them in the light bulb."
words[48] = "What makes men chase women they have no intention of marrying? \n The same urge that makes dogs chase cars they have no intention of driving."
words[49] = "It's hard to make a comeback when you haven't been anywhere."
words[50] = "Only time the world beats a path to your door is when you're in the bathroom."
words[51] = "When I'm finally holding all the cards, why does everyone decide to play chess?"
words[52] = "If you can remain calm, you just don't have all the facts."
words[53] = "Old Age Comes at a Bad Time."
words[54] = "Some people are only alive because it is illegal to shoot them."
words[55] = "Hard work has a future payoff.  Laziness pays off now."
words[56] = "Your kid may be an Honor Student, but YOU'RE still an idiot."
words[57] = "Is there another word for \"synonym\"?"
words[58] = "If you try to fail, and succeed, which have you done?"
words[59] = "\"To reach any significant goal, you must leave your comfort zone.\"  --Hyrum W. Smith"
words[60] = "\"There are two theories to arguing with a woman. Neither one works.\"  --Will Rogers"
words[61] = "\"There are two theories to arguing with a woman. Neither one works.\"  --Will Rogers"
words[62] = "\"There are three kinds of men. The ones that learn by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves.\"  --Will Rogers"
words[63] = "\"Good judgment comes from experience, and a lot of that comes from bad judgment.\"  --Will Rogers"
words[64] = "\"Lettin' the cat outta the bag is a whole lot easier'n puttin' it back.\"  --Will Rogers"
words[65] = "A person who smiles in the face of adversity... probably has a scapegoat."
words[66] = "Plagiarism saves time."
words[67] = "If at first you don't succeed, try management."
words[68] = "Never put off until tomorrow what you can avoid altogether."
words[69] = "Doing a job RIGHT the first time gets the job done. Doing the job WRONG fourteen times gives you job security."
words[70] = "\"Self-development is a higher duty than self-sacrifice.\"  --Elizabeth Cady Stanton"
words[71] = "\"Victorious warriors win first and then go to war, while defeated warriors go to war first and then seek to win.\"  --Sun Tzu"
words[72] = "\"There is more to life than increasing its speed.\"  --Mahatma Gandhi"
words[73] = "\"So far, this is the oldest I've been.\"  --George Carlin"
words[74] = "\"When I was young, I used to read about the decline of Western Civilization, and I decided it was something I would like to contribute to.\" --George Carlin"
words[75] = "\"Men of great conversational powers almost universally practice a sort of lively sophistry and exaggeration which deceives for the moment both themselves and their auditors.\" --Macaulay"
words[76] =  "\"It is much easier to be critical than to be correct.\" --Benjamin Disraeli"
words[77] = "All of us could take a lesson from the weather.  It pays no attention to criticism."
words[78] = "Why does a slight tax increase cost you two hundred dollars and a substantial tax cut saves you thirty cents?"
words[79] = "In the 60's, people took acid to make the world weird.  Now the world is weird and people take Prozac to make it normal."
words[80] = "\"Here is all you need to know about men and women: Women are crazy, men are stupid.  And the reason women are crazy, is that men are stupid\" --George Carlin";
var n;
var ns;
var priors = new String(GetCookie('used'));
function setWords(){
n = Math.round(Math.random() * 80);
ns = n.toString();
if (n<10){
 ns = "0" + ns
 }
while (priors.indexOf(ns) > -1){
n = Math.round(Math.random() * 80);
ns = n.toString();
if (n<10){
 ns = "0" + ns
 }
}
priors += "/" + ns;
var stopDate = new Date();
 FixCookieDate (stopDate)
 stopDate.setTime (stopDate.getTime() + (1000*60*60*24*15));
if (priors.length > 190){
 priors = "";
 }
SetCookie ('used', priors, stopDate)
}
setWords();
function ieWords(){
 setWords();
 document.getElementById("wordText").innerHTML=words[n];
 }

 //end Wrds section


//Open Picture Window
var newWindow;
function makeNewWindow(img,wid,ht,msg){
	if (newWindow){newWindow.close()};
	var winWid = parseInt(wid) + 40;
	var heightPad = 100 + (Math.floor((msg.length*10)/wid))*30;
	var winHt = parseInt(ht) + heightPad;
	
	if(screen.availHeight < winHt + 100){
	winHt = screen.availHeight - 70}
	var features = "\"status,scrollbars,height=" + winHt + ",width=" + winWid + "\"";
	if(!newWindow || newWindow.closed){
	newWindow = window.open("", "", features)
	if (!newWindow.opener) {
	newWindow.opener = window
	}
	if(_version > 1.1){
	newWindow.moveTo(100,0);}
	var winContent = "<html><head><title>Pop-Up Window</title></head>";
	winContent += "<body bgcolor='#ffffcc'><div align='center'><img border = '0' src='" + img + "' width='" + wid + "' height='" + ht + "'></div>";
	if (msg){
	winContent += "<p align='center' style='color: #cc0033; font-family: sans-serif; font-size: 12pt'>" + msg + "</p>";
	}
	winContent += "<p><form action='' name='but'><div align='center'><input type='button' value='Close this Window' name='btnCancel' onclick='window.close();'></form></div></p></body></html>";
	newWindow.document.write(winContent);
	newWindow.document.close();
	} else {
	newWindow.focus()
	}
}

//Make new text window
var newTextWindow;
var oldUrl;
function makeNewTextWindow(url,hgt,wid){
	if (newTextWindow && oldUrl != url){newTextWindow.close()};
	oldUrl = url;
	if (hgt > screen.availHeight){
	hgt = screen.availHeight - 50}
	if (wid > screen.availWidth){
	wid = screen.availWidth - 50}
	var parameters = "status,height=" + hgt + ",width=" + wid + ",scrollbars";
	if(!newTextWindow || newTextWindow.closed){
	newTextWindow = window.open(url,"",parameters)
	if (!newTextWindow.opener) {
	newTextWindow.opener = window
	}
	} else {
	newTextWindow.focus()
	}
}
//end new window stuff

//Blink the Major Events heading
var blinkCounter = 0;
function blinkText(){
if(document.all){
blinkCounter = 0;
blinkText2();
document.all.me.style.color = "#ffffff";
document.all.me.style.backgroundColor = "#336600";
}}
function blinkText2(){
if (document.all.me.style.color == "#ffffff"){
document.all.me.style.color = "#336600";
document.all.me.style.backgroundColor = "#ccffcc";}
else {
document.all.me.style.color = "#ffffff";
document.all.me.style.backgroundColor = "#336600";}
blinkCounter += 1;
if (blinkCounter < 7){
timerID = setTimeout("blinkText2()", 600)}
}
		var msg ="";
		
// Make code for select tags for old news

var selectCode ="<select name='pastNews' size='1' onChange='document.location = this.options[selectedIndex].value'><option value='news.htm' SELECTED>Select Year </option><option value='news04.htm'>2004</option><option value='news03.htm'>2003</option><option value='news02.htm'>2002</option>	<option value='news01.htm'>2001</option><option value='news00.htm'>2000</option><option value='news99.htm'>1999</option><option value='news98.htm'>1998</option><option value='news-pot.htm'>Potpourri</option></select>";

//time to go till an event

	var now = new Date();
	var then = new Date(2006, 5, 24, 3);
	var raceTime = new Date(now-then);
	if((then - now)> 0){
	var diff = (then-now)/(1000*60);
	var daysS = Math.floor(diff/(60*24));
	var hourS = Math.floor((diff-daysS*60*24)/60);
	var minS = Math.floor(diff - (60*hourS + 60*24*daysS));
	msg = " Starts in " + daysS + " Days, " + hourS + " Hours, and " + minS + " Minutes:" ;

//  put below back to get just days
//	msg = " in " + daysS + " days ";
	
	
	
	} else {
	//var diff = (now-then)/(1000*60);
	//var hourS = Math.floor(diff/60);
	//var minS = Math.floor(diff - 60*hourS);
	//msg = " started "  + hourS + " hours and " + minS + " minutes ago" ;
	msg = "";
	}

	//change to Calif time
	
	var CalifTime = new Date(now -= (1000*60*60*3));
	var CalHour = CalifTime.getHours();
	var CalMin = CalifTime.getMinutes();
	
	var AM = "AM";
	
	if (CalHour > 12)
		{
		CalHour -= 12;
		AM = "PM";		
		}
	
	
	var raceHour = raceTime.getHours();
	var raceMin = raceTime.getMinutes();


	var CalifMessage = CalHour + ":" + CalMin + " " + AM + " in California, " + raceHour + ":" + raceMin + " into the race.";

