		
		var numDiv = 3
		var numRows = 1
		var tabsPerRow = 6
		var numLocations = numRows * tabsPerRow
		var tabWidth = 90
		var tabHeight = 20
		var vOffset = 8
		var hOffset = 10

		var divLocation = new Array(numLocations)
		var newLocation = new Array(numLocations)
		var postTimes = new Array(25)
		var ie = document.all ? 1 : 0
		var ns = document.layers ? 1 : 0
		var xmlPools="";
		var xmlProbables="";
		var xmlOdds="";
		var currentTabbedItem="";
		var currentTabbedItemLower="program";
		var selectedTrack="";
		var selectedRace="";
		var handiArray = new Array(25)
		var willPaysArray = new Array(25)
		var raceConditionsArray = new Array(25)
		var resultsArray = new Array(25)
		var linkLocation=window.location.hostname
		var timerID=0;
		var timerIDRaceChange=0;
		var reg = new RegExp("[A-Z]","i");
		var xmlhttpTrackList="";
		var xmlhttpRaceList="";
		var xmlhttpOdds ="";
		var xmlhttpPools ="";
		var xmlhttpProbables = "";
		var xmlhttpWillPays = "";
		var xmlhttpHandicapping = "";
		var xmlhttpRaceConditions = "";
		var xmlhttpResults = "";
		var xmlhttpTrackListBLoaded = 0;
		var xmlhttpRaceListBLoaded = 0;
		var xmlhttpOddsBLoaded = 0;
		var xmlhttpPoolsBLoaded = 0;
		var xmlhttpProbablesBLoaded = 0;
		var xmlhttpWillPaysBLoaded = 0;
		var xmlhttpHandicappingBLoaded = 0;
		var xmlhttpRaceConditionsBLoaded = 0;
		var xmlhttpResultsBLoaded = 0;
		var coupledEntries = new Array(30)
		var BCoupledEntries=0;
		var TrackType="";
		
		for(var i=0; i<numLocations; ++i) {
			divLocation[i] = i
			newLocation[i]=i;
		}
		for(var i=0; i<coupledEntries.length; ++i) {
			coupledEntries[i] = null
		}
		for(var i=0; i<postTimes.length; ++i) {
			postTimes[i] = null
		}
		
/*---------------------------------------------------------------
These Functions Are Cross-browser Compatible
---------------------------------------------------------------*/		


/* Toggle Menu changes visibility Probables & Willpays secondary Menu
---------------------------------------------------------------------------------*/		
function toggleMenu(menu,onOffBit){
	var selectedMenu="";
	switch(menu){
		case 2:
			selectedMenu = document.getElementById("ProbablesMenu")
			break;
		case 3:
			selectedMenu = document.getElementById("WillPaysMenu")
			break;
	}
	
	if(onOffBit=="on"){
	    selectedMenu.style.visibility = "visible";
	} else {
	    selectedMenu.style.visibility = "hidden";
	}
}
		



/*---------------------------------------------------------------
 Functions That Have Been Converted Yet
---------------------------------------------------------------*/			
		
		
		function getDiv(panelID,s,i) {
			var div
			if (document.layers) {
				div = document.layers[panelID].layers[panelID+s+i]
			} else if (document.all && !document.getElementById) {
				div = document.all[panelID+s+i]
			} else {
				div = document.getElementById(panelID+s+i)
			}
			return div
		}

		function setZIndex(div, zIndex) {
			div.style.zIndex = zIndex
		}

		function updatePosition(div, newPos) {
		}
		function selectTab(n) {
			var firstTab = Math.floor(divLocation[n] / tabsPerRow) * tabsPerRow
			for(var i=0; i<numDiv; ++i) {
				var div = getDiv("p1","panel",i)
				div.style.backgroundColor="#2C74D8";
				if(i == n) setZIndex(div, 100)
				else setZIndex(div, 1)
				div = getDiv("p1","tab",i)
				div.style.backgroundColor="#0E245E";
				div.style.borderColor="#A9C6ED";
				div.style.color = "white";
				try{
					if(i == n){
						setZIndex(div, 100)
						div.style.backgroundColor="#2C74D8";
						div.style.borderColor="#FFFFFF";
						div.style.color = "white";
			
					}
					else setZIndex(div,1)
				}catch(ex){
				}
			}
			updateTabbedStatus('','','','');
			if (n==0){
				currentTabbedItem='results';
				updateResults();
			}
			if (n==1){
				currentTabbedItem='exacta';
				updateProbables('exacta');
			}
			if (n==2){
				currentTabbedItem='willPaysDouble';
				updateWillPays('willPaysDouble');
			}
		}
		

		// Nav4: position component into a table
		function positionPanel() {
			document.p1.top=document.panelLocator.pageY;
			document.p1.left=document.panelLocator.pageX;
		}
		if (document.layers) window.onload=positionPanel;

		function printit(){  
			if (window.print) {
				window.print() ;  
			} else {
				var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
				document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
				WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
			}
		}
		

		
		
		// Page Loader
		function Loader(){
			populateTrackDropDown_Begin();
		}
		
		// Track List Load
		function populateTrackDropDown_Begin()
		{
		    xmlhttpTrackListBLoaded = 0;
		    window.status = "Loading Tracks";
		    var Track = document.getElementById("Track");
	        if (Track != null)
	        {
		        for (var i = (Track.options.length-1); i >= 0; i--)
		        { 
			        Track.options[i] = null; 
			    }
				
		        Track.selectedIndex = -1; 
		        xmlhttpTrackList = GetXMLHTTPConnection();
		        var link = BaseURL + "Authenticated/handlers/trackListing.ashx";
		        //"/Open/Handlers/trackListing.asp";
		        xmlhttpTrackList.open("GET", link, true);
		        xmlhttpTrackList.onreadystatechange = populateTrackDropDown_End;
		        xmlhttpTrackList.send(null);
		    }
		}
		
		// Track List Process and Populate
		function populateTrackDropDown_End()
		{   
		    if (xmlhttpTrackList.readyState == 4 && !xmlhttpTrackListBLoaded)
		    {
			    xmlhttpTrackListBLoaded = 1;
			    var xmlTracks = xmlhttpTrackList.responseXML;
			    var Track = document.getElementById("Track");
			    var root = xmlTracks.documentElement;
			    var nodeAttribute = "";
			    var TracksElement = "";
			    if (Track != null)
			    {
			        for (var i=0; i<root.childNodes.length; i++) 
			        {
				        nodeAttribute = root.childNodes.item(i);
				        var oOption = document.createElement("OPTION");
				        Track.options[Track.options.length] = oOption
				        //Track.options.add(oOption);
				        oOption.innerHTML = nodeAttribute.getAttribute("name");
				        oOption.value = nodeAttribute.getAttribute("abbr") + '|' + nodeAttribute.getAttribute("perf") + '|' +nodeAttribute.getAttribute("tote") + '|' + nodeAttribute.getAttribute("racedate");
			        }
			        if (root.childNodes.length > 0)
			        {
				        Track.selectedIndex = 0;
				        Track_OnChange(Track.options[Track.selectedIndex].value);
			        }
			    }
		    }
		    window.status = "";
		}
		
		// Track On Change Event
		function Track_OnChange(TrackDetail)
		{
			selectedTrack = TrackDetail;
			
			for(var i=0;i<26;i++)
			{
				handiArray[i] = null;
			}
			
			for(var i=0;i<26;i++)
			{
				willPaysArray[i] = null;
			}
			
			for(var i=0;i<26;i++)
			{
				raceConditionsArray[i] =null;
			}
			
			for(var i=0;i<26;i++)
			{
				resultsArray[i] = null;
			}
			
			populateRaceDropDown_Begin();
			
			var Track = document.getElementById("Track");
			var ProgramTrack = document.getElementById("programTrack");
			if(ProgramTrack != null && Track != null)			
			    ProgramTrack.innerHTML = Track.options[Track.selectedIndex].text;
		}
		
		// Race List Load
		function populateRaceDropDown_Begin()
		{
		    xmlhttpRaceListBLoaded = 0;
		    window.status = "Loading Races";
		    var Race = document.getElementById("Race");
		    if (Race != null)
		    {
		        for (var i = (Race.options.length-1); i >= 0; i--)
		        { 
			        Race.options[i] = null; 
			    } 
				
		        Race.selectedIndex = -1; 
		        xmlhttpRaceList = GetXMLHTTPConnection();
		        var link = BaseURL + "Authenticated/handlers/raceListing.ashx?TrackInfo=" + selectedTrack;
		        //"/Open/Handlers/raceListing.asp?variables=" + selectedTrack
		        xmlhttpRaceList.open("GET", link, true);
		        xmlhttpRaceList.onreadystatechange = populateRaceDropDown_End;
		        xmlhttpRaceList.send(null);
		    }
		}
		
		// Race List Process and Populate
		function populateRaceDropDown_End()
		{
		    if (xmlhttpRaceList.readyState == 4 && !xmlhttpRaceListBLoaded)
		    {
			    for (var i = 0; i < postTimes.length; ++i)
			    {
				    postTimes[i] = null;
			    }
				
			    xmlhttpRaceListBLoaded = 1;
			    var xmlRaces = xmlhttpRaceList.responseXML;
			    var root = xmlRaces.documentElement;
			    var nodeAttribute = "";
			    var TracksElement = "";
			    var Race = document.getElementById("Race");
			    if (Race != null)
			    {
			        for (var i = 0; i < root.childNodes.length; i++)
			        {
				        nodeAttribute = root.childNodes.item(i);
				        var oOption = document.createElement("OPTION");
				        Race.options[Race.options.length] = oOption
				        //Race.options.add(oOption);
				        oOption.innerHTML = nodeAttribute.getAttribute("number");
				        postTimes[nodeAttribute.getAttribute("number")] = nodeAttribute.getAttribute("PostTime");
				        oOption.value = nodeAttribute.getAttribute("number");
			        }
				    
			        if (root.childNodes.length > 0)
			        {
				        Race.selectedIndex = 0;
				        Race_OnChange(Race.options[Race.selectedIndex].value);
			        }
				    
			        TrackType = root.getAttribute("raceType");
			        window.status = "";
			    }
		    }
		}
		
		// Race On Change Event
		function Race_OnChange(Number)
		{   
		    if(timerIDRaceChange)
			{
				clearTimeout(timerIDRaceChange);
				timerIDRaceChange  = 0;
			}

			clearAll();

			if(timerID)
			{
				clearTimeout(timerID);
				timerID  = 0;
			}

			selectedRace = Number;

			// why is there a delay here?
			// timerIDRaceChange = setTimeout("RaceLoader()",500);
			RaceLoader();
			timerID = setTimeout("timedEvents()", DataRefreshRate_OddsResults);
		}
		
		// Load all associated data with selected race
		function RaceLoader()
		{
			createTables(TrackType);
			getProbables_Begin();
			getWillPays_Begin();
			getHandicapping_Begin();
			getResults_Begin();
		}
		
		function getOdds_Begin()
		{
		    xmlhttpOddsBLoaded = 0;
		    window.status = "Loading Odds"
		    xmlhttpOdds = GetXMLHTTPConnection();
		    var link = BaseURL + "Authenticated/handlers/CurrentInfo.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
		    //"/Open/Handlers/currentOdds.asp?variables=" + selectedTrack + "&racenum=" + selectedRace;
		    xmlhttpOdds.open("GET", link, true);
		    xmlhttpOdds.onreadystatechange = getOdds_End;
		    xmlhttpOdds.send(null);
		}
		
		function getOdds_End()
		{
		    if (xmlhttpOdds.readyState == 4 && !xmlhttpOddsBLoaded)
		    {
			    raceType = TrackType;
			    xmlhttpOddsBLoaded = 1;
			    xmlOdds = xmlhttpOdds.responseXML;
			    var nodeAttribute = "";
			    var OddsElement = "";
			    var programOddsElement = "";
			    var OddsTable = "";
			    var j;
			    if (xmlOdds != null && xmlOdds.documentElement.getAttribute("Error") == "")
			    {
				    var elementProgramMTP = document.getElementById("programMTP");
				    if (elementProgramMTP != null)
				        elementProgramMTP.innerHTML = ' ' + xmlOdds.documentElement.getAttribute("MTP");
			    
			        var root = xmlOdds.documentElement.childNodes.item(0);
			        
				    var elementOddsCurrentTime = document.getElementById("OddsTitleBarCurrentTime");
				    if (elementOddsCurrentTime != null)
				        elementOddsCurrentTime.innerHTML = root.getAttribute("currenttime");
				    if (root.childNodes.length <= 16)
				    {
					    OddsTable += '<TABLE id=OddsFrame height=110 cellSpacing=0 bgcolor=#D2E5F7 cellPadding=0 width=263 border=0>';
					    for (var i = 0; i < 4; i++)
					    {
						    j = i + 1;
						    OddsTable += '<TR>';
						    style = "";
						    if (i == 3)
						        style = "";
							
						    for (j; j < 17; j += 4)
						    {
							    OddsTable += '<TD width="24%" style="' + style + '"><table id="Odds' + stringRepresentation('Upper',j) + 'One" cellSpacing=1 cellPadding=1 border=0 cols=2 width="100%">';
							    OddsTable += '<TR>';
								
							    var classCSS = "GenericHorse";
							    if ((TrackType == "T" && j <15) || (TrackType == "H" && j < 13))
							    {
								    classCSS = stringRepresentation('Upper', j) + 'Horse' + TrackType;
							    }
								
							    OddsTable += '<td align=center width=20><div class=' + classCSS + '>' + j + '</div></td>';
							    OddsTable += '<td align=center id=Odds' + stringRepresentation('Upper',j) + 'Current class="currentOdds">&nbsp;</td>';
							    OddsTable += '</TR>';
							    OddsTable += '</table>';
							    OddsTable += '</TD>';
						    }
							
						    OddsTable += '</TR>';
					    }
				    }
				    else
				    {
					    OddsTable = '<TABLE id=OddsFrame height=110 cellSpacing=1  bgcolor=#D2E5F7 cellPadding=0 width=263 border=0>';
					    for (var i = 0; i < 5; i++)
					    {
						    j = i + 1;
						    style = "";
						    if( i == 4)
						        style = "";
							    
						    OddsTable += '<TR>';
						    for (j; j < 26; j += 5)
						    {
							    OddsTable += '<TD width="20%"  style="' + style + '"><table id="Odds' + stringRepresentation('Upper', j) + 'One" cellSpacing=0 cellPadding=1 border=0 cols=2 width="100%">';
							    OddsTable += '<TR>';
								
							    var classCSS = "GenericHorse";
							    if ((TrackType == "T" && j < 15) || (TrackType == "H" && j < 13))
							    {
								    classCSS = stringRepresentation('Upper',j) + 'Horse' + TrackType;
							    }
								
							    OddsTable += '<td align=center width=20 ><div class=' + classCSS + '>' + j + '</div></td>';
							    OddsTable += '<td align=center id=Odds' + stringRepresentation('Upper', j) + 'Current class=currentOdds style="background-color:white;border:solid 1px #898989;font-weight:normal;font-size:11px;text-align:right;">&nbsp;</td>';
							    OddsTable += '</TR>';
							    OddsTable += '</table>';
							    OddsTable += '</TD>';
						    }
							
						    OddsTable += '</TR>';
					    }
				    }
					
				    OddsTable += '</table>';
					
				    var oddsElement = document.getElementById("odds");
				    if (oddsElement != null)
				    {
				        oddsElement.innerHTML = OddsTable;
				        for (var i = 0; i < root.childNodes.length; i++)
				        {
					        nodeAttribute = root.childNodes.item(i);
					        OddsElement = document.getElementById(nodeAttribute.getAttribute("element"));
					        programOddsElement = document.getElementById('program' + nodeAttribute.getAttribute("element"));
					        if (OddsElement != null)
					            OddsElement.innerHTML = nodeAttribute.getAttribute("currentOdds");
					        if (programOddsElement != null)
						        programOddsElement.innerHTML=nodeAttribute.getAttribute("currentOdds");
						    
					        if (BCoupledEntries)
					        {
						        try
						        {
							        for (var j = 0; j < coupledEntries.length; ++j)
							        {
								        if( coupledEntries[j] != null)
								        {
									        if (coupledEntries[j].indexOf('program' + nodeAttribute.getAttribute("element")) >= 0)
									        {
										        var programOddsElementCoupled = document.getElementById(coupledEntries[j]);
										        if (programOddsElementCoupled != null)
										            programOddsElementCoupled.innerHTML = nodeAttribute.getAttribute("currentOdds");
									        }
								        }
							        }
						        }
						        catch(ex){}
					        }
    						
				        }
				    }
			    }
				
			    window.status = "";
		    }
		}
		
		function getPools_Begin()
		{
			    xmlhttpPoolsBLoaded = 0;
			    window.status = "Loading Pools"
			    xmlhttpPools = GetXMLHTTPConnection();
			    var link=BaseURL + "Authenticated/handlers/CurrentInfo.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
			    //"/Open/Handlers/currentPools.asp?variables=" + selectedTrack + "&racenum=" + selectedRace
			    xmlhttpPools.open("GET", link, true);
			    xmlhttpPools.onreadystatechange = getPools_End;
			    xmlhttpPools.send(null);
		}
		
		function getPools_End()
		{
		    if (xmlhttpPools.readyState == 4 && !xmlhttpPoolsBLoaded)
		    {
			    xmlhttpPoolsBLoaded = 1;
			    xmlPools = xmlhttpPools.responseXML;
			    window.status = "";
			    updatePools("WinPool");
		    }
		}
		
		function getProbables_Begin()
		{
		    xmlhttpProbablesBLoaded = 0;
		    window.status = "Loading Probables"
		    xmlhttpProbables = GetXMLHTTPConnection();
		    var link=BaseURL + "Authenticated/handlers/CurrentInfo.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
		    //"/Open/Handlers/currentProbables.asp?variables=" + selectedTrack + "&racenum=" + selectedRace
		    xmlhttpProbables.open("GET", link, true);
		    xmlhttpProbables.onreadystatechange=getProbables_End;
		    xmlhttpProbables.send(null);
		}
		
		function getProbables_End()
		{
		    if (xmlhttpProbables.readyState == 4 && !xmlhttpProbablesBLoaded)
		    {
			    xmlhttpProbablesBLoaded = 1;
			    xmlProbables = xmlhttpProbables.responseXML;
			    if (currentTabbedItem == "exacta" || currentTabbedItem == "double" || currentTabbedItem == "quinella")
			    {
			        updateProbables(currentTabbedItem);
			    }
				
			    window.status = "";
		    }
		}
		
		function getWillPays_Begin()
		{
		    xmlhttpWillPaysBLoaded = 0;
		    window.status = "Loading Will Pays"
		    if (willPaysArray[selectedRace] == null)
		    {
			    xmlhttpWillPays = GetXMLHTTPConnection();
			    var link = BaseURL + "Authenticated/handlers/CurrentInfo.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
			    //"/Open/Handlers/willPays.asp?variables=" + selectedTrack + "&racenum=" + selectedRace
			    xmlhttpWillPays.open("GET", link, true);
			    xmlhttpWillPays.onreadystatechange = getWillPays_End;
			    xmlhttpWillPays.send(null);
		    }
		    else
		    {
			    if (currentTabbedItem == "willPaysDouble" || currentTabbedItem == "willPaysPick3" || currentTabbedItem == "willPaysPick4" || currentTabbedItem == "willPaysPick5" || currentTabbedItem == "willPaysPick6" || currentTabbedItem == "willPaysPick9")
			    {
			        updateWillPays(currentTabbedItem);
			    }
		    }
		}
		
		function getWillPays_End()
		{   
			if (xmlhttpWillPays.readyState==4 && !xmlhttpWillPaysBLoaded)
			{
				xmlhttpWillPaysBLoaded = 1;
				var responseXML = xmlhttpWillPays.responseXML
				if( responseXML != null && responseXML.documentElement != null && responseXML.documentElement.getAttribute("Error") == "")
				{
				    var willpays = responseXML.documentElement.childNodes.item(4);
					if (willpays != null && willpays.getAttribute("track") == selectedTrack)
					{
						if (willpays.getAttribute("race") == selectedRace)
						{
							willPaysArray[willpays.getAttribute("race")] = willpays
							if (currentTabbedItem == "willPaysDouble" || currentTabbedItem == "willPaysPick3" || currentTabbedItem == "willPaysPick4" || currentTabbedItem == "willPaysPick5" || currentTabbedItem == "willPaysPick6" || currentTabbedItem == "willPaysPick9")
							{
							    updateWillPays(currentTabbedItem);
							}
						}
						else
						{
							willPaysArray[willpays.getAttribute("race")] = willpays;
						}
					}
				}
				
				window.status = ""
			}
		}
		
		function getHandicapping_Begin()
		{
		    xmlhttpHandicappingBLoaded = 0;
		    window.status = "Loading Handicapping"
		    if (handiArray[selectedRace] == null)
		    {
			    xmlhttpHandicapping = GetXMLHTTPConnection();
			    var link = BaseURL + "Authenticated/handlers/StaticInfo.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
			    //"/Open/Handlers/Handicapping.asp?variables=" + selectedTrack + "&racenum=" + selectedRace
			    xmlhttpHandicapping.open("GET", link, true);
			    xmlhttpHandicapping.onreadystatechange = getHandicapping_End;
			    xmlhttpHandicapping.send(null);
		    }
		    else
		    {
			    updateProgram(TrackType);
		    }
		}
		
		function getHandicapping_End()
		{
			if (xmlhttpHandicapping.readyState==4 && !xmlhttpHandicappingBLoaded)
			{
				xmlhttpHandicappingBLoaded = 1;
				var responseXML = xmlhttpHandicapping.responseXML;
				if (responseXML != null && responseXML.documentElement.getAttribute("Error") == "")
				{
				    var handicap = responseXML.documentElement.childNodes.item(0);
					if (handicap.getAttribute("track") == selectedTrack)
					{
						if (handicap.getAttribute("race") == selectedRace)
						{
							handiArray[selectedRace] = handicap;
							updateProgram(TrackType);
						}
						else
						{
							handiArray[responseXML.documentElement.getAttribute("race")] = handicap;
						}
					}
				}
				
				window.status=""
			}
		}
	
		function getRaceConditions_Begin()
		{
		    xmlhttpRaceConditionsBLoaded = 0;
		    window.status = "Loading Race Conditions";
		    if (raceConditionsArray[selectedRace] == null)
		    {
			    xmlhttpRaceConditions = GetXMLHTTPConnection();
			    var link = BaseURL + "Authenticated/handlers/StaticInfo.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
			    //"/Open/Handlers/raceConditions.asp?variables=" + selectedTrack + "&racenum=" + selectedRace
			    xmlhttpRaceConditions.open("GET", link, true);
			    xmlhttpRaceConditions.onreadystatechange = getRaceConditions_End;
			    xmlhttpRaceConditions.send(null);
		    }
		    else
		    {
		    /*
			    if (currentTabbedItem == "picks")
			    {
			        updatePicks();
			    }
				*/
			    document.getElementById("programDistance").innerHTML = raceConditionsArray[selectedRace].getAttribute("distance");
		    }
		}
		
		function getRaceConditions_End()
		{
		    if (xmlhttpRaceConditions.readyState==4 && !xmlhttpRaceConditionsBLoaded)
		    {
			    xmlhttpRaceConditionsBLoaded = 1;
			    var responseXML = xmlhttpRaceConditions.responseXML;
			    if (responseXML != null && responseXML.documentElement.getAttribute("Error") == "")
			    {
			        var conditions = responseXML.documentElement.childNodes.item(1);
				    if (conditions.getAttribute("track") == selectedTrack)
				    {
					    if (conditions.getAttribute("race") == selectedRace)
					    {
						    raceConditionsArray[selectedRace] = conditions;
						    if (raceConditionsArray[selectedRace] != null)
						    {
						    /*
							    if (currentTabbedItem == "picks")
							    {
							        updatePicks();
							    }
							    */
							    try
							    {   
								    document.getElementById("programDistance").innerHTML = raceConditionsArray[selectedRace].getAttribute("distance");
								    //document.getElementById("programConditions").innerHTML = raceConditionsArray[selectedRace].childNodes.item(0).childNodes[0].nodeValue;
							    }
							    catch(ex)
							    {
							    }
						    }
					    }
					    else
					    {
						    raceConditionsArray[responseXML.documentElement.getAttribute("race")] = conditions;
					    }
				    }
			    }

			    window.status = "";
		    }
		}
		
		function getResults_Begin()
		{
		    xmlhttpResultsBLoaded = 0;
		    window.status = "Loading Race Conditions";
		    if (resultsArray[selectedRace] == null)
		    {
			    xmlhttpResults = GetXMLHTTPConnection();
			    var link = BaseURL + "Authenticated/handlers/Results.ashx?TrackInfo=" + selectedTrack + "&RaceNum=" + selectedRace;
			    //"/Open/Handlers/results.asp?variables=" + selectedTrack + "&racenum=" + selectedRace
			    xmlhttpResults.open("GET", link, true);
			    xmlhttpResults.onreadystatechange = getResults_End;
			    xmlhttpResults.send(null);
		    }
		    else
		    {
			    if (currentTabbedItem == "results" && (resultsArray[selectedRace] != null))
			    {
			        updateResults();
			    }
				
			    if (currentTabbedItem == "")
			    {
			        updateResults();
			    }
		    }
		}
		
		function getResults_End()
		{
		    if (xmlhttpResults.readyState == 4 && !xmlhttpResultsBLoaded)
		    {
			    xmlhttpResultsBLoaded = 1;
			    var responseXML = xmlhttpResults.responseXML;
			    if (responseXML != null && responseXML.documentElement.getAttribute("Error") == "")
			    {
				    if (responseXML.documentElement.getAttribute("track") == selectedTrack)
				    {
				        var results = "";
				        for (var c = 0; c < responseXML.documentElement.childNodes.length; c++)
				        {
				            results = responseXML.documentElement.childNodes.item(c);
					        if (results.getAttribute("race") == selectedRace)
					        {
						        resultsArray[results.getAttribute("race")] = results;
						        if (resultsArray[results.getAttribute("race")] != null)
						        {
							        if (resultsArray[results.getAttribute("race")].childNodes.length == 0)
							        {
								        resultsArray[results.getAttribute("race")] = null;
							        }
						        }
						        else
						        {
							        resultsArray[results.getAttribute("race")] = null;
						        }
    							
						        if (currentTabbedItem == "results" || currentTabbedItem == "")
						        {
						            updateResults();
						        }
					        }
					        else
					        {
						        resultsArray[results.getAttribute("race")] = results;
					        }
				        }
				    }
			    }

			    window.status = "";
		    }
		}
		
		function updateResults()
		{
		    var xmlResults = resultsArray[selectedRace];
		    var resultsTable = "";
		    resultsTable += '<div id="resultsInfoTable">\n\n' +
		        '<div class="resultsInfoRowHeader">\n' + 
		        '<div class="cellPosition">POS</div>\n' +
		        '<div class="cellFinisher">Finisher</div>\n' +
			    '<div class="cellWin">Win</div>\n' +
			    '<div class="cellPlace">Place</div>\n' +
			    '<div class="cellShow">Show</div><br clear="all">\n' +
			    '</div>\n\n';
				
		    if (xmlResults != null)
		    {
			    var root = xmlResults;
			    var nodeAttribute = "";
			    for (var i = 0; i < root.childNodes.length; i++)
			    {
				    nodeAttribute = root.childNodes.item(i);
				    tagNameLower = nodeAttribute.tagName.toLowerCase();
				    if (tagNameLower == 'finisher')
				    {
					    resultsTable += '<div class="resultsInfoRowsDark">\n' +
					        '<div class="cellPosition">' + nodeAttribute.getAttribute("position") + '</div>\n' +
						    '<div class="cellFinisher">' + nodeAttribute.getAttribute("horse") + '</div>\n' +
						    '<div class="cellWin">' + nodeAttribute.getAttribute("winamount") + '</div>\n' +
						    '<div class="cellPlace">' + nodeAttribute.getAttribute("placeamount") + '</div>\n' +
						    '<div class="cellShow">' + nodeAttribute.getAttribute("showamount") + '</div><br clear="all">\n' +
						    '</div>\n\n';
				    }
				    else if (tagNameLower == 'exotic')
				    {
				        resultsTable += '<div class="resultsInfoRowsLight"><div class="cellSpan5">' + nodeAttribute.childNodes[0].nodeValue + '</div></div>\n';
				    }
				    else if (tagNameLower == 'scratches')
				    {
					    resultsTable += '<div class="resultsInfoRowsDark"><div class="cellSpan5">Scratched: ' + nodeAttribute.childNodes[0].nodeValue + '</div></div>\n';
				    }
			    }
		    }
		    else
		    {
			    resultsTable += '<div class="resultsInfoRowsDark"><div class="cellSpan5">No Results Available</div></div>\n';
		    }
			
		    resultsTable += '\n</div>\n\n';
			
		    //alert(resultsTable);
		    document.getElementById("resultsInfo").innerHTML = resultsTable;
		    updateTabbedStatus('RACE: ' + selectedRace,'Results',' ','');
		}
		
		function updatePools(PoolName)
		{
		    var nodeAttribute = "";
		    var WinPoolsElement = "";
		    var PlacePoolsElement = "";
		    var ShowPoolsElement = "";
		    if (xmlPools != null && xmlPools.documentElement.getAttribute("Error") == "")
		    {
		        var root = xmlPools.documentElement.childNodes.item(2);
			    for (var i = 0; i < root.childNodes.length; i++)
			    {
				    nodeAttribute = root.childNodes.item(i);
				    WinPoolsElement = eval('document.getElementById("' + nodeAttribute.getAttribute("element") + 'Win")');
				    WinPoolsElement.innerHTML = nodeAttribute.getAttribute("WinPool");
				    PlacePoolsElement = eval('document.getElementById("' + nodeAttribute.getAttribute("element") + 'Place")');
				    PlacePoolsElement.innerHTML = nodeAttribute.getAttribute("PlacePool");
				    ShowPoolsElement = eval('document.getElementById("' + nodeAttribute.getAttribute("element") + 'Show")');
				    ShowPoolsElement.innerHTML = nodeAttribute.getAttribute("ShowPool");
			    }
				
			    var currentTime = root.getAttribute("currenttime");
			    document.getElementById("WinPoolTotal").innerHTML = root.getAttribute("WinTotal");
			    document.getElementById("PlacePoolTotal").innerHTML = root.getAttribute("PlaceTotal");
			    document.getElementById("ShowPoolTotal").innerHTML = root.getAttribute("ShowTotal");
		    }
		}
		
		function updateProbables(PoolName)
		{
		    var element = "";
		    var nodeAttribute = "";
		    var ProbablesElement = "";
		    var PoolTotal = "";
		    if (xmlProbables != null && xmlProbables.documentElement.getAttribute("Error") == "")
		    {
		        var root = xmlProbables.documentElement.childNodes.item(3);
		        for (var i = 0; i < root.childNodes.length; i++)
		        {
			        nodeAttribute = root.childNodes.item(i);
			        element = nodeAttribute.getAttribute("element");
			        ProbablesElement = document.getElementById(element);
			        ProbablesElement.innerHTML = nodeAttribute.getAttribute(PoolName);
        }
			    
		        var currentTime = root.getAttribute("currenttime");
			    
		        switch (PoolName)
		        {
			        case "exacta":
				        PoolName = "Exacta";
				        PoolTotal = root.getAttribute("ExactaTotal");
				        break;
			        case "double":
				        PoolName = "Daily Double";
				        PoolTotal = root.getAttribute("DoubleTotal");
				        break;
			        case "quinella":
				        PoolName = "Quinella";
				        PoolTotal = root.getAttribute("QuinellaTotal");
				        break;
		        }
			    
		        updateTabbedStatus('RACE: <b>' + selectedRace + '</b>', PoolName, 'Total: <b>$' + PoolTotal + '</b>', currentTime);
		    }
		}
		
		function updateWillPays(PoolName)
		{
		    var translatedPoolName = "";
		    switch(PoolName)
		    {
			    case "willPaysDouble":
				    translatedPoolName = "double";
				    break;
			    case "willPaysPick3":
				    translatedPoolName = "pick3";
				    break;
			    case "willPaysPick4":
				    translatedPoolName = "pick4";
				    break;
			    case "willPaysPick5":
				    translatedPoolName = "pick5";
				    break;
			    case "willPaysPick6":
				    translatedPoolName = "pick6";
				    break;
			    case "willPaysPick9":
				    translatedPoolName = "pick9";
				    break;
		    }
			
		    var nodeAttribute = "";
		    var WillPaysElement = "";
		    var resultsStr = "";

		    var root = willPaysArray[selectedRace];
		    if (root != null)
		    {
		        var strElem = "";
		        for (var i = 0; i < root.childNodes.length; i++)
		        {
			        nodeAttribute = root.childNodes.item(i);
			        if (nodeAttribute.getAttribute("element") == "WillPaysResults")
			        {
				        resultsStr = nodeAttribute.getAttribute(translatedPoolName);
			        }
			        else
			        {
			            strElem = nodeAttribute.getAttribute("element");
				        WillPaysElement = document.getElementById(strElem);
				        WillPaysElement.innerHTML = nodeAttribute.getAttribute(translatedPoolName);
			        }
		        }
		    }
			
		    switch (translatedPoolName)
		    {
			    case "double":
				    translatedPoolName = "Daily Double";
				    break;
			    case "pick3":
				    translatedPoolName = "Pick 3";
				    break;
			    case "pick4":
				    translatedPoolName = "Pick 4";
				    break;
			    case "pick5":
				    translatedPoolName = "Pick 5";
				    break;
			    case "pick6":
				    translatedPoolName = "Pick 6";
				    break;
			    case "pick9":
				    translatedPoolName = "Pick 9";
				    break;
		    }
			
		    updateTabbedStatus('RACE: <b>' + selectedRace + '</b>',translatedPoolName,'',resultsStr);
		}
	/*	function updateHandicapping(sectionName){
			var xmlHandicapping=handiArray[selectedRace]
			//alert(xmlHandicapping.xml)
			var root=xmlHandicapping.documentElement;
			var handiCapping=""
			var nodeAttribute="";
			for (var i=0; i<root.childNodes.length; i++) {
				nodeAttribute=root.childNodes.item(i)
				if (isOdd(i)){
					bgcolor="#F1EBDB";
				}else{
					bgcolor="#DCD6BC";
				}
				switch (sectionName){
					case "pace":
						if (i==0){
							handiCapping+='<table width=460 cols=5 border=0 cellpadding=2 cellspacing=0><tr bgcolor=#C5C0AA class=eightptarialbold style="color:#67564C"><td style="border-bottom:solid 1px #AC996E;" width=200>Horse</td>' +
								'<td style="border-bottom:solid 1px #AC996E;" align=center width=60>Early</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>Middle</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>Finish</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>' +
								'# of Races</td></tr>'
						}
						handiCapping+= '<tr bgcolor=' + bgcolor + ' class=eightptarial><td>' + nodeAttribute.getAttribute("horseid") + 
							' ' + nodeAttribute.getAttribute("horsename") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("paceearly") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("pacemid") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("pacefinal") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("paceall") + '</td></tr>';					
						break;
					case "snapshot":
						if (i==0){
							handiCapping+='<table width=460 cols=5 border=0 cellpadding=2 cellspacing=0><tr bgcolor=#C5C0AA class=eightptarialbold style="color:#67564C"><td style="border-bottom:solid 1px #AC996E;" width=200>Horse</td>' +
								'<td align=center width=60 style="border-bottom:solid 1px #AC996E;">Days Off</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>Wins/Starts</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>Morning Line</td><td style="border-bottom:solid 1px #AC996E;" align=center width=50>' +
								'Power Rating</td></tr>'
						}
						handiCapping+= '<tr bgcolor=' + bgcolor + ' class=eightptarial><td>' + nodeAttribute.getAttribute("horseid") + 
							' ' + nodeAttribute.getAttribute("horsename") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("daysoff") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("numberofwins") + '/' + nodeAttribute.getAttribute("numberofstarts") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("mlodds") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("powerrating") + '</td></tr>';
						break;
					case "speedclass":
						if (i==0){
							handiCapping+='<table width=460 cols=6 border=0 cellpadding=2 cellspacing=0><tr bgcolor=#C5C0AA class=eightptarialbold style="color:#67564C"><td style="border-bottom:solid 1px #AC996E;" width=140>Horse</td>' +
								'<td style="border-bottom:solid 1px #AC996E;" align=center width=60>Avg. Speed</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>Avg. Distance</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>High Speed</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>' +
								'Avg. Class</td><td style="border-bottom:solid 1px #AC996E;" align=center width=50>Last Class</td></tr>'
						}
						handiCapping+= '<tr bgcolor=' + bgcolor + ' class=eightptarial><td>' + nodeAttribute.getAttribute("horseid") + 
							' ' + nodeAttribute.getAttribute("horsename") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("avgsp") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("avgspds") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("highspds") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("avgclassrating") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("lastclassrating") + '</td></tr>';
						break;
					case "jockeytrainer":
						if (i==0){
							handiCapping+='<table width=460 cols=5 border=0 cellpadding=2 cellspacing=0><tr bgcolor=#C5C0AA class=eightptarialbold style="color:#67564C><td style="border-bottom:solid 1px #AC996E;" width=200>Jockey/Trainer</td>' +
								'<td style="border-bottom:solid 1px #AC996E;" align=center width=60>Starts</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>1st</td><td style="border-bottom:solid 1px #AC996E;" align=center width=60>2nd</td><td style="border-bottom:solid 1px #AC996E;" align=center width=50>' +
								'3rd</td></tr>'
						}
						handiCapping+= '<tr bgcolor=' + bgcolor + ' class=eightptarial><td>' + nodeAttribute.getAttribute("jockey") + 
							'/' + nodeAttribute.getAttribute("trainer") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("jts") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("jtfirst") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("jtsecond") + '</td>' +
							'<td align=center>' + nodeAttribute.getAttribute("jtthird") + '</td></tr>';
						break;
					}
			}
			handiCapping+='</table>'
			document.all.Handicapping.innerHTML=handiCapping;
			switch (sectionName){
				case "pace":
					sectionName="Pace";
					break;
				case "snapshot":
					sectionName="Snap Shot";
					break;
				case "speedclass":
					sectionName="Speed and Class";
					break;
				case "jockeytrainer":
					sectionName="Jockey / Trainer";
					break;
			}
			updateTabbedStatus('RACE: <b>' + selectedRace +'</b>',sectionName,' ','')
			
		}
	
		function updatePicks(){
			var xmlProgram=raceConditionsArray[selectedRace]
			var root=xmlProgram.documentElement;
			var handiCapping=""
			var nodeAttribute="";
			handiCapping+='<table width=460 height=140 cols=2 border=1 bgcolor=#DCD6BC bordercolor=#C5C0AA cellpadding=2 cellspacing=0>'
			for (var i=0; i<root.childNodes.length; i++) {
				nodeAttribute=root.childNodes.item(i)
				if (nodeAttribute.tagName=='selection'){	
					handiCapping+='<tr><td style="font-family:arial;font-size:12pt;font-weight:bold;">'; 
					handiCapping+=nodeAttribute.getAttribute("number");
					handiCapping+='</td><td style="font-family:arial;font-size:9pt;font-weight:normal;">';
					handiCapping+=nodeAttribute.text;
					handiCapping+='</td></tr>';
				}
			}
			handiCapping+='</table>'
			
			document.all.Handicapping.innerHTML=handiCapping;
			updateTabbedStatus('RACE: ' + selectedRace,'Picks',' ','')
		}
	*/

		function updateProgram(TrackType)
		{
//			var xmlProgram=handiArray[selectedRace]
		    var root = handiArray[selectedRace];
			var ProgramTable="";
			for(var i=0; i<coupledEntries.length; ++i) {
				coupledEntries[i] = null
			}
			var coupledEntriesCounter=0;
			BCoupledEntries=0;
			var coupledEntriesText="";
//			var root=xmlProgram.documentElement;
			var handiCapping=""
			var nodeAttribute="";
			var jockeyDriverStr="";
			if (TrackType=="H" ){
				jockeyDriverStr="Driver";
			} else {
				jockeyDriverStr="Jockey";
			}
			
			ProgramTable+='<div id="programInfoTable">\n\n';
			
			ProgramTable+='<div class="programInfoRowHeader">\n';
			ProgramTable+='<div class="cellHorse">Horse</div>\n';
			ProgramTable+='<div class="cellJockey">' + jockeyDriverStr + '</div>\n';
			ProgramTable+='<div class="cellMLOdds">ML Odds</div>\n';
			ProgramTable+='<div class="cellCurrent">Current</div>\n';
			ProgramTable+='<div class="cellWinPool">Win Pool</div>\n';
			ProgramTable+='<div class="cellPlacePool">Place Pool</div>\n';
			ProgramTable+='<div class="cellShowPool">Show Pool</div><br clear="all">\n'
			ProgramTable+='</div>\n';
			
			for (var i=0; i<root.childNodes.length; i++){
				if (isOdd(i)){
					rowClass="programInfoRowOdd";
				}else{
					rowClass="programInfoRowEven";
				}
				coupledEntriesText="";
				nodeAttribute=root.childNodes.item(i)
				var classCSS="GenericHorse"
				if((TrackType=="T" && nodeAttribute.getAttribute("binum")<15)||(TrackType=="H" && nodeAttribute.getAttribute("binum")<13)){
					classCSS=stringRepresentation('Upper',nodeAttribute.getAttribute("binum")) + 'Horse' + TrackType
				}
				if(reg.exec(nodeAttribute.getAttribute("horseid"))!=null){
					BCoupledEntries=1;
					coupledEntriesText=nodeAttribute.getAttribute("horseid");
					coupledEntries[coupledEntriesCounter]='programOdds' + stringRepresentation('Upper',nodeAttribute.getAttribute("binum")) + 'Current' + coupledEntriesText
					coupledEntriesCounter++;
				}
				horsename=nodeAttribute.getAttribute("horsename")
				if (nodeAttribute.getAttribute("scratched")=="Y"){horsename='<strike>' + horsename +'</strike>'}
				ProgramTable+='<div class="' + rowClass +'">\n' +
						'<div class="cellHorse">' +
							nodeAttribute.getAttribute("horseid") + ' ' +
							horsename +
						'</div>\n' +
						'<div class="cellJockey">' + 
							nodeAttribute.getAttribute("jockey") +
						'</div>\n' +
						'<div class="cellMLOdds">' + 
							nodeAttribute.getAttribute("mlodds") +
						'</div>\n' +
						'<div class="cellCurrent" id=programOdds' + stringRepresentation('Upper',nodeAttribute.getAttribute("binum")) + 'Current' + coupledEntriesText + '>' +
							'&nbsp;' +
						'</div>\n' +
						'<div class="cellWinPool" id=Pools' + stringRepresentation('Upper',nodeAttribute.getAttribute("binum")) + 'CurrentWin' + coupledEntriesText + '>' +
							'&nbsp;' +
						'</div>\n' +
						'<div class="cellPlacePool" id=Pools' + stringRepresentation('Upper',nodeAttribute.getAttribute("binum")) + 'CurrentPlace' + coupledEntriesText + '>' +
							'&nbsp;' +
						'</div>\n' +
						'<div class="cellShowPool" id=Pools' + stringRepresentation('Upper',nodeAttribute.getAttribute("binum")) + 'CurrentShow' + coupledEntriesText + '><br clear="all">' +
						'</div>\n' +
					'</div>\n'
				
			}
			ProgramTable+='<div class="programInfoRowTotal">\n'
			ProgramTable+='<div class="cellTotalText">Total:</div>\n'
			ProgramTable+='<div class="cellWinPool" id=WinPoolTotal>&nbsp;</div>\n'
			ProgramTable+='<div class="cellPlacePool" id=PlacePoolTotal>&nbsp;</div>\n'
			ProgramTable+='<div class="cellShowPool" id=ShowPoolTotal>&nbsp;</div>\n'
			ProgramTable+='</div>\n'
			
			var today = new Date();
			ProgramTable+='<div class="programInfoCopyright">\n'
			ProgramTable+='<div class="cellCopyright">* ' + today.getFullYear() + ' Equibase Company LLC, All Rights Reserved.</div>\n';
	        ProgramTable+='</div>\n\n'
			ProgramTable+='</div>\n\n'
    		document.getElementById("programInfo").innerHTML=ProgramTable;
			document.getElementById("programRaceNumber").innerHTML='Race ' + selectedRace +'';
			updateProgramTabbedStatus(root.getAttribute("availablepools"));
			getRaceConditions_Begin();
			getOdds_Begin();
			getPools_Begin();
		}

		function updateTabbedStatus(strOne,strTwo,strThree,strFour)
		{
			document.getElementById("statusRace").innerHTML=strOne;
			document.getElementById("statusSection").innerHTML=strTwo;
			document.getElementById("statusInfoOne").innerHTML=strThree;
			document.getElementById("statusInfoTwo").innerHTML=strFour;
		}

		function updateProgramTabbedStatus(strOne)
		{
			document.getElementById("programWagerTypes").innerHTML='Post Time: ' + postTimes[selectedRace] + ' ET&nbsp;&nbsp;<font color=black>|</font>&nbsp;&nbsp;Wager Types: ' +strOne ;
		}

		function showProbables(PoolName)
		{
			selectTab(1)
			toggleMenu(2,'off')
			currentTabbedItem=PoolName;
			updateProbables(PoolName);
		}
		
		function showWillPays(PoolName)
		{
			selectTab(2)
			toggleMenu(3,'off')
			currentTabbedItem=PoolName;
			updateWillPays(PoolName);
		}
	/*	function showHandicapping(Info){
			selectTab(3)
			toggleMenu(4,'off')
			currentTabbedItem=Info;
			if(Info=='picks'){
				updatePicks();
			}else{
				updateHandicapping(Info);
			}
		}
	*/
		function ForceError(msg, url, lno)
		{
			/*alert("Error Occurred! Handled by Generic Error Handler" + "\n" +
				"Error: " + msg + "\n" + "URL: " + url + "\n" +   
				"Line Number: " + lno);*/
			//sendError(msg,url,lno)
			return true;
		}

		function clearAll()
		{
			createTables(TrackType)
			//document.all.Handicapping.innerHTML="";
			document.getElementById("resultsInfo").innerHTML="";
			updateTabbedStatus('','','','');
			/*for(var i=1;i<26;i++){
				var currentOddsElement=eval('document.all.Odds' + stringRepresentation("Upper",i) + 'Current');
				currentOddsElement.innerHTML="";
			}
			for(var i=1;i<26;i++){
				var currentPoolsElement=eval('document.all.Pools' + stringRepresentation("Upper",i) + 'Current');
				currentPoolsElement.innerHTML="";
			}
			for(var i=1;i<26;i++){
				var currentProbablesElement=eval('document.all.Pools' + stringRepresentation("Upper",i) + 'Current');
				currentProbablesElement.innerHTML="";
			}*/
		}
		
		function createTables(TrackType)
		{
			var ProbablesTable="";
			var bgcolor=""
			ProbablesTable='<div id="MatrixTable">\n\n'
			for(var k=0;k<26;k++){
				if (isOdd(k)){
					rowClass="MatrixTableRowOdd";
				}else{
					rowClass="MatrixTableRowEven";
				}
				ProbablesTable+='<div class="' + rowClass + '">\n'
				for(var l=0;l<26;l++){
					if(k==0){
						if (l==0){
							ProbablesTable+='\t<div class="matrixCellEmpty" id="probableDescriptor"></div>\n'
						}else if(l==25){
							ProbablesTable+='\t<div class="matrixRow">25</div><br clear="all">\n'
						}else{
							ProbablesTable+='\t<div class="matrixRow">' + l + '</div>\n'
						}
					}else{
						if (l==0){
							ProbablesTable+='\t<div class="matrixColumn">' + k + '</div>\n'
						}else{
							ProbablesTable+='\t<div class="currentMatrix" id="' + stringRepresentation('',l) + stringRepresentation('Upper',k)+ '">&nbsp;</div>\n';
		                    if(l==25) {
		                        ProbablesTable+='<br clear="all">';
		                    }				
		                    				
						}
					}
					
				}
				ProbablesTable+='</div>\n\n'
			}
			ProbablesTable+='</div>\n\n'
			//alert(ProbablesTable);
			document.getElementById("Matrix").innerHTML=ProbablesTable;

			var WillPaysTable="";
			var n
			WillPaysTable='<TABLE id=WillPaysTable height=1 cellSpacing=0 cellPadding=0 width=463 border=0 bgcolor=#D2E5F7>\n'
			for(var m=0;m<5;m++){
				n=m+1;
				WillPaysTable+='<TR>\n'
				for(n;n<26;n+=5){
					WillPaysTable+='<TD width="20%">\n\n<table id="WillPaysInner' + stringRepresentation('Upper',n) +'" cellSpacing=1 cellPadding=1 border=0 width="100%">\n'
					WillPaysTable+='<TR>\n'
					var classCSS="GenericHorse"
					if((TrackType=="T" && n<15)||(TrackType=="H" && n<13)){
						classCSS=stringRepresentation('Upper',n) + 'Horse' + TrackType
					}
					WillPaysTable+='<td width=1><div class=' + classCSS +' >' + n +
						'</div></td>\n'
					WillPaysTable+='<td id=WillPays' + stringRepresentation('Upper',n) + ' class=currentPools></td>'
					WillPaysTable+='</TR>\n'
					WillPaysTable+='</table>\n\n'
					WillPaysTable+='</TD>\n'
				}
				WillPaysTable+='</TR>\n\n'
			}
			WillPaysTable+='</table>\n'
			document.getElementById("WillPays").innerHTML=WillPaysTable;
			document.getElementById("programInfo").innerHTML="";
		}
		
		function timedEvents()
		{
			RaceLoader();
			timerID = setTimeout("timedEvents()",60000);
		}
		
		function stringRepresentation(CaseSwitch,Number)
		{
			Number=parseInt(Number)
			var stringRep
			switch (Number){
				case 1:
					stringRep="one"
					break;
				case 2:
					stringRep="two"
					break;
				case 3:
					stringRep="three"
					break;
				case 4:
					stringRep="four"
					break;
				case 5:
					stringRep="five"
					break;
				case 6:
					stringRep="six"
					break;
				case 7:
					stringRep="seven"
					break;
				case 8:
					stringRep="eight"
					break;
				case 9:
					stringRep="nine"
					break;
				case 10:
					stringRep="ten"
					break;
				case 11:
					stringRep="eleven"
					break;
				case 12:
					stringRep="twelve"
					break;
				case 13:
					stringRep="thirteen"
					break;
				case 14:
					stringRep="fourteen"
					break;
				case 15:
					stringRep="fifteen"
					break;
				case 16:
					stringRep="sixteen"
					break;
				case 17:
					stringRep="seventeen"
					break;
				case 18:
					stringRep="eighteen"
					break;
				case 19:
					stringRep="nineteen"
					break;
				case 20:
					stringRep="twenty"
					break;
				case 21:
					stringRep="twentyOne"
					break;
				case 22:
					stringRep="twentyTwo"
					break;
				case 23:
					stringRep="twentyThree"
					break;
				case 24:
					stringRep="twentyFour"
					break;
				case 25:
					stringRep="twentyFive"
					break;
				default:
					stringRep="";
					break;
			}
			
			if (CaseSwitch=="Upper")
				stringRep=stringRep.substring(0,1).toUpperCase() + stringRep.substring(1,stringRep.length)
			return stringRep;
		}
		
		function sendError(ErrorMsg,URL,LineNumber)
		{
		    var strErrorMsg = "<error><errorMsg>" + ErrorMsg + "</errorMsg><URL>" + URL + "</URL><LineNumber>" +
				              LineNumber + "</LineNumber></error>";
				              
            // Calling SendError in ErrorAndStatus.js
			SendError(strErrorMsg);
		}

		window.onerror = ForceError;
