function MSO_NBA_Odds(bindUI)
{
var oldXmlDom = null;
var newXmlDom = null;
if(window.ActiveXObject)
{
try
{
oldXmlDom = new ActiveXObject('MICROSOFT.XMLDOM');
newXmlDom = new ActiveXObject('MICROSOFT.XMLDOM');
}
catch(e)
{
alert('对不起,您的浏览器不支持此操作,请使用IE 6.0访问本页面!');
}
}
else
{
alert('对不起,您的浏览器不支持此操作,请使用IE 6.0访问本页面!');
}
var newXmlDom_LoadCount = 0;
newXmlDom.async = true;
newXmlDom.onreadystatechange = newXmlDom_onreadystatechange;
var Prompt = new Object();
var PROMPT_INTERVAL = 60;
window.PromptInterval = function(key)
{
var UI = document.getElementById(key);
if(UI)
{
if(Prompt[key].interval > 0)
{
UI.style['color'] = Prompt[key].interval-- % 2 == 0 ? (
Prompt[key].type == 0 ? 'blue' : 'red'
) : '#ffffff';
Prompt[key].handle = setTimeout('PromptInterval("' + key + '")' , 1000);
}
else
{
UI.parentNode.removeChild(UI);
Prompt[key] = null;
}
}
else
{
Prompt[key] = null;
}
}
Date.prototype.getDay2 = function()
{
switch(this.getDay())
{
case 0 : return '星期日';
case 1 : return '星期一';
case 2 : return '星期二';
case 3 : return '星期三';
case 4 : return '星期四';
case 5 : return '星期五';
case 6 : return '星期六';
}
}
function parseDate(datestr)
{
return new Date(
parseInt(datestr.substr(0 , 4) , 10) , parseInt(datestr.substr(5 , 2) , 10) - 1 , parseInt(datestr.substr(8 , 2) , 10)
);
}
function equals()
{
try
{
//alert(oldXmlDom.xml == newXmlDom.xml);
return oldXmlDom.xml == newXmlDom.xml;
}
catch(e)
{
return false;
}
}
function loadNewXmlDom()
{
if(typeof(window['SERVER_TIME$']) == 'undefined') window['SERVER_TIME$'] = 3428533825;
else window['SERVER_TIME$'] += 1;
newXmlDom.load('/xml/odds/odds_all.xml?' + window['SERVER_TIME$']);
}
function newXmlDom_onreadystatechange()
{
try
{
if (newXmlDom.parseError.errorCode != 0)
{
setTimeout(loadNewXmlDom , 100);
}
else if(newXmlDom.readyState == 4)
{
window.defaultStatus = "正在处理XML...";
work(newXmlDom.xml);
window.defaultStatus = "完成(" + ++newXmlDom_LoadCount + ")";
setTimeout(loadNewXmlDom , 1000 * 2);
}
}
catch(e)
{
window.defaultStatus = e.message;
}
}
var first_access = true;
function work(xmlText)
{
if(equals() == false)
{
var UI = typeof(bindUI).toLowerCase() == 'string' ? document.getElementById(bindUI) : bindUI;
UI.innerHTML = asyncMakeHtml();
oldXmlDom.loadXML(xmlText);
for (var key in Prompt)
{
try
{
clearTimeout(Prompt[key].handle);
}
catch(e)
{
window.defaultStatus = e.message;
}
PromptInterval(String(key));
}
}
}
function getNewOddsArray(oldData , newData , vs_id , index)
{
if (oldData == newData)
{
if (oldData == '')
{
return ['' , '' , '' , '' , '' , ''];
}
}
if (newData == '')
{
newData = '0.0*0.0*0.0*0.0*0.0*0.0';
}
var oldOdds = oldData.split('*');
var newOdds = newData.split('*');
var key = '';
for (var a = 0 ; a < oldOdds.length ; a ++)
{
newOdds[a] = newOdds[a].replace(/ /g , '');
key = 'mso,nba,odds,' + vs_id + ',odds' + (index + 1) + ',' + (a + 1);
if (parseFloat(oldOdds[a]) < parseFloat(newOdds[a])) //升
{
newOdds[a] += '↑';
if (! Prompt[key])
{
Prompt[key] = new Object();
Prompt[key].handle = 0;
}
Prompt[key].interval = Prompt[key].type == 1 ? Prompt[key].interval : PROMPT_INTERVAL;
Prompt[key].type = 1;
}
else if(parseFloat(oldOdds[a]) > parseFloat(newOdds[a])) //降
{
newOdds[a] += '↓';
if (! Prompt[key])
{
Prompt[key] = new Object();
Prompt[key].handle = 0;
}
Prompt[key].interval = Prompt[key].type == 0 ? Prompt[key].interval : PROMPT_INTERVAL;
Prompt[key].type = 0;
}
else
{
if (Prompt[key] && parseFloat(oldOdds[a]) != '0.0')
{
if(Prompt[key].type == 0)
{
newOdds[a] += '↓';
}
else if(Prompt[key].type ==1)
{
newOdds[a] += '↑';
}
}
}
}
return newOdds;
}
function asyncMakeHtml()
{
var newXmlNodes = newXmlDom.selectNodes('/mso/row');
var oldXmlNode = null;
var tempDate = null;
var odds = null;
var html = '';
if (newXmlNodes.length == 0)
{
html = '
暂无比赛赔率.
';
}
for (var a = 0 ; a < newXmlNodes.length ; a ++)
{
var b = getAttribute(newXmlNodes[a] , 'b');
if (tempDate == null || tempDate != b.substr(0 , 10))
{
html += '