function emc(s1,s2,s3){
document.write('<A HREF="mailto:'+s3+'@'+s1+'">'+s2+'</A>');}
function emcc(s1,s2,s3,c){
document.write('<A href="mailto:'+s3+'@'+s1+'" STYLE="color:'+c+'">'+s2+'</A>');}
function emc1(s1,s2,s3){
document.write('<A  CLASS=DKCLR href="mailto:'+s3+'@'+s1+'">'+s2+'</A>');} 

function 	SetRightColOff(){
doRightCol=false;} 

//*** PARAMETERS and INITIALIZATION ***

var doRightCol=true;

var textOut='';
var debugOut=false;
// debugOut=true;
var eTA;

var theTimeout;
var timestruct;
var speed=1;
var bWait=1;
var startUp=1;
var direction=1;
var loopticks=50; //check status 20 times per second   
var ctrlsUp=5000; //wait after first ad up to post controls   
var cntlsUptime=0; //when cntls go up   
var freq=10000; //display each ad for 10 seconds   
var displaytime=0;    

var raceLeadDays=55; 
var dayTicks=1000*60*60*24; 
var begRace=0; 
var totRace=0; 

var controlImage=new Array();
var raceImage=new Array();
var banImage=new Array();
var banOrder=new Array();
var banRank=new Array();
var banLink=new Array();
var cLabel=["prev","pause","next"];
var mData=[
	[10,"About&nbsp;the&nbsp;Club",[1,"Welcome","welcome.htm"],[1,"History","aboutPARC.htm"],[1,"Affiliations","affiliations.htm"],[1,"Discounts","discounts.htm"],[1,"Membership","membership.htm"],[1,"Board","governance.htm"]],
	[145,"Activities",[1,"Activities&nbsp;Calendar","calendar.htm"],[0],[1,"Mon.&nbsp;Night&nbsp;Run","monday.htm"],[1,"Tuesday&nbsp;Intervals","tuesday.htm"],[1,"Wed.&nbsp;Night&nbsp;Run","wednesday.htm"],[1,"Sat.&nbsp;Morning Run","saturday.htm"],[1,"Monthly&nbsp;Trail&nbsp;Run","trailrun.htm"],[2,"Next&nbsp;Trail&nbsp;Run","trailnext.htm"],[0],[1,"Anniversary&nbsp;Party","aparty.htm"],[1,"Holiday&nbsp;Party","hparty.htm"]],
	[235,"Communication",[1,"Email&nbsp;Distribution","email.htm"],[2,"Email&nbsp;Guidelines","eguide.htm"],[1,"Website","website.htm"],[2,"Feedback","mailto:wordcrank@yahoo.com"],[1,"Newsletter","parc_newsletter.htm"],[2,"Current&nbsp;Issue","assets/pdfs/kp.pdf"],[1,"Brochure","brochure.htm"]],
	[379,"Resources",[1,"Links","running_links.htm"],[1,"Places&nbsp;to&nbsp;Run","local_runs.htm"],[1,"Upcoming&nbsp;Races","races.htm"], [0], [1,"The&nbsp;Relay","relay.htm"], [1,"Stanford&nbsp;Home&nbsp;Run","homerun2004.htm"]],
	[493,"How&nbsp;To&nbsp;Join","join.htm"]];
			
var mMo=[0,0,0,0,0];
var mSo=[0,0,0,0,0];
var mMa=[0,0,0,0,0];
var mH1=138, mH2=157, mL1=160, mL2=147;
var zL=0, pL=4, curW=18;
var dbRef;

var banC=new Array();
var bT=0;
var banR=0;
var dR=0;
var banIndex=0;
var banRnd=0;
var banOne=0;

var dirStr="assets/images/ban/";
var raceDirStr="assets/images/race/";
var cData=["lG.gif","pG.gif","rG.gif","lR.gif","pR.gif","rR.gif"];
var cntlMax=cData.length;
var modeInc=cntlMax/2;

var bData=[
	["trhigh.gif","http://www.runnershigh.com",4],
	["atalanta.gif","http://www.skirtgoddess.com",4],
	["ryan.gif","mailto:ryanssportshop@aol.com",2],
	["metrosp.png","http://www.e-metrosport.com",3],
	["sportsb2.gif","http://www.SportsBasement.com",2],
	["runrev.gif","http://www.runningrevolution.com",2],
	["zombie.gif","http://www.zombierunner.com",4],
	["spbaby.png","http://www.sportingbaby.com",3] ];

var rData=[
	[2009, 2, 28, 'juanarun200x100.gif','http://www.barron.pausd.org/juanarun/', 'Juana Run 2009', '<b>saturday</b>, feb 28th, palo alto<br>8k, 1mi, kids runs'],
	[2009, 3, 22, 'lfa.gif','http://www.50plus.org/race.php', 'Fitness Alliance Runs', '<b>sunday</b>, mar 22nd, stanford<br> fifty+ 8k, all ages 8k'],
	[2009, 4, 11, 'bulls200x100.gif','bulls.htm', 'Running of the Bulls', '<b>saturday</b>, apr 11th, palo alto<br> 5k, kid&rsquo;s run'],
	[2009, 5, 17, 'ILP_200x100.gif','http://www.raceforliteracy.org/', 'ILP Race for Literacy', '<b>sunday</b>, may 17th, mountain view<br> 5k, 10k'],
	[2009, 6, 28, 'vibha_200x100.gif','http://wiki.vibha.org/Dream_Mile:2009_Bayarea_Home', 'Vibha Dream Mile', '<b>sunday</b>, june 28th, mountain view<br> 5k, 10k & carnival'],
	[2009, 7, 18, 'rob_200x100.gif','http://www.runonbanktnt.org/', 'Run on the Bank', "<b>saturday</b>, july 18th, shoreline park<br>a 1920's themed 10K run,<br>5K walk & social"], 
	[2009, 11, 15, 'homerun2009_200x100.gif','http://www.stanfordhabitat.org/#', 'Stanford Home Run', "<b>sunday</b>, november 15th, stanford<br>5K, 10K, teams"], 
	[2010, 1, 1, 'world_200x100.gif','http://www.worldrunners.org/dp/?q=node/44', "2010 New Year's Run<br>&nbsp;&nbsp;for a Healthy World", "<b>friday</b>, jan 1st, palo alto baylands<br>5K, 10K"],
	[2010, 2, 20, 'juanarun200x100.gif','http://www.barron.pausd.org/juanarun/', 'Juana Run 2010', '<b>saturday</b>, feb 20th, palo alto<br>8k, 1mi, kids runs'] ];

var	banMax=bData.length;
var	raceMax=rData.length;
var	raceUp=0;

CompileBannerData();
PreloadFirstBanner();
PreloadControls();
PreloadRaceImages();

//"uchiro.gif","http://www.universitychiroca.com/index.php",1,
//"horsnell.gif","http://www.hazeljhorsnell.com",1,
//"padental.gif","http://www.paloaltodentistry.com",1,
//"szf.gif","http://www.sportzfuel.com",2,
//"menlovelo.gif","mailto:menlovelo@aol.com",1,

//window.document.form1.n1.value=banR;

//*** END OF INITIALIZATION ***


function GetFrameLeft(){
	fW=0; 
	if (self.innerWidth) fW = self.innerWidth-curW;
	else if (document.documentElement && document.documentElement.clientWidth) fW = document.documentElement.clientWidth;
	else if (document.body) fW = document.body.clientWidth;
	tL=(fW-766)/2; if (tL<pL) tL=pL;
	return tL;
}

function CompileBannerData(){
	for (i=0;i<banMax;i++){ 
		banLink[i]=bData[i][1];
		banR+=bData[i][2];
		banRank[i]=banR; 
	}

	for (i=0;i<banMax;i++){ 
	  banRnd=Math.floor(Math.random()* banR);
		bT=0;
		while (banRank[bT]<=banRnd) bT++;
		banOrder[i]=bT;
		dR=banRank[bT];
		if (bT>0) dR-=banRank[bT-1];
		banR-=dR;
		for (j=bT;j<banMax;j++) {banRank[j]-=dR}
	}
	
	//also get race data
	var curDate=new Date();
	var raceDate=new Date();
	var curTicks=curDate.getTime();
	var endTicks=curTicks+raceLeadDays*dayTicks;
	var raceDate, raceTicks;
	for (iRace=0; iRace<raceMax; iRace++) {
		raceDate.setFullYear(rData[iRace][0], rData[iRace][1]-1, rData[iRace][2]);
		raceTicks=raceDate.getTime()+dayTicks/2;
		if ((curTicks<raceTicks) && (raceTicks<endTicks)) {
			if (!totRace) begRace=iRace;
			totRace++;
		}
	}
	raceUp=begRace+Math.floor(Math.random()*totRace);
	if (raceUp>=(begRace+totRace)) raceUp=begRace;
}

function PreloadControls(){
	for (i=0;i<cntlMax;i++){ 
		controlImage[i]=new Image();
		controlImage[i].src=dirStr+cData[i];
	}
}


function PreloadSubBanners(){
	var i;
	for (i=0;i<banMax;i++) if (i!=banOne) {
		banImage[i]=new Image();
		banImage[i].src=dirStr+bData[i][0];
	}
}

function PreloadRaceImages(){
	var i;
	for (i=0;i<totRace;i++) {
		raceImage[i+begRace]=new Image();
		raceImage[i+begRace].src=raceDirStr+rData[i+begRace][3];
	}
}

function PreloadFirstBanner(){
	document.write('<DIV style="display:none"><IMG SRC='+(dirStr+bData[banOne][0])+' onLoad="bWait=0"></DIV>');
	banImage[banOne]=new Image();
	banImage[banOne].src=dirStr+bData[banOne][0];
}

function guiclick(index) { 
	  for (i=0; i<modeInc; i++) banC[i].fontWeight="normal";
		banC[index].fontWeight="bold";
		if (index==0){
			speed=1; direction=-1; NextBanner();
		} else if (index==1){
			speed=0;
		} else if (index==2){
			speed=1; direction=1; NextBanner();
		} 
}

function mouseOver(index){ 
  document.images['c'+index].src=controlImage[index+modeInc].src;
}

function mouseOut(index){ 
  document.images['c'+index].src=controlImage[index].src;
}

function NextBanner(){
	banIndex=banIndex+direction;
	if (banIndex==banMax) banIndex=0;
	if (banIndex<0) banIndex=banMax-1;

  document.images['bI'].src=banImage[banOrder[banIndex]].src;
	FL=document.getElementById('bL'); FL.href=banLink[banOrder[banIndex]];

  if ((totRace>1) && doRightCol){
		FL=document.getElementById('raceD'+raceUp); FL.style.display="none";
		raceUp=raceUp+direction;
		if (raceUp>=(begRace+totRace)) raceUp=begRace;
		if (raceUp<begRace) raceUp=begRace+totRace-1;
		FL=document.getElementById('raceD'+raceUp); FL.style.display="block";
	}
	
	timestruct=new Date();
	displaytime=timestruct.getTime();
}
				
function MainLoop(){
  tL=GetFrameLeft();
	if (!(tL==zL)) {zL=tL; dbRef.left=zL;}
	for (i=0; i<5; i++) if (mMa[i]) if (!(mMo[i] || mSo[i])) {
		mMa[i]--; if (!mMa[i]) HideSubMenu(i);
	}
	timestruct=new Date();
	var theTime=timestruct.getTime();
	if (bWait) {
		displaytime=theTime;
		cntlsUptime=displaytime+ctrlsUp;
	}
	if (startUp) if (theTime>cntlsUptime) {
		document.getElementById('bc0').style.display="none";	
		document.getElementById('bc1').style.display="block";	
		startUp=0;
	}
	dur=theTime-displaytime;
	if (speed!=0){
		if (dur>freq) NextBanner();
	}
  theTimeout=setTimeout('MainLoop()',loopticks);
	if (speed==0) displaytime+=dur;
}				

function DisplaySubMenu(iObj){
//	document.body.style.backgroundColor = "#cccc88";
	for (i=0; i<5; i++) if (mMa[i]) if (!(iObj==i)) {
		mMa[i]=0; HideSubMenu(i);
	}
	obj2=document.getElementById('Dsm'+iObj).style;
	obj2.left=mData[iObj][0]+mL2;
	obj2.top=mH2;
	obj2.display="block";
}

function HideSubMenu(iObj){
//	document.body.style.backgroundColor = "#333366";
	obj2=document.getElementById('Dsm'+iObj).style;
	obj2.display="none";
}
	
function DebugMsg(msg){
	if (debugOut) {
		textOut=msg+'\n'+textOut;
		eTA.value=textOut;
	}
}

function OverMenu(iObj){
	mMa[iObj]=2;
	mMo[iObj]=1;
	DisplaySubMenu(iObj);
}
			
function OverSubMenu(iObj){
	mSo[iObj]=1;
}
				
function OutMenu(iObj){
	mMo[iObj]=0;
}
				
function OutSubMenu(iObj){
	mSo[iObj]=0;
}

function OutSubItem(obj){
	obj.style.color="#333366";
}
				
function OverSubItem(obj){
	obj.style.color="#FFFFFF";
}
				
function DoLink(iObj, jObj){
	DebugMsg("i="+iObj+"  j="+jObj);
	HideSubMenu(iObj);
	window.location.href=mData[iObj][jObj][2];
}

function DoStartPage(){
  if (debugOut) {
		document.write('<DIV ID="Dta"><TEXTAREA STYLE="width:766px;background-color:#bbbb99" ROWS=8 ID="TA" NAME="TAN"> </TEXTAREA></DIV>');
		eTA=document.getElementById('TA');
	}	
	document.write('</DIV>');
	DebugMsg ("raceUp="+raceUp);
	DebugMsg ("begRace="+begRace);
	DebugMsg ("totRace="+totRace);

	PreloadSubBanners();

	var Mdiv;
	for (i=0; i<5; i++) {
  	Mdiv=document.getElementById('Dmm'+i).style;
		Mdiv.left=mData[i][0]+mL1;
		Mdiv.top=mH1;
		Mdiv.display="block";
	}

  Mdiv=document.getElementById('Dhtj1').style;
	Mdiv.left=mData[4][0]+mL1-20;
	Mdiv.top=mH1-4;
	Mdiv.display="block";
  Mdiv=document.getElementById('Dhtj2').style;
	Mdiv.left=mData[4][0]+mL1-20;
	Mdiv.top=mH1+24;
	Mdiv.display="block";

	for (i=0;i<modeInc;i++) banC[i]=document.getElementById('t'+i).style;
  document.images['bI'].src=banImage[banOrder[banIndex]].src;
	FL=document.getElementById('bL'); FL.href=banLink[banOrder[banIndex]];

  if (totRace && doRightCol){
		FL=document.getElementById('raceD'+raceUp); FL.style.display="block";
	}
	
  timestruct=new Date();
  displaytime=timestruct.getTime();
  cntlsUptime=displaytime+ctrlsUp;
	theTimeout=setTimeout('MainLoop()',loopticks);
}   

function DoPreHTML(){
	zL=GetFrameLeft();
	document.write('<DIV ID="Dref" ALIGN=left STYLE="padding-bottom:4px;position:absolute;top:4px;left:'+zL+'">'); 
	dbRef=document.getElementById('Dref').style;

	document.write('<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=766>');
	document.write('<TR VALIGN="TOP">');
	document.write('<TD WIDTH=1 BGCOLOR="#FFFF66"><IMG SRC="sp.gif" HEIGHT=62 WIDTH=1></TD>');
	document.write('<TD ALIGN="center" VALIGN="middle" COLSPAN=3 BGCOLOR="#FFFF66" WIDTH=161>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=1 WIDTH=161></DIV>');

//display this for first 5 seconds
	document.write('<TABLE ID=bc0 style="display:block" CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=161">');
 		document.write('<TR ALIGN=center><TD>');
			document.write('<DIV style="font-size:14pt;color:#000066">please support</DIV>');
			document.write('<DIV><IMG SRC="sp.gif" HEIGHT=4 WIDTH=161></DIV>');
			document.write('<DIV style="font-size:14pt;color:#000066">PARC sponsors</DIV>');
			document.write('<DIV><IMG SRC="sp.gif" HEIGHT=2 WIDTH=161></DIV>');
 		document.write('</TD></TR>'); 
	document.write('</TABLE>');

	//display this after 5 seconds
	document.write('<TABLE ID=bc1 style="display:none" CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=161>');
  	//row for control labels
		document.write('<TR ALIGN="center">');
			document.write('<TD><DIV><IMG SRC="sp.gif" HEIGHT=1 WIDTH=7></DIV></TD>');
			document.write('<TD><DIV><IMG SRC="sp.gif" HEIGHT=1 WIDTH=49></DIV></TD>');
			document.write('<TD><DIV><IMG SRC="sp.gif" HEIGHT=1 WIDTH=49></DIV></TD>');
			document.write('<TD><DIV><IMG SRC="sp.gif" HEIGHT=1 WIDTH=49></DIV></TD>');
			document.write('<TD><DIV><IMG SRC="sp.gif" HEIGHT=1 WIDTH=7></DIV></TD>');
		document.write('</TR>');
		document.write('<TR ALIGN="center">');
			document.write('<TD></TD>');
			for (i=0; i<modeInc; i++) {
			document.write('<TD ALIGN="center"><DIV id="t'+i+'" STYLE="font-size:9.0pt;font-weight:normal;color:#333366">'+cLabel[i]+'</DIV></TD>');
			}
			document.write('<TD></TD>');
		document.write('</TR>');
			//row for heading and controls 
		document.write('<TR ALIGN="center">');
			document.write('<TD></TD>');

			for (i=0; i<modeInc; i++) {
			document.write('<TD ALIGN="center"><DIV ALIGN="CENTER"><IMG id="c'+i+'" BORDER=0 SRC='+controlImage[i].src+' HEIGHT=23 WIDTH=29 style="cursor:pointer" onMouseDown="guiclick('+i+')" onMouseover="mouseOver('+i+')" onMouseout="mouseOut('+i+')"></DIV></TD>');
			}
			document.write('<TD></TD>');
		document.write('</TR>'); 
 		document.write('<TR ALIGN="center">');
			document.write('<TD ALIGN="center" colspan=5><DIV style="padding:3px;font-size:8pt">please support PARC sponsors</DIV></TD>');
 		document.write('</TR>'); 
	document.write('</TABLE>');

	document.getElementById('t2').style.fontWeight="bold";
	document.write('</TD>');
	document.write('<TD ROWSPAN=3 WIDTH=4 BGCOLOR="#333366"><DIV><IMG SRC="sp.gif" WIDTH=4 HEIGHT=1></DIV></TD>');

	document.write('<TD ROWSPAN=3 WIDTH=600 VALIGN="TOP">');
	document.write('<DIV><a id=bL><img id=bI border=0 marginwidth=0 marginheight=0 width=600 height=125></a><DIV>'); 
	document.write('</TD>');
	document.write('</TR>');

	document.write('<TR VALIGN="TOP">');
	document.write('<TD COLSPAN=4 WIDTH=162 BGCOLOR="#333366">');
	document.write('<DIV><IMG SRC="sp.gif" WIDTH=162 HEIGHT=4></DIV>');
	document.write('<DIV><IMG style="background-color:#ccccff" SRC="sp.gif" WIDTH=162 HEIGHT=1></DIV>');
	document.write('<DIV><IMG SRC="sp.gif" WIDTH=161 HEIGHT=4><IMG style="background-color:#ccccff" SRC="sp.gif" WIDTH=1 HEIGHT=4></DIV>');
	document.write('</TD>');
	document.write('</TR>');

	document.write('<TR VALIGN="TOP">');
	document.write('<TD ROWSPAN=3 WIDTH=1 BGCOLOR="#CCFFCC"><IMG SRC="sp.gif" HEIGHT=26 WIDTH=1></TD>');
	document.write('<TD ALIGN="CENTER" ROWSPAN=3 WIDTH=157 BGCOLOR="#CCFFCC">');
	document.write('<DIV><A HREF="welcome.htm"><IMG SRC="assets/images/parcweblogonavygreen154x90.gif" WIDTH=154 HEIGHT=90></A></DIV>');
	document.write('</TD>');
	document.write('<TD ROWSPAN=3 WIDTH=4 BGCOLOR="#333366"><IMG SRC="sp.gif" WIDTH=4 HEIGHT=9></TD>');
	document.write('<TD WIDTH=1 BGCOLOR="#ccccff"><DIV><IMG SRC="sp.gif" WIDTH=1 HEIGHT=54></DIV></TD>');
	document.write('</TR>');
	document.write('<TR VALIGN="TOP">');
	document.write('<TD COLSPAN=3 WIDTH=605 BGCOLOR="#333366">');
	document.write('<DIV><IMG style="background-color:#ccccff" SRC="sp.gif" WIDTH=1 HEIGHT=4><IMG SRC="sp.gif" WIDTH=604 HEIGHT=4></DIV>');
	document.write('<DIV><IMG style="background-color:#ccccff" SRC="sp.gif" WIDTH=605 HEIGHT=1></DIV>');
	document.write('<DIV><IMG SRC="sp.gif" WIDTH=605 HEIGHT=4></DIV>');
	document.write('</TD>');
	document.write('</TR>');
	document.write('<TR VALIGN="MIDDLE">');
	document.write('<TD WIDTH=1 BGCOLOR="#FF9999"><DIV ID="Mref"><IMG SRC="sp.gif" WIDTH=1 HEIGHT=28></DIV></TD>');
	document.write('<TD VALIGN="top" COLSPAN=2 BGCOLOR="#FF9999">');

	for (i=0; i<4; i++) {
		document.write('<DIV ID=Dmm'+i+' class=MENUITEM style="cursor:default;position:absolute;display:none" onMouseOver="OverMenu('+i+')" onMouseOut="OutMenu('+i+')">'+mData[i][1]+'</DIV><DIV ID=Dsm'+i+' STYLE="cursor:pointer;position:absolute;display:none;z-index:200" onMouseOver="OverSubMenu('+i+')" onMouseOut="OutSubMenu('+i+')"><DIV><IMG SRC="sp.gif" HEIGHT=5 WIDTH=5></DIV><DIV STYLE="background-color:#333366;padding-left:4px;padding-bottom:4px;padding-right:4px;"><DIV STYLE="background-color:#FF9999;padding-bottom:4px">');

		for (j=2; j<mData[i].length; j++)
			if (mData[i][j][0]) document.write('<DIV class=SUBM'+mData[i][j][0]+' onMouseOver="OverSubItem(this)" onMouseOut="OutSubItem(this)" onClick="DoLink('+i+','+j+');">'+mData[i][j][1]+'</DIV>');
			else document.write('<DIV class=SUBSEP><DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=1 WIDTH=49></DIV></DIV>');
		document.write('</DIV></DIV></DIV>'); 
	}	

	i=4; document.write('<DIV ID=Dhtj1 style="background-color:#333366;z-index:500;position:absolute;display:none"><IMG SRC="sp.gif" HEIGHT=32 WIDTH=4></DIV>');

	i=4; document.write('<DIV ID=Dhtj2 style="background-color:#333366;z-index:500;position:absolute;display:none"><IMG SRC="sp.gif" HEIGHT=4 WIDTH='+(621-mData[4][0])+'></DIV>');

	i=4; document.write('<DIV ID=Dmm'+i+' class=MM style="cursor:pointer;position:absolute;display:none;"><A CLASS=MLINK HREF="'+mData[i][2]+'">'+mData[i][1]+'</A></DIV>');

	document.write('</TD>');
	document.write('</TR>');
	document.write('</TABLE>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" WIDTH=766 HEIGHT=4></DIV>');          

 	document.write('<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=766>');
 	document.write('<TR VALIGN="TOP">');
	document.write('<TD ALIGN="LEFT" BGCOLOR="#CCCCFF" WIDTH='+((doRightCol)?562:766)+'>');
	document.write('<DIV STYLE="padding:9px">');
}	

function DoPostHTML() {
	document.write('</DIV>');
	document.write('</TD>');
	
	if (doRightCol){
		document.write('<TD ALIGN="LEFT" BGCOLOR="#333366" WIDTH=4><DIV><IMG SRC="sp.gif" WIDTH=4 HEIGHT=1></DIV></TD>');
		document.write('<TD ALIGN="LEFT" BGCOLOR="#FFFF66" WIDTH=200>');
		document.write('<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=200>');

//	  AddMisc();
		AddFeaturedRaces();
		AddNextTrailRun();
		AddAffiliations();
 		AddOnlineMembershipRegistration();

		document.write('<TR><TD>');
		document.write('<DIV><IMG SRC="sp.gif" HEIGHT=9 WIDTH=200></DIV>');
		document.write('</TD></TR>');
		document.write('</TABLE>');
		document.write('</TD>');
	}

	document.write('</TR>');
	document.write('</TABLE>');
	if (!doRightCol) document.write('<DIV><IMG SRC="sp.gif" WIDTH=1 HEIGHT=400></DIV>');
}

function xAddFeaturedRaces(){
	if (totRace) {
		document.write('<TR><TD BGCOLOR=#ccffcc>');
//		document.write('<DIV><A HREF="'+rData[begRace][4]+'"><IMG SRC="assets/images/race/'+rData[begRace][3]+'" HEIGHT=100 WIDTH=200></A></DIV>');
		document.write('<DIV><a id="raceL"><img id="raceI" border=0 marginwidth=0 marginheight=0 width=200 height=100></a><DIV>');
		for (iR=begRace; iR<begRace+totRace; iR++) {
			document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=1 WIDTH=1></DIV>');
			document.write('<DIV CLASS="RSH">'+rData[iR][5]+'</DIV>');
			document.write('<DIV CLASS="RS1" STYLE="padding-top:2px">'+rData[iR][6]+'&mdash;<A HREF="'+rData[iR][4]+'">more info</A></DIV>');
			document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
		}
		document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
		document.write('</TD></TR>');
	}
}

function AddFeaturedRaces(){
	if (totRace) {
		document.write('<TR><TD BGCOLOR=#ccffcc>');
		for (iR=begRace; iR<begRace+totRace; iR++) {
			document.write('<DIV id="raceD'+iR+'" style="display:none"><a href="'+rData[iR][4]+'"><img src="'+raceDirStr+rData[iR][3]+'" border=0 marginwidth=0 marginheight=0 width=200 height=100></a></DIV>');
			document.write('<DIV CLASS="RSH">'+rData[iR][5]+'</DIV>');
			document.write('<DIV CLASS="RS1" STYLE="padding-top:2px">'+rData[iR][6]+'&mdash;<A HREF="'+rData[iR][4]+'">more info</A></DIV>');
			document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
			if (iR<begRace+totRace-1) document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=1 WIDTH=1></DIV>');
		}
		document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
		document.write('</TD></TR>');
	}
}

function OldAddOnlineMembershipRegistration(){
	document.write('<TR><TD BGCOLOR=#ffff99>');
	document.write('<DIV CLASS="RSH">Online Membership Registration</DIV>');
	document.write('<DIV CLASS="RS1">You can join the club OR renew your membership at<A HREF="http://www.active.com/event_detail.cfm?event_id=1397312">active.com</A>.</DIV>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
}

function AddOnlineMembershipRegistration(){
	document.write('<TR><TD BGCOLOR=#ffDDCC>');
	document.write('<DIV CLASS="RSH">Online PARC Member<br>Registration');
	document.write('<SPAN CLASS="RS1">&nbsp;&nbsp;&nbsp;<A HREF="http://www.active.com/event_detail.cfm?event_id=1397312">active.com</A></SPAN></DIV>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
}
function AddNextTrailRun(){
  document.write('<TR><TD BGCOLOR=#ddddbb>');
  document.write('<DIV CLASS="RSH">March Trail Run</DIV>');
  document.write('<DIV CLASS="RS1"><SPAN CLASS="BOLD">sunday</SPAN>, the 7th, Arasterdero & Foothill Parks&mdash;<A HREF="trailnext.htm">more info</A></DIV>');
  document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
  document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
  document.write('</TD></TR>');
}

function AddMisc(){
	document.write('<TR><TD BGCOLOR=#99ccff>');
	document.write('<DIV><A HREF="hintervals.htm"><IMG SRC="assets/images/hia.gif" HEIGHT=200 WIDTH=200></A></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
}

function AddAffiliations(){
	document.write('<TR><TD><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=200>');
	document.write('<TR><TD>');
	document.write('<DIV><A HREF="http://www.cityofpaloalto.org/recreation/default.asp"><IMG SRC="assets/images/pa_top.gif"></A></DIV><DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=2></DIV><DIV><A HREF="http://www.trailrunner.com/"><IMG SRC="assets/images/atra_top.gif"></A></DIV>');
	document.write('</TD><TD>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=124 WIDTH=4></DIV>');
	document.write('</TD><TD BGCOLOR=#ccff66>');
	document.write('<DIV><A HREF="http://www.rrca.org/"><IMG SRC="assets/images/rrca_top.gif"></A></DIV>');
	document.write('</TD></TR></TABLE><DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV></TD></TR>');
}	

function AddNoneOfThese(){
	return;

	document.write('<TR><TD BGCOLOR=#ffffff>');
	document.write('<DIV><a href="raffle.htm"><IMG SRC="assets/images/raffle.gif" HEIGHT=120 WIDTH=200></a></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');

	document.write('<TR><TD BGCOLOR=#ffffff>');
	document.write('<DIV><A HREF="http://www.stanford.edu/group/habitat/"><IMG SRC="assets/images/homerun2008.gif" HEIGHT=97 WIDTH=200></A></DIV>');
	document.write('<DIV CLASS="RSH" STYLE="padding-top:0px">Stanford Home Run</DIV>');
	document.write('<DIV CLASS="RS1"><SPAN CLASS="BOLD">sunday</SPAN>, nov 16th, 2008<br>5K run/walk, 10K run&mdash;<A HREF="http://www.stanford.edu/group/habitat/">more info</A></DIV>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
	
	document.write('<TR><TD BGCOLOR=#99ccff>');
	document.write('<DIV><A HREF="http://www.sportingbaby.com"><IMG SRC="assets/images/sblogo.gif" HEIGHT=150 WIDTH=200></A></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
	
	document.write('<TR><TD BGCOLOR=#99ccff>');
	document.write('<DIV><A HREF="hintervals.htm"><IMG SRC="assets/images/hi.gif" HEIGHT=200 WIDTH=200></A></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
	
	document.write('<TR><TD BGCOLOR=#ffffff>');
	document.write('<DIV CLASS="RSH" STYLE="font-size:14pt;color:#990000">2008 Holiday Party</DIV>');
	document.write('<DIV CLASS="RS1" STYLE="color:#006600"><SPAN CLASS="BOLD">monday</SPAN>, dec 8th, at Estrellita Restaurant&mdash;<A HREF="hparty.htm">more info</A></DIV>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
	
	document.write('<TR><TD BGCOLOR=#99ccff>');
	document.write('<DIV CLASS="RSH">Wednesday Night Run<br>HOLIDAY BREAK</DIV>');
	document.write('<DIV CLASS="RS1">Wednesday Night Runs scheduled for Dec 24 and Dec 31 have been cancelled.</DIV>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
	
	document.write('<TR><TD BGCOLOR=#99ccff>');
	document.write('<DIV CLASS="RSH">Wed. Night Run Routes</DIV>');
	document.write('<DIV CLASS="RS1">a schedule of the upcoming routes for the wed night run has been posted at <A HREF="wednesday.htm#listing">route listing</A>.</DIV>');
	document.write('<DIV><IMG SRC="sp.gif" HEIGHT=6 WIDTH=1></DIV>');
	document.write('<DIV STYLE="background-color:#333366"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
	
	document.write('<TR><TD BGCOLOR=#884422>');
	document.write('<DIV><A HREF="calendar.htm"><IMG SRC="assets/images/bbq1.gif" HEIGHT=200 WIDTH=200></A></DIV>');
	document.write('<DIV STYLE="background-color:#884422"><IMG SRC="sp.gif" HEIGHT=4 WIDTH=200></DIV>');
	document.write('</TD></TR>');
}