
function changeBetTypeSelection(betType,actType){var channel=new Request({url:'http://'+document.domain+(window.location.port!=''?':'+window.location.port:'')+'/updateSportPref',method:'GET',autoCancel:'true',onSuccess:function(responseText,responseXML){},onFailure:function(xhr){}});var params="sportId="+sportId+"&action="+actType+"&betType="+betType+"&jSessionId="+jSessionId;channel.send(params);}
var MatchConstants=new Class({initialize:function(){this.spacer=" ";this.htmlBR=document.createElement('br');this.oddsRow=new Element('tr',{'height':'19px'});this.td=new Element('td');this.div=new Element('div');this.tableInc=new Element('tableInc');this.betTypeCell=new Element('td');this.probabilityCell=new Element('span',{'class':'probability'});this.outcomeCell=new Element('td',{'class':'outcomeNameCell'});this.oddsCell=new Element('td',{'class':'oddsOutcomeCell'});this.tdarond=new Element('td',{'class':'delimiterCell'});this.providersCell=new Element('td',{'class':'providersCell'});this.moreImg=new Element('img');this.moreImg.setAttribute('src',bbGlobal.gfxServer+'/gfx/image/more.gif');this.moreImg.setAttribute('class','expandable size10x10 tooltip marginRight3');this.moreImg.setAttribute('alt','+');this.hideImg=new Element('img');this.hideImg.setAttribute('src',bbGlobal.gfxServer+'/gfx/image/hide.gif');this.hideImg.setAttribute('class','expandable size10x10 tooltip marginRight3');this.hideImg.setAttribute('alt','-');this.imgProvider=document.createElement('img');this.imgProvider.setAttribute('class','size75x16 vAlignMiddle');this.span=new Element('span');this.div=new Element('div');this.aLink=new Element('a');this.betTypeLink=new Element('a',{'class':'bold'});this.divBetType=new Element('div',{"class":"infoBetType"});this.li=new Element("li",{"class":"detailedOutcome"});this.ol=new Element("ol",{"class":"outcomeLst"});this.downArrowImgSrcAnimated=bbGlobal.gfxServer+'/gfx/icons/down-animated.gif';this.upArrowImgSrcAnimated=bbGlobal.gfxServer+'/gfx/icons/up-animated.gif';this.downArrowImgSrc=bbGlobal.gfxServer+'/gfx/icons/down.gif';this.upArrowImgSrc=bbGlobal.gfxServer+'/gfx/icons/up.gif';this.spcArrowImgSrc=bbGlobal.gfxServer+'/gfx/icons/src.gif';this.liveSpan=new Element('span',{'class':'liveHeader'});this.liveSpan.set('html',bbGlobal.txtLIVE+'!');}});var matchConstants=new MatchConstants();function matchReformatodds(format){var rows=matchTableModel.sortedBetTypes;var nrOfRows=rows.length;for(var i=0;i<nrOfRows;i++){rows[i].formatOdds();}
try{changeOddsTypeServerNotification('oddsdisplay='+format);}catch(e){}}
var MatchTableModel=new Class({initialize:function(id){this.topElement=$(id);if(this.topElement==null)
return;this.betTypes=new Hash();this.sortedBetTypes=new Array();this.providerMap=new Hash();},addBetType:function(jsRowId,betTypeRow){this.betTypes.set(jsRowId,betTypeRow);if(!$defined($(jsRowId)))
this.topElement.appendChild(betTypeRow.topElement);this.sortedBetTypes.push(betTypeRow);betTypeRow.rowIndex=-1;},sort:function(a,b){var name1=a.betTypeName;var name2=b.betTypeName;if(name1==name2)return 0;if(name1<name2)return-1;return 1;},sortBetTypes:function(){if(this.sortedBetTypes.length<1)
return;var firstRow=this.sortedBetTypes[0].topElement;var beforeSortingArray=$A(this.sortedBetTypes);var nrOfRows=beforeSortingArray.length;for(var i=0;i<nrOfRows;i++){beforeSortingArray[i].rowIndex=i;}
this.sortedBetTypes.sort(this.sort);var nrOfRows=this.sortedBetTypes.length;var color='even';for(var i=0;i<nrOfRows;i++){var rowObj=this.sortedBetTypes[i];var row=this.sortedBetTypes[i].topElement;if(rowObj.rowIndex==i){continue;}
if(i==0){row.injectBefore(firstRow);}
else{var afterRow=this.sortedBetTypes[i-1].topElement;row.injectAfter(afterRow);}
for(var j=i;j<rowObj.rowIndex&&j<beforeSortingArray.length;j++){beforeSortingArray[j].rowIndex=beforeSortingArray[j].rowIndex++;}}
for(var i=0;i<nrOfRows;i++){var rowObj=this.sortedBetTypes[i];rowObj.rowIndex=i;rowObj.sortOutcomes();var childrens=rowObj.olElement.getChildren();for(var j=0;j<childrens.length;j++){rowObj.olElement.removeChild(childrens[j]);}
var row=this.sortedBetTypes[i].topElement;for(var oIdx=0;oIdx<rowObj.outcomeRows.length;oIdx++){rowObj.outcomeRows[oIdx].topElement.injectAfter(oIdx==0?row:rowObj.outcomeRows[oIdx-1].topElement);if($defined(rowObj.outcomeRows[oIdx].topElement2)){rowObj.outcomeRows[oIdx].topElement2.addClass("hidden");rowObj.olElement.appendChild(rowObj.outcomeRows[oIdx].topElement2);if(oIdx<3)
rowObj.outcomeRows[oIdx].topElement2.removeClass("hidden");if(oIdx==rowObj.outcomeRows.length-1&&rowObj.outcomeRows.length<=2)
rowObj.outcomeRows[oIdx].topElement2.addClass("middle");else
rowObj.outcomeRows[oIdx].topElement2.removeClass("middle");}}}},updateOutcome:function(jsRowId,outcomeId,maxOdds,wholeLine){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.updateOutcome(outcomeId,maxOdds,wholeLine);},createOutcome:function(jsRowId,outcomeId,outcomeSEId,outcomeName,outcomeShrtName,outcomePos,probability,maxOdds,shouldBlink,wholeLine){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.addOutcomeRow(outcomeId,outcomeSEId,outcomeName,outcomeShrtName,outcomePos,probability,maxOdds,shouldBlink,wholeLine);},addMoreOutcome:function(jsRowId,outcomeId,moreText){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.addMoreOutcome(outcomeId,moreText);},deleteOutcome:function(jsRowId,outcomeId){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.removeOutcome(outcomeId);},deleteMoreOutcome:function(jsRowId){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.deleteMoreOutcome();},addNewBetType:function(jsRowId,betTypeName,groupParam,betTypeLinkText,initialDisplayed,nrOfProviders,hasFixedOutcomes){var row=new BetTypeRow(jsRowId,betTypeName,groupParam,betTypeLinkText,initialDisplayed,nrOfProviders,hasFixedOutcomes);this.addBetType(jsRowId,row);row.blinkHeaderName();},updateGroup:function(jsRowId,groupValue){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.updateGroup(groupValue);},deleteBetType:function(jsRowId){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;this.betTypes.erase(jsRowId);betType.empty();var idx=-1;var nrOfRows=this.sortedBetTypes.length;for(var i=0;i<nrOfRows;i++)
if(this.sortedBetTypes[i].jsRowId==jsRowId){idx=i;break;}
this.sortedBetTypes.splice(idx,1);},addProviderToOutcome:function(jsRowId,outcomeId,providerId,link,boId){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.addProviderToOutcome(outcomeId,providerId,link,boId);},deleteProviderFromOutcome:function(jsRowId,outcomeId,providerId){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.deleteProviderFromOutcome(outcomeId,providerId);},updateNrOfProviders:function(jsRowId,newNr){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.updateNrOfProviders(newNr);},updateProb:function(jsRowId,outcomeId,newProbability){var betType=this.betTypes.get(jsRowId);if(betType==null)
return;betType.updateProbability(outcomeId,newProbability);},reIndex:function(){this.sortBetTypes();},checkSum:function(){var checkSum='nrB`'+this.sortedBetTypes.length;var nrOfRows=this.sortedBetTypes.length;for(var i=0;i<nrOfRows;i++){checkSum+='`'+this.sortedBetTypes[i].jsRowId;checkSum+='`'+this.sortedBetTypes[i].outcomeRows.length;}
return checkSum;}});var BetTypeRow=new Class({initialize:function(jsRowId,betTypeName,group,betTypeLinkText,isDisplayed,nrOfProviders,hasFixedOutcomes){this.jsRowId=jsRowId;this.isDisplayed=isDisplayed;this.betTypeName=betTypeName;this.hasFixedOutcomes=hasFixedOutcomes;this.group=group;this.outcomes=new Hash();this.outcomeRows=new Array();this.topElement=$(jsRowId);this.nrOfProviders=nrOfProviders;if(this.topElement==null){this.topElement=matchConstants.oddsRow.cloneNode(false);this.topElement.addClass('headerRow');var betTypeCell=matchConstants.betTypeCell.cloneNode(false);betTypeCell.setProperty('colSpan',4);var div=matchConstants.divBetType.cloneNode(false);var imgCollapseExpand=$(matchConstants.moreImg.cloneNode(false));imgCollapseExpand.set('title',bbGlobal.txtCollapse);if(isDisplayed){imgCollapseExpand=$(matchConstants.hideImg.cloneNode(false));imgCollapseExpand.set('title',bbGlobal.txtExpand);}
imgCollapseExpand.set('id','img'+jsRowId).addClass('matchImgExpande');imgCollapseExpand.addEvent('click',function(item){this.toogleOutcomes(item)}.bind(this));div.appendChild(imgCollapseExpand);this.betTypeLink=matchConstants.betTypeLink.cloneNode(false);this.betTypeLink.set('href',betTypeLinkText).set('html',betTypeName);this.betTypeLink.addEvent('click',function(){return loadAPage(this.get('href'));}.bind(this.betTypeLink));div.appendChild(this.betTypeLink);if(group!=""){this.groupEl=new Element('span');this.groupEl.set('html'," "+this.group);this.groupEl.inject(this.betTypeLink,'after');}
var aux=new Element('span',{'class':'containerProv'});this.nrOfProvidersNode=new Element('span',{'class':'nrProv'});aux.appendChild(document.createTextNode(" ("));this.nrOfProvidersNode.set('html',nrOfProviders);aux.appendChild(this.nrOfProvidersNode);aux.appendChild(document.createTextNode(")"));div.appendChild(aux);betTypeCell.appendChild(div);this.olElement=matchConstants.ol.cloneNode(false);betTypeCell.appendChild(this.olElement);if(this.isDisplayed)
this.olElement.addClass("hidden");this.topElement.appendChild(betTypeCell);}
else{this.olElement=this.topElement.getElements('ol')[0];var imgCollapseExpand=$('img'+jsRowId);imgCollapseExpand.addEvent('click',function(item){this.toogleOutcomes(item)}.bind(this));this.betTypeLink=this.topElement.getElements('a')[0];this.nrOfProvidersNode=this.topElement.getElements('span[class="nrProv"]')[0];if(group!=""){this.groupEl=this.topElement.getElements('span[class="group"]')[0];}}},toogleOutcomes:function(item){var img=$(item.target);if(img.get('src').indexOf("/gfx/image/more.gif")>-1){img.set('src',bbGlobal.gfxServer+'/gfx/image/hide.gif');img.set('title',bbGlobal.txtCollapse);var nrOfRows=this.outcomeRows.length;for(var i=0;i<nrOfRows;i++){this.outcomeRows[i].topElement.removeClass('hidden');}
this.isDisplayed=true;this.olElement.addClass("hidden");changeBetTypeSelection(this.jsRowId,'add');}
else{img.set('src',bbGlobal.gfxServer+'/gfx/image/more.gif');img.set('title',bbGlobal.txtExpand);var nrOfRows=this.outcomeRows.length;for(var i=0;i<nrOfRows;i++){this.outcomeRows[i].topElement.addClass('hidden');}
this.isDisplayed=false;this.olElement.removeClass("hidden");changeBetTypeSelection(this.jsRowId,'remove');}},updateGroup:function(newGroupValue){if($defined(this.groupEl.get('tween')))
this.groupEl.get('tween').cancel();this.group=newGroupValue;this.groupEl.set('html'," "+newGroupValue);var x=0;var tween=this.groupEl.get('tween',{property:'opacity',duration:'normal',onComplete:function(){if(x==11)
return;if(x%2==0)
tween.start(1);else
tween.start(0);x++;},onCancel:function(){this.element.setStyle('opacity',1);}});tween.start(1);},blinkHeaderName:function(){if($defined(this.betTypeLink.get('tween')))
this.betTypeLink.get('tween').cancel();var x=0;var tween=this.betTypeLink.get('tween',{property:'opacity',duration:'normal',onComplete:function(){if(x==11){this.element.setStyle('opacity',1);return;}
if(x%2==0)
tween.start(1);else
tween.start(0);x++;},onCancel:function(){this.element.setStyle('opacity',1);}});tween.start(1);},updateProbability:function(outcomeId,newProbability){var outcomeRow=this.outcomes.get(outcomeId);if(outcomeRow==null)
return;outcomeRow.updateProbability(newProbability);},addOutcome:function(outcomeId,outcomeRow){if(this.outcomes.has(outcomeId))
return;this.outcomes.set(outcomeId,outcomeRow);outcomeRow.topElement.injectAfter(this.outcomeRows.length==0?this.topElement:this.outcomeRows[this.outcomeRows.length-1].topElement);if($defined(outcomeRow.topElement2))
this.olElement.appendChild(outcomeRow.topElement2);this.outcomeRows.push(outcomeRow);},removeOutcome:function(outcomeId){var outcomeRow=this.outcomes.get(outcomeId);if(outcomeRow==null)
return;this.outcomes.erase(outcomeId);outcomeRow.topElement.destroy();if($defined(outcomeRow.topElement2))
outcomeRow.topElement2.destroy();var idx=-1;var nrOfRows=this.outcomeRows.length;for(var i=0;i<nrOfRows;i++)
if(this.outcomeRows[i].outcomeId==outcomeId){idx=i;break;}
this.outcomeRows.splice(idx,1);},empty:function(){this.outcomes.empty();var nrOfRows=this.outcomeRows.length;for(var i=0;i<nrOfRows;i++){this.outcomeRows[i].topElement.destroy();}
this.topElement.destroy();},updateOutcome:function(outcomeId,maxOdds,wholeLine){var outcomeRow=this.outcomes.get(outcomeId);if(outcomeRow==null)
return;outcomeRow.update(parseFloat(maxOdds),wholeLine);},addOutcomeRow:function(outcomeId,outcomeSEId,outcomeName,outcomeShrtName,outcomePos,probability,maxOdds,shouldBlink,wholeLine){var row=new OutcomeRow(this,outcomeId,outcomeSEId,outcomeName,outcomeShrtName,outcomePos,parseFloat(probability),parseFloat(maxOdds));for(var i=10;i<wholeLine.length;i+=3)
row.addProvider(wholeLine[i],wholeLine[i+1],wholeLine[i+2]);this.addOutcome(outcomeId,row);if(shouldBlink){if(row.blinkFinished)
row.bgColor="#FFFFFF";row.shouldBlink=true;row.blinkblink();}},addProviderToOutcome:function(outcomeId,providerId,link,boId){var outcomeRow=this.outcomes.get(outcomeId);if(outcomeRow==null)
return;outcomeRow.addProvider(providerId,link,boId);},deleteProviderFromOutcome:function(outcomeId,providerId){var outcomeRow=this.outcomes.get(outcomeId);if(outcomeRow==null)
return;outcomeRow.removeProvider(providerId);},updateNrOfProviders:function(newNr){if(this.nrOfProviders==newNr)
return;if($defined(this.provEffect1))
clearTimeout(this.provEffect1);if($defined(this.provEffect2))
clearTimeout(this.provEffect2);this.nrOfProvidersNode.removeClass("backImg");this.nrOfProvidersNode.setStyle('background-image','url('+matchConstants.spcArrowImgSrc+')');if(this.nrOfProviders<newNr){this.nrOfProvidersNode.addClass("backImg");this.nrOfProvidersNode.set('html',newNr);this.arrowImg1=matchConstants.upArrowImgSrcAnimated;this.arrowImg2=matchConstants.upArrowImgSrc;this.nrOfProvidersNode.setStyle('background-image','url('+this.arrowImg1+')');this.topElement.store('obj',this);this.provEffect1=setTimeout('changeBlinkProv("'+this.jsRowId+'")',5000);}
else if(this.nrOfProviders>newNr){this.nrOfProvidersNode.addClass("backImg");this.nrOfProvidersNode.set('html',newNr);this.arrowImg1=matchConstants.downArrowImgSrcAnimated;this.arrowImg2=matchConstants.downArrowImgSrc;this.nrOfProvidersNode.setStyle('background-image','url('+this.arrowImg1+')');this.topElement.store('obj',this);this.provEffect1=setTimeout('changeBlinkProv("'+this.jsRowId+'")',5000);}
this.nrOfProviders=newNr;},addMoreOutcome:function(outcomeId,moreText){this.addOutcomeRow(outcomeId,null,moreText,moreText,-1,0,0,false,[]);},deleteMoreOutcome:function(outcomeId){this.removeOutcome(outcomeId);},sortByPosition:function(outcome1,outcome2){if(outcome1.position<outcome2.position)
return-1;if(outcome1.position>outcome2.position)
return 1;return 0;},sortByMaxOdds:function(outcome1,outcome2){if(outcome1.maxOdds==0)
return 1;if(outcome2.maxOdds==0)
return-1;if(outcome1.maxOdds<outcome2.maxOdds)
return-1;if(outcome1.maxOdds>outcome2.maxOdds)
return 1;if(outcome1.outcomeName>outcome2.outcomeName)
return 1;if(outcome1.outcomeName<outcome2.outcomeName)
return-1;return 0;},sortOutcomes:function(){if(this.hasFixedOutcomes){this.outcomeRows.sort(this.sortByPosition);}
else{this.outcomeRows.sort(this.sortByMaxOdds);}},formatOdds:function(){var length=this.outcomeRows.length;for(var i=0;i<length;i++){this.outcomeRows[i].formatOdds();}}});function changeToDefaultStyleNrOfProviders(span){span.removeClass("bold");}
var OutcomeRow=new Class({initialize:function(betType,outcomeId,outcomeSEId,outcomeName,outcomeShrtName,outcomePos,probability,maxOdds){this.betType=betType;this.outcomeId=outcomeId;this.position=parseInt(outcomePos);this.outcomeSEId=outcomeSEId;this.maxOdds=maxOdds;this.outcomeName=outcomeName;this.outcomeShrtName=outcomeShrtName;this.providers=new Hash();this.shownProviders=new Hash();this.topElement=$(outcomeId);this.topElement2=$('li'+outcomeId);if($defined(this.topElement2)){this.oddsCell2=this.topElement2.getElements('span')[0];}
if($defined(this.topElement)){var tdLst=this.topElement.getElements('td');this.outcomeCell=tdLst[0];if(tdLst.length>1){this.oddsCell=tdLst[1];this.oddsCell.set('id',this.outcomeId+'o');this.providersCell=tdLst[3];this.probability=probability;if(probability!=0)
this.probabilityEl=this.outcomeCell.getElements('span')[0];}
return;}
this.topElement=matchConstants.oddsRow.cloneNode(false);if(!betType.isDisplayed)
this.topElement.addClass('hidden');this.outcomeCell=matchConstants.outcomeCell.cloneNode(false);html=outcomeName;this.probabilityEl=null;this.outcomeCell.set('html',html);this.topElement.appendChild(this.outcomeCell);if(maxOdds!=0&&probability!=0){this.probabilityEl=matchConstants.probabilityCell.cloneNode(false);this.probability=(probability*100).toFixed(0);this.probabilityEl.set('html',this.probability+"%");this.outcomeCell.appendChild(this.probabilityEl);}
if($defined(this.outcomeSEId)&&this.outcomeSEId!=null&&this.outcomeSEId!=''){this.outcomeCell.appendChild(document.createTextNode(" ("+this.outcomeSEId+")"));}
this.topElement2=matchConstants.li.cloneNode(false);this.topElement2.set('id','li'+this.outcomeId);this.topElement2.appendChild(document.createTextNode(this.outcomeShrtName+':'));this.oddsCell2=matchConstants.span.cloneNode(false);this.topElement2.appendChild(this.oddsCell2);this.oddsCell=matchConstants.oddsCell.cloneNode(false);this.oddsCell.set('id',this.outcomeId+'o');if(maxOdds!=0){this.oddsCell.set('html',(showOddsInProperCurrency(maxOdds)));this.oddsCell2.set('html',(showOddsInProperCurrency(maxOdds)));}
this.providersCell=matchConstants.providersCell.cloneNode(false);this.topElement.appendChild(this.oddsCell);var tdarond=matchConstants.tdarond.cloneNode(false);if(this.maxOdds!=0)
tdarond.set("html","@");this.topElement.appendChild(tdarond);this.topElement.set('id',outcomeId);this.topElement.set('name',betType.jsRowId);this.topElement.appendChild(this.providersCell);this.shouldBlink=false;this.blinkFinished=true;},blinkblink:function(){if(this.shouldBlink&&this.blinkFinished){this.blinkFinished=false;this.myFx=new Fx.Tween(this.topElement,{duration:6000,onComplete:function(){if(this.topElement==null)
return;new Fx.Tween(this.topElement,{duration:6000,onComplete:function(){if(this.topElement==null)
return;this.blinkFinished=true;this.shouldBlink=false;this.topElement.removeProperty('style');}.bind(this)}).start('background-color',this.bgColor);}.bind(this)});this.myFx.start('background-color','#FFF8C6');}},addProvider:function(providerId,oddsLink,boId){if(!this.providers.has(providerId))
this.providers.set(providerId,new MatchProvider(providerId,oddsLink,boId,this));},removeProvider:function(pId){this.providers.erase(pId);var provider=this.shownProviders.get(pId);this.shownProviders.erase(pId);if(provider!=null){provider.topElement.destroy();if($defined(provider.boHTML))
provider.boHTML.destroy();}
if(this.shownProviders.getLength()<4&&this.providers.getLength()>4){var providerIds=this.providers.getKeys();for(var i=0;i<providerIds.length;i++){if(this.shownProviders.has(providerIds[i]))
continue;this.providers.get(providerIds[i]).makeItVisible();if(this.shownProviders.getLength()==4)
break;}}},updateProbability:function(newProbability){var newProb=(newProbability*100).toFixed(0);if(newProb==this.probability)
return;if($defined(this.x))
clearTimeout(this.x);if($defined(this.y))
clearTimeout(this.y);if(newProbability==0){if($defined(this.probabilityEl)){this.probabilityEl.destroy();this.probabilityEl=null;}
this.probability=0;return;}
var currentProb=0;if(!$defined(this.probabilityEl)){this.probabilityEl=matchConstants.probabilityCell.cloneNode(false);this.outcomeCell.appendChild(this.probabilityEl);}
else{currentProb=this.probability;this.probabilityEl.setStyle('background-image','url('+matchConstants.spcArrowImgSrc+')');}
this.probability=newProb;this.probabilityEl.set('html',this.probability+"%");this.probabilityEl.set('id',this.outcomeId+"p");if(newProb>currentProb){this.arrowImg1=matchConstants.upArrowImgSrcAnimated;this.arrowImg2=matchConstants.upArrowImgSrc;this.probabilityEl.setStyle('background-image','url('+this.arrowImg1+')');this.probabilityEl.store('obj',this);this.x=setTimeout('changeBlink("'+this.outcomeId+'p")',5000);}
else if(newProb<currentProb){this.arrowImg1=matchConstants.downArrowImgSrcAnimated;this.arrowImg2=matchConstants.downArrowImgSrc;this.probabilityEl.setStyle('background-image','url('+this.arrowImg1+')');this.probabilityEl.store('obj',this);this.x=setTimeout('changeBlink("'+this.outcomeId+'p")',5000);}},update:function(maxOdds,wholeLine){if($defined(this.oddsEffect))clearTimeout(this.oddsEffect);if($defined(this.oddsStillEffect))clearTimeout(this.oddsStillEffect);this.oddsCell.set('html',showOddsInProperCurrency(parseFloat(maxOdds)));if(maxOdds>this.maxOdds){this.arrowImgOdds1=matchConstants.upArrowImgSrcAnimated;this.arrowImgOdds2=matchConstants.upArrowImgSrc;this.oddsCell.setStyle('background-image','url('+this.arrowImgOdds1+')');this.oddsCell.store('obj',this);this.oddsEffect=setTimeout('changeOddsBlink("'+this.outcomeId+'o")',5000);}
else if(maxOdds<this.maxOdds){this.arrowImgOdds1=matchConstants.downArrowImgSrcAnimated;this.arrowImgOdds2=matchConstants.downArrowImgSrc;this.oddsCell.setStyle('background-image','url('+this.arrowImgOdds1+')');this.oddsCell.store('obj',this);this.oddsEffect=setTimeout('changeOddsBlink("'+this.outcomeId+'o")',5000);}
var providerCells=this.providers.getValues();for(var i=0;i<providerCells.length;i++){var matchProvider=providerCells[i];matchProvider.topElement.destroy();if($defined(matchProvider.boHTML)){matchProvider.boHTML.destroy();}}
this.providers.empty();this.shownProviders.empty();for(var i=4;i<wholeLine.length;i+=3)
this.addProvider(wholeLine[i],wholeLine[i+1],wholeLine[i+2]);if($defined(this.oddsEffect2))clearTimeout(this.oddsEffect2);if($defined(this.oddsStillEffect2))clearTimeout(this.oddsStillEffect2);this.oddsCell2.set('html',showOddsInProperCurrency(parseFloat(maxOdds)));if(maxOdds>this.maxOdds){this.arrowImgOddsLI1=matchConstants.upArrowImgSrcAnimated;this.arrowImgOddsLI2=matchConstants.upArrowImgSrc;this.oddsCell2.setStyle('background-image','url('+this.arrowImgOddsLI1+')');this.topElement2.store('obj',this);this.oddsEffect2=setTimeout('changeOddsBlinkLI("li'+this.outcomeId+'")',5000);}
else if(maxOdds<this.maxOdds){this.arrowImgOddsLI1=matchConstants.downArrowImgSrcAnimated;this.arrowImgOddsLI2=matchConstants.downArrowImgSrc;this.oddsCell2.setStyle('background-image','url('+this.arrowImgOddsLI1+')');this.topElement2.store('obj',this);this.oddsEffect2=setTimeout('changeOddsBlinkLI("li'+this.outcomeId+'")',5000);}
this.maxOdds=maxOdds;},formatOdds:function(){if(!$defined(this.oddsCell))
return;this.oddsCell.set('html',showOddsInProperCurrency(parseFloat(this.maxOdds)));this.oddsCell2.set('html',showOddsInProperCurrency(parseFloat(this.maxOdds)));},});function changeBlinkProv(elemId){var betTypeRow=$(elemId);if(!$defined(betTypeRow))
return;var betTypeRowObj=betTypeRow.retrieve('obj');if($defined(betTypeRowObj)&&$defined(betTypeRowObj.arrowImg2)){betTypeRowObj.nrOfProvidersNode.setStyle('background-image','url('+betTypeRowObj.arrowImg2+')');betTypeRowObj.provEffect2=setTimeout('hideArrowProv("'+elemId+'")',6000);}}
function hideArrowProv(elemId){var betTypeRow=$(elemId);if(!$defined(betTypeRow))
return;var betTypeRowObj=betTypeRow.retrieve('obj');if($defined(betTypeRowObj)){betTypeRowObj.nrOfProvidersNode.removeProperty("style");betTypeRowObj.nrOfProvidersNode.removeClass("backImg");}}
function changeBlink(elemId){var probabilityEl=$(elemId);if(!$defined(probabilityEl))
return;var probabilityObj=probabilityEl.retrieve('obj');if($defined(probabilityObj)&&$defined(probabilityObj.arrowImg2)){probabilityEl.setStyle('background-image','url('+probabilityObj.arrowImg2+')');probabilityObj.y=setTimeout('hideArrow("'+elemId+'")',60000);}}
function changeOddsBlink(elemId){var oddsCell=$(elemId);if(!$defined(oddsCell))
return;var oddsObj=oddsCell.retrieve('obj');if($defined(oddsObj)&&$defined(oddsObj.arrowImgOdds2)){oddsCell.setStyle('background-image','url('+oddsObj.arrowImgOdds2+')');oddsObj.oddsStillEffect=setTimeout('hideArrow("'+elemId+'")',60000);}}
function changeOddsBlinkLI(elemId){var oddsCell=$(elemId);if(!$defined(oddsCell))
return;var oddsObj=oddsCell.retrieve('obj');if($defined(oddsObj)&&$defined(oddsObj.arrowImgOddsLI2)){oddsObj.oddsCell2.setStyle('background-image','url('+oddsObj.arrowImgOddsLI2+')');oddsObj.oddsStillEffect2=setTimeout('hideArrowLI("'+elemId+'")',60000);}}
function hideArrowLI(elemId){var oddsCellLI=$(elemId);if(!$defined(oddsCellLI))
return;var oddsObj=oddsCellLI.retrieve('obj');if($defined(oddsObj)){oddsObj.oddsCell2.setStyle('background-image','url('+matchConstants.spcArrowImgSrc+')');}}
function hideArrow(elemId){var probabilityEl=$(elemId);if(!$defined(probabilityEl))
return;var probabilityObj=probabilityEl.retrieve('obj');if($defined(probabilityEl)){probabilityEl.setStyle('background-image','url('+matchConstants.spcArrowImgSrc+')');}}
function applyBlinkEffect(element){var myFxOdds=new Fx.Tween(element,{duration:500});var on=function(){myFxOdds.start('color','#ffffff',naturalColor)}.bind(element);var off=function(){myFxOdds.start('color',naturalColor,'#ffffff')}.bind(element);myFxOdds.start('color',naturalColor,'#ffffff').chain(on).chain(off).chain(on).chain(off).chain(on).chain(off).chain(on).chain(off).chain(on);}
var MatchProvider=new Class({initialize:function(pId,oddsLink,boId,row){this.row=row;this.boId=boId;this.topElement=$(row.outcomeId+pId);if(this.topElement!=null){if($defined(this.boId)&&this.boId!=null&&this.boId!=''){this.boHTML=this.topElement.getElements('span')[0];}
return;}
this.topElement=new Element('span');this.topElement.set('id',row.outcomeId+pId);var aLink=matchConstants.aLink.cloneNode(false);aLink.set('href',oddsLink).set("target","_blank");if(bbGlobal.isBOV){aLink.set('html',matchTableModel.providerMap.get(pId).name);}
else{var img=$(matchConstants.imgProvider.cloneNode(false));img.setAttribute('src','http://gfx.betbrain.com/gfx/pics/bookielogos/'+pId+'.gif');img.setAttribute('alt',matchTableModel.providerMap.get(pId).name);img.inject(aLink);}
this.topElement.appendChild(aLink);if($defined(this.boId)&&this.boId!=null&&this.boId!=''){this.boHTML=new Element('span');this.boHTML.set('html','('+this.boId+')');this.topElement.appendChild(this.boHTML);}
this.makeItVisible(pId);},makeItVisible:function(pId){if(this.row.shownProviders.getLength()<4){this.row.shownProviders.set(pId,this);this.row.providersCell.appendChild(this.topElement);if($defined(this.boId)&&this.boId!=null&&this.boId!=''){this.row.providersCell.appendChild(this.boHTML);}}}});function processMatchUpdate(chunk){if(chunk.length<2){return 0;}
if(chunk.indexOf('reloadOddsTable')!=-1){reloadPage();return-1;}
var items=chunk.split("\r\n");var isRTFMessage=false;var nrOfItems=items.length;var globalCheckSum=null;try{for(var i=0;i<nrOfItems;i++){if(items[i].length>0){var tokens=items[i].split('`');if(tokens[0]=='updateOutcome'){matchTableModel.updateOutcome(tokens[1],tokens[2],tokens[3],tokens);}
else if(tokens[0]=='delOutcome'){matchTableModel.deleteOutcome(tokens[1],tokens[2]);}
else if(tokens[0]=='newOutcome'){matchTableModel.createOutcome(tokens[1],tokens[2],tokens[3],tokens[4],tokens[5],parseInt(tokens[6]),tokens[7],tokens[8],true,tokens);}
else if(tokens[0]=='newBetType'){matchTableModel.addNewBetType(tokens[1],tokens[2],tokens[3],tokens[4],tokens[5]=='true',tokens[6],tokens[7]=='true');}
else if(tokens[0]=='delBetType'){matchTableModel.deleteBetType(tokens[1]);}
else if(tokens[0]=='addProv'){matchTableModel.addProviderToOutcome(tokens[1],tokens[2],tokens[3],tokens[4],tokens[5]);}
else if(tokens[0]=='delProv'){matchTableModel.deleteProviderFromOutcome(tokens[1],tokens[2],tokens[3]);}
else if(tokens[0]=='updateNrP'){matchTableModel.updateNrOfProviders(tokens[1],parseInt(tokens[2]));}
else if(tokens[0]=='addMore'){matchTableModel.addMoreOutcome(tokens[1],tokens[2],tokens[3]);}
else if(tokens[0]=='updateGroup'){matchTableModel.updateGroup(tokens[1],tokens[2]);}
else if(tokens[0]=='updateProb'){matchTableModel.updateProb(tokens[1],tokens[2],parseFloat(tokens[3]));}
else if(tokens[0]=='updateScore'){updateTimeAndScore(tokens[1]);}
else if(tokens[0]=='checkSum'){globalCheckSum=items[i].substring(9,items[i].length);}
else if(tokens[0]=='newStatus'){var divLiveBookie=$('content').getElements('div.liveOfferingBookie');if($defined(divLiveBookie)&&divLiveBookie.length>0)
divLiveBookie[0].destroy();var liveCov=$('content').getElements('span.liveCoverage');if($defined(liveCov)&&liveCov.length>0)
liveCov[0].destroy();if(!$('eventScore').getPrevious().hasClass('liveHeader'))
matchConstants.liveSpan.cloneNode(true).inject($('eventScore'),'before');}}}
matchTableModel.reIndex();var checkSum=matchTableModel.checkSum();if(globalCheckSum!=checkSum){reloadPage();}}
catch(e){var errmsg='';if(Browser.Engine.name=='trident'){errmsg="Error name: "+e.name+". \nError description: "+e.description+". \nError number: "+(e.number&0xffff)+". \nError message: "+e.message;}
else{errmsg='<b>'+e+' at line '+e.lineNumber+'; in file '+e.fileName+'</b> '+e.stack;}
errReporterSessionSocket.sendRequest('mess=reqId::'+requestId+'~~jSessionId::'+jSessionId+'~~'+window.navigator.userAgent+'~~'+window.location.href+'~~'+errmsg);reloadPage();return-1;}
return 0;}
function updateTimeAndScore(newTimeAndScore){var oldTimeAndScore=$('score').innerHTML.trim();if(oldTimeAndScore==""){var newScore=newTimeAndScore.substring(newTimeAndScore.indexOf('('),newTimeAndScore.length);var newTime=newTimeAndScore.substring(0,newTimeAndScore.indexOf('('));$('score').set('html',newScore);$('time').set('html',newTime);if($defined($('score').get('tween')))
$('score').get('tween').cancel();var x=0;var tween=$('score').get('tween',{property:'opacity',duration:'normal',onComplete:function(){if(x==11)
return;if(x%2==0)
tween.start(1);else
tween.start(0);x++;},onCancel:function(){this.element.setStyle('opacity',1);}});tween.start(1);}
else{var oldScore=oldTimeAndScore.substring(oldTimeAndScore.indexOf('('),oldTimeAndScore.length);var newScore=newTimeAndScore.substring(newTimeAndScore.indexOf('('),newTimeAndScore.length);var newTime=newTimeAndScore.substring(0,newTimeAndScore.indexOf('('));$('score').set('html',newScore);$('time').set('html',newTime);if(oldScore!=newScore){if($defined($('score').get('tween')))
$('score').get('tween').cancel();var x=0;var tween=$('score').get('tween',{property:'opacity',duration:'normal',onComplete:function(){if(x==11)
return;if(x%2==0)
tween.start(1);else
tween.start(0);x++;},onCancel:function(){this.element.setStyle('opacity',1);}});tween.start(1);soundPlayer.playSound('newGoal');}}}
