var ALTRI = 1; var CALCIO = 2; var SORTEGGIO = 3; var MINUTOPERMINUTO = 1; var TABELLINO = 2; var STATISTICHE = 3; var countADVRS=0; var objInitLiveMatch = false; try{ var lenArrADV = _nameArray.length; } catch(e) { var _nameArray = new Array(); _nameArray[0]="adv7"; _nameArray[1]="adv1"; _nameArray[2]="manchette"; } String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } LiveMatch = function(urlJSON, timeout, timestamp, type) { objInitLiveMatch = true; this.url = urlJSON; this.timeout = timeout; this.timestamp = null; this.countADVRS = 0; this.numGoals = 3; this.type = type; this.curTimeout = null; this.objCommentario = null; var objCommentario; try{objCommentario = objLiveCommentario;}catch(e){} if (objCommentario != undefined) this.objCommentario = objCommentario; this.setTimeoutJSON(); } LiveMatch.prototype = { createObjAJAX : function (){ if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { return new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ return new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false; }, loadJSON : function (){ if (this.curTimeout != null) clearTimeout(this.curTimeout); var page_request = this.createObjAJAX(); try { var objRequest = this; var returns = function(){return objRequest.onChangeJSON(page_request);}; page_request.onreadystatechange = returns; page_request.open('GET', this.url + '?bust=' + Math.floor(1000000 * Math.random()), true) //get page synchronously page_request.send(null); } catch(e){} }, onChangeJSON : function (page_request){ if (page_request.readyState == 4) { if (page_request.status == 200) { var dataList; try{dataList = page_request.responseText}catch(e){this.setTimeoutJSON();return false;} dataList = dataList.replace(/\n/g,""); dataList = dataList.replace(/\r/g,""); dataList = dataList.replace(/\t/g,""); dataList = dataList.replace(/:,/g,":'',"); dataList = dataList.replace(/ /g,""); dataList = dataList.trim(); if (dataList != "") { var objDataList; try{objDataList = eval('(' +dataList + ')');}catch(e){this.setTimeoutJSON();return false;} if (this.type != SORTEGGIO) { this.displayDataMatch(objDataList); //this.timestamp = objDataList.ts; this.timeout = objDataList.r; } else { this.displayDataDraw(objDataList); this.timeout = objDataList.refresh; } } if (this.objCommentario != null) { if ((this.objCommentario.url!=null)&&(this.objCommentario.url!=undefined)) this.objCommentario.loadHTML(); } this.setTimeoutJSON(); this.reloadADVandRS(); } page_request=false; } }, reloadADVandRS : function() { if (this.countADVRS!=countADVRS) { this.countADVRS ++; return false; } countADVRS ++; this.countADVRS ++; try { RedSheriffCounter.RedSheriffCounter("it_Matrix-it_0", document.location.href, true, RedSheriffCounter.TIMEOUT_INSTANTLY); RedSheriffCounter.start(); reloadADV(); } catch(e){} }, displayDataDraw : function(objData){ var numMatches = objData.partite.length; if (numMatches > 0) { var dataandata = false; var dataritorno = false; var bodydiv = ''; for (i=0;i'; arrTD[i].innerHTML = valore; } } } break; } }, setTimeoutJSON : function(){ if (this.timeout != 0) { var objRequest = this; var returns = function(){return objRequest.loadJSON();}; this.curTimeout = setTimeout(returns, (this.timeout * 1000)); } }, cancellaDatiGiocatore : function(numGol1, numGol2, idMatch) { var objTDDel, objTDs; var objTable = document.getElementById("m" + idMatch); for (gK1=numGol1;gK1<=this.numGoals;gK1++) { objTDs = objTable.getElementsByTagName("TD"); objTDDel=null; for (k=0;kthis.numGoals) this.numGoals = arrGiocatore.length; for (k=0;kVAI' if (idTD.indexOf(giocatoreType + "_") != -1) { if (idTD.indexOf(tagGiocatore) != -1) { arrTD[i].innerHTML = "" + minutoGiocatore + "'  " + nomeGiocatore + linkGol; if (giocatoreType == "g1") arrTD[i].className = "marcatore right"; if (giocatoreType == "g2") arrTD[i].className = "marcatore"; blnGiocatoreTrovato = true; break; } } } if (blnGiocatoreTrovato == false) { var elementTR = document.createElement("TR"); elementTR.id = "g" + k; var elementTD1 = document.createElement("TD"); elementTD1.id = "g1_" + (k + 1); elementTD1.colSpan = "2"; if (giocatoreType == "g1") { elementTD1.className = "marcatore right"; elementTD1.innerHTML = "" + minutoGiocatore + "'  " + nomeGiocatore + linkGol; } else elementTD1.innerHTML = ""; elementTR.appendChild(elementTD1); var elementTDSpazio = document.createElement("TD"); elementTDSpazio.innerHTML = " "; elementTR.appendChild(elementTDSpazio); var elementTD2 = document.createElement("TD"); elementTD2.id = "g2_" + (k + 1); elementTD2.colSpan = "2"; if (giocatoreType == "g2") { elementTD2.className = "marcatore"; elementTD2.innerHTML = "" + minutoGiocatore + "'  " + nomeGiocatore + linkGol; } else elementTD2.innerHTML = ""; elementTR.appendChild(elementTD2); objTable.getElementsByTagName('TBODY')[0].appendChild(elementTR); } } } } LiveMatchCommentario = function(urlHTML, timeout, timestamp, idDiv) { this.url = urlHTML; this.timeout = timeout; this.timestamp = null; this.idDiv = idDiv; this.curTimeout = null; this.iLoad=0; this.span1 = 'Minuto per minuto'; this.span2 = 'Tabellino'; this.span3 = 'Statistiche'; this.a1 = urlHTML; this.a2 = null; this.a3 = null; if (this.timeout != null) this.setTimeoutHTML(); } LiveMatchCommentario.prototype = { initComponent : function(urlHTML, timeout, timestamp, idDiv) { this.url = urlHTML; this.timeout = timeout; //this.timestamp = timestamp; this.idDiv = idDiv; this.a1 = urlHTML; this.a2 = null; this.a3 = null; this.typeData = MINUTOPERMINUTO; this.allComments=false; if (objInitLiveMatch==false) this.setTimeoutHTML(); }, openComments : function (strTextOpen, strTextClose){ this.allComments=true; var objComments = document.getElementsByTagName("LI"); for (var kL=0; kL'+strTextClose+' Chiudi il commento completo'; else document.getElementById("displayResultsComments").innerHTML = 'Chiudi il commento completo'; }, closeComments : function (strTextOpen, strTextClose){ this.allComments=false; var objComments = document.getElementsByTagName("LI"); for (var kL=0; kL'+strTextOpen+' Vedi il commento completo'; else document.getElementById("displayResultsComments").innerHTML = 'Vedi il commento completo'; }, createObjAJAX : function (){ if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { return new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ return new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false; }, loadHTML : function (){ this.iLoad = this.iLoad +1; var page_request = this.createObjAJAX(); try { var objRequest = this; var returns = function(){return objRequest.onChangeHTML(page_request);}; page_request.onreadystatechange = returns; page_request.open('GET', this.url + '?rnd=' + Math.floor(1000000 * Math.random())); //get page synchronously page_request.send(null); } catch(e){} }, onChangeHTML : function (page_request){ if (page_request.readyState == 4) { if (page_request.status == 200) { var dataHTML; try{dataHTML = page_request.responseText;}catch(e){if(this.timeout != null) this.setTimeoutHTML();return false;} dataHTML = dataHTML.trim(); if (dataHTML != "") document.getElementById(this.idDiv).innerHTML = dataHTML; if ((this.typeData==MINUTOPERMINUTO)&&(this.allComments==true)) this.openComments(); if ((this.timeout != null)&&(objInitLiveMatch==false)) this.setTimeoutHTML(); } else { if ((document.getElementById(this.idDiv)!=null)&&(document.getElementById(this.idDiv)!=undefined)) document.getElementById(this.idDiv).innerHTML = '
Dati non disponibili.
'; } page_request=false; } }, setTimeoutHTML : function(){ var objRequest = this; var returns = function(){return objRequest.loadHTML();}; this.curTimeout = setTimeout(returns, (this.timeout * 1000)); if (objInitLiveMatch==false){ if (this.iLoad!=0) this.reloadADVandRS(); } }, reloadADVandRS : function() { try { RedSheriffCounter.RedSheriffCounter("it_Matrix-it_0", document.location.href, true, RedSheriffCounter.TIMEOUT_INSTANTLY); RedSheriffCounter.start(); reloadADV(); } catch(e){} }, resetData : function(urlHTML, timestamp, idDivContent, a2, a3, typeData){ if (this.curTimeout != null) clearTimeout(this.curTimeout); this.url = urlHTML; //this.timestamp = timestamp; this.idDiv = idDivContent; this.typeData = typeData; if (a2 != null) this.a2 = a2; if (a3 != null) this.a3 = a3; } } function setHashUrl(strTabHash) { var strUrl = document.location.href; if (strUrl.indexOf("#")!= -1) strUrl = strUrl.substring(0, strUrl.indexOf("#")); var strHashCode=""; switch (strTabHash) { case MINUTOPERMINUTO : strHashCode = "MINUTOPERMINUTO" break; case TABELLINO : strHashCode = "TABELLINO" break; case STATISTICHE : strHashCode = "STATISTICHE" break; } document.location.href = strUrl + "#" + strHashCode; } function selTabLive(urlHTML, timestamp, idDivContent, idDivTab, type) { var a2 = null; var a3 = null; setHashUrl(type); if (objLiveCommentario.a2 == null && objLiveCommentario.a3 == null) { var strDivTab = document.getElementById(idDivTab).innerHTML; var arrDivTab = strDivTab.split("selTabLive('"); var a = null; try{a = arrDivTab[1].substring(0,arrDivTab[1].indexOf(",") - 1);}catch(e){} if (a!=null) { if (arrDivTab[1].indexOf("TABELLINO")!=-1) a2=a; if (arrDivTab[1].indexOf("STATISTICHE")!=-1) a3=a; } try{a3 = arrDivTab[2].substring(0,arrDivTab[2].indexOf(",") - 1);}catch(e){} } objLiveCommentario.resetData(urlHTML, timestamp, idDivContent, a2, a3, type); var divTab; switch(type) { case MINUTOPERMINUTO: divTab = objLiveCommentario.span1; if (objLiveCommentario.a2!=null) divTab = divTab + 'Tabellino'; if (objLiveCommentario.a3!=null) divTab = divTab + 'Statistiche'; break; case TABELLINO: divTab = 'Minuto per minuto'; divTab = divTab + objLiveCommentario.span2; if (objLiveCommentario.a3!=null) divTab = divTab + 'Statistiche'; break; case STATISTICHE: divTab = 'Minuto per minuto'; if (objLiveCommentario.a2!=null) divTab = divTab + 'Tabellino'; divTab = divTab + objLiveCommentario.span3; break; } document.getElementById(idDivTab).innerHTML = divTab; document.getElementById(idDivContent).innerHTML = '
Caricamento in corso...
'; if ((objLiveCommentario.timeout != null)&&(objInitLiveMatch==false)) objLiveCommentario.loadHTML(); else objLive.loadJSON(); }