function loadTrackData_Begin()
{
window.status = "Loading track Data...";
xmlhttpObj1 = GetXMLHTTPConnection();
xmlhttpObj1.open("GET", baseURL+"/totedata/totetrack/totetrack.xml?rand=" + Math.random(), true);
xmlhttpObj1.onreadystatechange = loadTrackData_End;
xmlhttpObj1.send(null);
}

function loadTrackData_End()
{
    // if xmlhttp shows "loaded"
    if (xmlhttpObj1.readyState==4)
    {
        // if "OK"
        if (xmlhttpObj1.status == 200) {
            var responseXML = xmlhttpObj1.responseXML;
            if (responseXML != null )
            {
                var root = responseXML.documentElement;
			    var tracks = root.getElementsByTagName("Track");
			    var j=0;
			    for(var i=0;i<tracks.length;i++) {
   			    	if(tracks[i].childNodes[6].childNodes[0].nodeValue == 'File') {
			        var name=tracks[i].childNodes[2].childNodes[0].nodeValue;
			        var trackid=tracks[i].childNodes[1].childNodes[0].nodeValue;
			        var raceNo=tracks[i].childNodes[3].getAttribute('RaceNumber');
			        var oOption = document.createElement("OPTION");
			        if (trackid=='AQD' ||trackid=='BED' ||trackid=='STD'){
			            selectedTrackId=trackid;
			            selectedRace=raceNo;
			        }
			        }
			    }
                loadRaceData_Begin();
            } else {
                    noToteDataFound()
            }
        } else {
                noToteDataFound()
        }           
    }
    window.status=""
}

function getFileName(poolName) {
var newfile ='/toteboard/wps.html';
if (poolName=="WPS") {
	newfile = '/toteboard/nyra/wps.html';
} else if (poolName=="EX") {
	newfile = '/toteboard/nyra/exacta.html';
} else if (poolName=="QU") {
	newfile = '/toteboard/nyra/quinella.html';
} else if (poolName=="DBL") {
	newfile = '/toteboard/nyra/dailydouble.html';
} else if (poolName=="PK3") {
 	newfile = '/toteboard/nyra/pick3.html';
} else if (poolName=="PK4") {
	newfile = '/toteboard/nyra/pick4.html';
} else if (poolName=="PK6") {
	newfile = '/toteboard/nyra/pick6.html';
} else if (poolName=="DBLAF") {
	newfile = '/toteboard/nyra/dailydoubleafter.html';
} else if (poolName=="GSL") {
	newfile = '/toteboard/nyra/grandslam.html';
} else {
	newfile = '/toteboard/nyra/wps.html';
}
 return baseURL+newfile
}

function gotoTote() {
	window.location=baseURL+'/toteboard/nyra/wps.html';
}

function gotoResult() {
    window.location=baseURL+'/toteboard/nyra/nyraresult.html';
}
