var mydate = new Date();
var myday = mydate.getDate();

var sponsors = new Array(
"<a class=sponsor href='http://www.huntoil.com'><img src='/challenge/sponsors/hunt_oil.jpg' alt='Hunt Oil Company' width='125' border=0><br>Hunt Oil Company</a><BR><BR>",
"<a class=sponsor href='http://www.winston-school.org'><img src='/challenge/sponsors/winston.gif' alt='The Winston School' border=0><br>The Winston School</a><BR><BR>",
"<a class=sponsor href='http://www.texasmotorspeedway.com'><img src='/challenge/sponsors/tms.gif' border='0' width='111' alt='Texas Motor Speedway'><br>Texas Motor Speedway</a><BR><BR>",
"<a class=sponsor href=''>Lightner Sams Foundation</a><BR><BR>",
"<a class=sponsor href='http://www.seco.cpa.state.tx.us/'><img src='/challenge/sponsors/seco.gif' border='0' width='125' alt='Texas State Energy Conservation Office'><br>Texas State Energy Conservation Office</a><BR><BR>",
"<a class=sponsor href='http://www.txses.org/'><img src='/challenge/sponsors/tses.gif' border='0' width='125' alt='Texas Solar Energy Society'><br>Texas Solar Energy Society</a><BR><BR>",
"<a class=sponsor href='http://www.tcu.edu'><img src='/challenge/sponsors/tcu.gif' border='0' width='125' alt='TCU Information Services'><br>TCU Information Services</a><BR><BR>",
"<a class=sponsor href='http://www.precisionsolarcontrols.com'><img src='/challenge/sponsors/psc.gif' border='0' width='111' alt='Precision Solar Controls'><br>Precision Solar Controls</a><BR><BR>",
"<a class=sponsor href='http://www.wdtinc.com'><img src='/challenge/sponsors/wdt.gif' border='0' width='111' alt='Weather Decisions Teachnologies'><br>Weather Decisions Teachnologies</a><BR><BR>",
"<a class=sponsor href='http://www.ryder.com'><img src='/challenge/sponsors/ryder.gif' border='0' width='111' alt='Ryder Trucks'><br>Ryder Trucks</a><BR><BR>",
"<a class=sponsor href='http://www.hitachiconsulting.com'><img src='/challenge/sponsors/hitachi.png' border='0' width='111' alt='Hitachi Consulting'><br>Hitachi Consulting</a><BR><BR>",
"<a class=sponsor href=''>Kahn Foundation<BR><BR>",
"<a class=sponsor href='http://www.atmosenergy.com'><img src='/challenge/sponsors/atmos.gif' border='0' width='120' alt='Atmos Energy'><br>Atmos Energy</a><BR><BR>",
"<a class=sponsor href='http://www.ases.org'><img src='/challenge/sponsors/ases.gif' border='0' width='120' alt='American Solar Energy Society'><br>American Solar Energy Society</a><BR><BR>",
"<a class=sponsor href='http://www.sharylandutilities.com'><img src='/challenge/sponsors/sharyland.jpg' border='0' width='120' alt='Sharyland Utilities'><br>Sharyland Utilities</a><BR><BR>",
"<a class=sponsor href='http://www.johnsoncontrols.com'><img src='/challenge/sponsors/johnson_controls.gif' border='0' width='111' alt='Johnson Controls'><br>Johnson Controls</a><BR><BR>"
);

var static = 2
var max = sponsors.length;

var i=Math.floor(Math.random()*(max-static))+static
var j=Math.floor(Math.random()*(max-static))+static
var k=Math.floor(Math.random()*(max-static))+static

while (j == i)
{
   j=Math.floor(Math.random()*(max-static))+static
}
while ((k == i) || (k == j))
{
   k=Math.floor(Math.random()*(max-static))+static
}

var AddSponsors = sponsors[ 0 ] +  sponsors[ 1 ] + sponsors[ i ]  + sponsors[ j ]  + sponsors[ k ];

var FIND = 'hidden';
var WAKE = 'visible';
var ie = false;

var dayStr
if ( myday <= 8 ) {
   dayStr = "day1" }
else {
if (myday == 9) {
   dayStr = "day2" }
else {
if (myday == 10) {
   dayStr = "day3" }
else {
if (myday == 11) {
   dayStr = "day4" }
else {
if (myday == 12) {
   dayStr = "rest" }
else {
if (myday == 13) {
   dayStr = "day5" }
else {
if (myday == 14) {
   dayStr = "day6" }
else {
if (myday == 15) {
   dayStr = "day7" }
else {
if (myday >= 16) {
   dayStr = "day8" }
}}}}}}}}

if ( navigator.appName != 'Netscape')
{
 var ie = true;
}

var baseURL;
var infoURL;
var tcuURL;

if ( window.location.href.indexOf("192.168") > 0 )
{
 baseURL = "http://192.168.1.101/challenge/";
 infoURL = "http://192.168.1.101/stats/";
 tcuURL  = "http://192.168.1.101/2010/";
}
else {
if ( window.location.href.indexOf("localhost") > 0 )
{
 baseURL = "http://localhost/challenge/";
 infoURL = "http://localhost/stats/";
 tcuURL  = "http://localhost/2010/";
}
else
{
 baseURL = "/challenge/";
 infoURL = "http://www.wscinfo.org/realtime/";
 tcuURL  = "http://winstonsolar.tcu.edu/2010/";
}}
