//-------------------------------------------------------------------------TOTE
var tot_exm = "";
var tot_tid = "";
var tot_dat = "";
var tot_trk = "";
var tot_nrs = "";
var tot_crc = "";
var tot_mtp = "";
var tot_win = "";
var tot_plc = "";
var tot_shw = "";
var tot_qui = "";
var tot_exa = "";
var tot_dbl = "";
var tot_ptd = "";
var tot_typ = "";
//-------------------------------------------------------------------------GET TOTE
function GetTote(a){
tot_typ = a;
ClearToteTable();
ClearTotalsTable();
soapRequest = ' \
\
\
\
' + tot_tid + ' \
' + tot_dat + ' \
' + tot_typ + ' \
\
\
';
$.ajax({
type: "POST",
url: wsUrl,
contentType: "text/xml",
dataType: "xml",
data: soapRequest,
complete: endGetTote
});
}
function endGetTote(xmlHttpRequest, status) {
$(xmlHttpRequest.responseXML).find('GetToteResult').each(function(){
tot_exm = $(this).find('exm').text().toUpperCase();
tot_crc = $(this).find('crc').text();
tot_mtp = $(this).find('mtp').text();
tot_win = $(this).find('win').text();
tot_plc = $(this).find('plc').text();
tot_shw = $(this).find('shw').text();
tot_qui = $(this).find('qui').text();
tot_exa = $(this).find('exa').text();
tot_dbl = $(this).find('dbl').text();
tot_ptd = $(this).find('ptd').text();
});
if(tot_typ == "ODDS"){
win = tot_win.split(",");
plc = tot_plc.split(",");
shw = tot_shw.split(",");
}
if(tot_typ == "PROBS"){
win = tot_win.split(",");
plc = tot_plc.split(",");
shw = tot_shw.split(",");
}
if(tot_exm == "SUCCESS"){
document.getElementById('tottxt').innerHTML = tot_trk + " Race " + tot_crc + " of " + tot_nrs + " Totals";
//DisplayTote();
PoolTotals();
}
else{
document.getElementById('tottxt').innerHTML = "No Current Odds";
ClearToteTable();
ClearTotalsTable();
}
}
//function winOdds(){
// for(var i = 1; i <= mxr; i++) {
// if(mlns[i].length < 3){
// if(mlns[i] != "SC"){
// mlns[i] += "-1";
// }
// else {
// mlns[i] += " ";
// }
// }
//
// if(odds[i-1].length < 3){
// if(odds[i-1] != "SC"){
// odds[i-1] += "-1";
// }
// else {
// odds[i-1] += " ";
// }
// }
// }
//}
//-------------------------------------------------------------------------UPDATE TOTE
function UpdateTote(){
ClearToteTable();
ClearTotalsTable();
soapRequest = ' \
\
\
\
' + tot_tid + ' \
' + tot_dat + ' \
PROBS \
\
\
';
$.ajax({
type: "POST",
url: wsUrl,
contentType: "text/xml",
dataType: "xml",
data: soapRequest,
complete: endUpdateTote
});
}
function endUpdateTote(xmlHttpRequest, status) {
$(xmlHttpRequest.responseXML).find('GetToteResult').each(function(){
tot_exm = $(this).find('exm').text().toUpperCase();
tot_crc = $(this).find('crc').text();
tot_mtp = $(this).find('mtp').text();
tot_win = $(this).find('win').text();
tot_plc = $(this).find('plc').text();
tot_shw = $(this).find('shw').text();
tot_qui = $(this).find('qui').text();
tot_exa = $(this).find('exa').text();
tot_dbl = $(this).find('dbl').text();
tot_ptd = $(this).find('ptd').text();
});
win = tot_win.split(",");
plc = tot_plc.split(",");
shw = tot_shw.split(",");
if(tot_exm == "SUCCESS"){
document.getElementById('tottxt').innerHTML = tot_trk + " Race " + tot_crc + " of " + tot_nrs + " Totals";
PoolTotals();
}
else{
document.getElementById('tottxt').innerHTML = "No Current Odds";
ClearToteTable();
ClearTotalsTable();
}
}
//-------------------------------------------------------------------------DISPLAY TOTE
function DisplayTote(){
//--------------------------------------EXACTA
var exa_arr1 = new Array();
var exa_arr2 = new Array();
exa_arr1 = tot_exa.split(";");
for(var i = 0; i <= mxr-1; i++) {
exa_arr2[i] = exa_arr1[i].split(",");
var table = document.getElementById('toteTable');
table.style.border = '1px solid #CCCCCC';
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var img = document.createElement('img');
if(spt == "G"){ img.src = imgsrc_USG + imgnam[i+1]; }
if(spt == "T" || spt =="H" && nat == "US"){ img.src = imgsrc_UST + imgnam[i+1]; }
for(var j = 0; j <= mxr-1; j++) {
if(exa_arr2[i][j] == null){
exa_arr2[i][j] = "-";
}
var cell2 = row.insertCell(j);
cell2.innerHTML = exa_arr2[i][j];
}
var cell0 = row.insertCell(0);
cell0.appendChild(img);
cell0.style.width = '5%';
var cell1 = row.insertCell(1);
cell1.innerHTML = win[i];
cell1.style.textAlign = "center";
cell1.style.width = '10%';
cell1.style.backgroundColor = "#C4E0FF";
}
PoolTotals();
}
//-------------------------------------------------------------------------POOL TOTALS
function PoolTotals(){
var total_arr1 = new Array();
var total_arr2 = new Array();
total_arr1 = tot_ptd.split(";");
var totalName = new Array();
var totalValue = new Array();
for(var i=0; i< total_arr1.length; i++){
total_arr2[i] = total_arr1[i].split(",");
totalName.push(total_arr2[i][0]);
totalValue.push(total_arr2[i][1]);
var table = document.getElementById('totalsTable');
table.style.border = '1px solid #CCCCCC';
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell0 = row.insertCell(0);
cell0.innerHTML = totalName[i];
var cell1 = row.insertCell(1);
var cell2 = row.insertCell(2);
cell2.innerHTML = "$" + totalValue[i];
}
cell0.style.width = '100px';
cell1.style.width = '10px';
}
//-------------------------------------------------------------------------CLEAR TOTE
function ClearToteTable(){
var table = document.getElementById("toteTable");
table.style.border = '1px #666666 hidden';
var rowCount = table.rows.length-1;
for(var i = 0; i <= rowCount; i++) {
var row = table.rows[i];
table.deleteRow(i);
rowCount--;
i--;
}
}
function ClearTotalsTable(){
var table = document.getElementById("totalsTable");
table.style.border = '1px #666666 hidden';
var rowCount = table.rows.length-1;
for(var i = 0; i <= rowCount; i++) {
var row = table.rows[i];
table.deleteRow(i);
rowCount--;
i--;
}
}
function ClearToteArrays(){
win = [];
plc = [];
shw = [];
tot_exm = "";
tot_crc = "";
tot_mtp = "";
tot_win = "";
tot_plc = "";
tot_shw = "";
tot_qui = "";
tot_exa = "";
tot_dbl = "";
tot_ptd = "";
}