<!--
//window.name = "wager";
//lWin = window.open("login.jsp", "Login", 'width=1,height=1');

//if (lWin != null)
//	lWin.close();

function Track(id, name, code, activeRace, city, state, zip, url, type, open)
{
	this.id = id;
	this.name = name;
	this.code = code;
	this.activeRace = activeRace;
	this.city = city;
	this.state = state;
	this.zip = zip;
	this.url = url;
	this.type = type;
	this.open = (typeof(open) != "undefined" ? open : true);
}

//function Race(id, track, num, start, pools, desc, dist, mtp, active)
function Race(id, track, num, start, pools, desc, dist, surface, gait, purse,
	mtp, active)
{
	this.id = id;
	this.track = track;
	this.num = num;
	this.start = start;
	this.pools = pools;
	this.desc = (typeof(desc) != "undefined" ? desc : "");
	this.distance = (typeof(dist) != "undefined" ? dist: "");
	this.surface = (typeof(surface) != "undefined" ? surface: "");
	this.gait = (typeof(gait) != "undefined" ? gait: "");
	this.purse = (typeof(purse) != "undefined" ? purse: "");
	this.mtp = (typeof(mtp) != "undefined" ? mtp : -1);
	this.active = (typeof(active) != "undefined" ? active : true);
}

//function Runner(id, track, race, pos, betNum, name, amOdds, lineage, jockey,
function Runner(track, race, pos, betNum, name, amOdds, lineage, jockey,
	weight, trainer, owner, breeder, silks, medication, equipment, foaled,
	stats1, stats2, stats3, stats4, stats5, stats6, allowance, claiming,
	curOdds)
{
//	this.id = id;			// not used for anything
	this.track = track;		// not used for anything
	this.race = race;		// not used for anything
	this.pos = pos;
	this.betNum = String(betNum).toUpperCase();
	this.coupled = (this.betNum.charAt(this.betNum.length - 1) >= 'A' &&
		this.betNum.charAt(this.betNum.length - 1) <= 'Z');
	this.name = name;
	this.amOdds = amOdds;
	this.lineage = lineage;
	this.jockey = jockey;
	this.weight = weight;
	this.trainer = trainer;
	this.owner = owner;
	this.breeder = breeder;
	this.silks = silks;
	this.medication = medication;
	this.equipment = equipment;
	this.foaled = foaled;
	this.stats1 = stats1;
	this.stats2 = stats2;
	this.stats3 = stats3;
	this.stats4 = stats4;
	this.stats5 = stats5;
	this.stats6 = stats6;
	this.allowance = allowance;
	this.claiming = claiming;
	this.curOdds = (typeof(curOdds) != "undefined" ? curOdds :
		(amOdds == "SCR" ? "SCR" : "N/A"));
}

function Ticket(track, race, pool, runnerRowList, runnerIDList, bet, mult,
	totalBet, boxed, current, displayList, betRequest)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.runnerRowList = runnerRowList;
	this.runnerIDList = runnerIDList;
	this.bet = bet;
	this.mult = mult;
	this.totalBet = totalBet;
	this.boxed = boxed;
//	this.current = current;
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.timestamp = (new Date()).getTime();
	this.status = "P";
	this.serial = "";
}

function OneHorse(track, race, pool, first, bet, mult, boxed, displayList, betRequest, totalBet)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.first = first;
	this.bet = bet;
	this.mult = mult;
	this.boxed = boxed;		// not possible, but needed for integrity
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.totalBet = totalBet;
}

function TwoHorse(track, race, pool, first, second, bet, mult, boxed, displayList, betRequest, totalBet)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.first = first;
	this.second = second;
	this.bet = bet;
	this.mult = mult;
	this.boxed = boxed;
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.totalBet = totalBet;
}

function ThreeHorse(track, race, pool, first, second, third, bet, mult, boxed, displayList, betRequest, totalBet)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.first = first;
	this.second = second;
	this.third = third;
	this.bet = bet;
	this.mult = mult;
	this.boxed = boxed;
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.totalBet = totalBet;
}

function FourHorse(track, race, pool, first, second, third, fourth, bet, mult, boxed, displayList, betRequest, totalBet)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.first = first;
	this.second = second;
	this.third = third;
	this.fourth = fourth;
	this.bet = bet;
	this.mult = mult;
	this.boxed = boxed;
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.totalBet = totalBet;
}

function FiveHorse(track, race, pool, first, second, third, fourth, fifth, bet, mult, boxed, displayList, betRequest, totalBet)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.first = first;
	this.second = second;
	this.third = third;
	this.fourth = fourth;
	this.fifth = fifth;
	this.bet = bet;
	this.mult = mult;
	this.boxed = boxed;		// not possible, but needed for integrity
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.totalBet = totalBet;
}

function SixHorse(track, race, pool, first, second, third, fourth, fifth, sixth, bet, mult, boxed, displayList, betRequest, totalBet)
{
	this.track = track;
	this.race = race;
	this.pool = pool;
	this.first = first;
	this.second = second;
	this.third = third;
	this.fourth = fourth;
	this.fifth = fifth;
	this.sixth = sixth;
	this.bet = bet;
	this.mult = mult;
	this.boxed = boxed;		// not possible, but needed for integrity
	this.displayList = displayList;
	this.betRequest = betRequest;
	this.totalBet = totalBet;
}

function CurrentConditions(cond)
{
	parts = cond.split('|');

	i = 0;

	this.updateTime = parts[i++];
	this.city = parts[i++];
	this.state = parts[i++];
	this.reportedAt = parts[i++];
	this.sky = parts[i++];
	this.precipitation = parts[i++];
	this.temp = parts[i++];
	this.air = parts[i++];
	this.description = parts[i++];
	this.temperature = parts[i++];
	this.windSpeed = parts[i++];
	this.windDir = parts[i++];
	this.humidity = parts[i++];
	this.dewPoint = parts[i++];
	this.barPressure = parts[i++];
	this.barTendency = parts[i++];
	this.visibility = parts[i++];
	this.iconName = parts[i++];

	if (this.precipitation == "")
		this.precipitation = "None";

	if (this.windDir != "")
		this.windDir = "from " + this.windDir;

	if ((i = this.temperature.indexOf('.')) != -1)
		this.temperature = this.temperature.substring(0, i);

	if ((i = this.dewPoint.indexOf('.')) != -1)
		this.dewPoint = this.dewPoint.substring(0, i);

	if (this.barTendency != "")
		this.barTendency = "(" + this.barTendency + ")";

	if (this.reportedAt == "")
		this.reportedAt = this.city;
}

function Forecast(forecast)
{
	if (forecast.length == 0)
		return null;

	var	parts = forecast.split('|');

	i = 0;

	this.weekday = parts[i++];
	dotod = parts[i++];			// date or time of day
	this.sky = parts[i++];
	this.precipitation = parts[i++];
	this.precipitationPct = parts[i++];
	this.temp = parts[i++];
	this.air = parts[i++];
	this.description = parts[i++];
	this.windSpeed = parts[i++];
	this.windDir = parts[i++];
	this.humidity = parts[i++];
	this.dewPoint = parts[i++];
	this.rainfall = parts[i++];
	this.snowfall = parts[i++];
	this.iconName = parts[i++];

	if (parts.length == (i + 5))
	{
		this.date = dotod.substring(0,2) + "." + dotod.substring(2,4);
		this.highTemp = parts[i++];
		this.lowTemp = parts[i++];
		this.uvIndex = parts[i++];
		this.uv = parts[i++];

		if ((i = this.highTemp.indexOf('.')) != -1)
			this.highTemp = this.highTemp.substring(0, i);

		if ((i = this.lowTemp.indexOf('.')) != -1)
			this.lowTemp = this.lowTemp.substring(0, i);
	}

	if (parts.length == (i + 1))
	{
		this.timeOfDay = dotod;
		this.temperature = parts[i++];
		this.visibility = parts[i++];

		if ((i = this.temperature.indexOf('.')) != -1)
			this.temperature = this.temperature.substring(0, i);
	}

//	if (this.windDir != "")
//		this.windDir = this.windDir + " @ ";

	if ((i = this.windSpeed.indexOf('.')) != -1)
		this.windSpeed = this.windSpeed.substring(0, i);
}

function ExtendedForecast(forecast)
{
	var	parts = forecast.split('\n');

	var	data = parts[0].split('|');

	this.updateTime = data[0];
	this.city = data[1];
	this.state = data[2];

	this.days = new Array(parts.length - 1);

	for (var i = 1; i < parts.length; i++)
		this.days[i - 1] = new Forecast(parts[i]);
}

var trackInfo = new Array();
var raceInfo = new Array();
var runnerInfo = new Array();
var oddsPayoutInfo = new Array();
var pendingInfo = new Array();
var ticketInfo = new Array();

//-->
