Home of the "I RACE ROTAX" counter
Created by Carlos Calderon
This counter counts down the number of days until the next AMD/Marin Karting Northern California Rotax Challenge race. Share your excitement and anticipation with the world!
To add the counter to your webpage, copy the following code into the body of your webpage:
<!--
I RACE ROTAX counter starts here
-->
<style style="text/css">
.countBox {
font-family: Arial, sans-serif;
font-size: x-small;
font-weight: bold;
text-align: center;
}
.countBox img {
border: 2px solid #000;
}
.countBox a {
font-size: xx-small;
font-weight: normal;
text-decoration: underline;
}
</style>
<div class="countBox"><div id="daysUntil"></div>
<a href="http://www.norcalrotax.com/"><img src="./racerotax.gif" /></a><br />
<a href="http://www.calderons.net/racerotax">Add this to your site!</a></div>
<script type="text/javascript">
// Copyright © 2007 Carlos Calderon
// If distributed or modified, this copyright info must be maintained.
// Refer to http://carlos.calderons.net/racerotax for a free copy
function countdowner(element)
{
if ( !document.getElementById || !document.getElementById(element) )
return
this.element = document.getElementById(element)
this.time = new Date()
this.raceArray = new Array(new Date("March 18, 2007 00:00:00"), new Date("April 21, 2007 00:00:00"), new Date("May 6, 2007 00:00:00"), new Date("May 12, 2007 00:00:00"),new Date("June 30, 2007 00:00:00"), new Date("July 14, 2007 00:00:00"), new Date("September 2, 2007 00:00:00"), new Date("September 15, 2007 00:00:00"), new Date("October 20, 2007 00:00:00"))
this.updateCounter( 0 )
}
countdowner.prototype.updateCounter=function( index )
{
if ( index >= this.raceArray.length ) {
this.element.innerHTML = "Next Season"
return;
}
var raceDay = this.raceArray[index]
var timeLeft = (raceDay - this.time) / 1000
var kDay = 60 * 60 * 24
if ( Math.ceil( timeLeft / kDay ) < 0 ) {
index++
this.updateCounter(index); return;
}
var days = Math.ceil( timeLeft / kDay ) + 1
if ( days == 0 )
this.element.innerHTML = "Today"
else if ( days == 1 )
this.element.innerHTML = days + " day until"
else
this.element.innerHTML = days + " days until"
}
var counter = new countdowner("daysUntil")
</script>
<!--
I RACE ROTAX counter ends here
-->
To modify this counter for another series, change the "raceArray" dates to the dates of your series. You may also want to change the norcalrotax.com link of the image.
If you modify the counter for your series, please send me an email (racing at calderons.net) with the link to the counter (or the code) so I can post a link to it here.