
(function($,Edge,compId){var Composition=Edge.Composition,Symbol=Edge.Symbol;
//Edge symbol: 'stage'
(function(symbolName){Symbol.bindElementAction(compId,symbolName,"document","compositionReady",function(sym,e){var gnYear=2014;var gn=31990;var startWC=Date.parse("September 16, 2014, 19:45 UTC");var startR2=Date.parse("January 1, 2015, 00:01 UTC");var endR2=Date.parse("March 19, 2015, 00:01 UTC");var endQF=Date.parse("April 23, 2015, 00:01 UTC");var endSF=Date.parse("May 14, 2015, 00:01 UTC");var endWC=Date.parse("June 6, 2015, 23:59 UTC");var gmtStart=Date.parse("October 26, 2014, 01:59 UTC");var gmtEnd=Date.parse("March 29, 2015, 00:59 UTC");var oneDay=86400000;var todayDate=new Date();var todayTime=todayDate.getTime();var localOffset=todayDate.getTimezoneOffset()*60000;var dataURL=('http:'==document.location.protocol?"http://www2.graphicnews.com/":"https://www.graphicnews.org/")+"infostradasports/api.php";var dateFormat;var showLocal=0;var teamselect;var grpTeams=[];var firstGroup=109475;var firstKnOut=109513;var get=[];location.search.replace('?','').split('&').forEach(function(val){split=val.split("=",2);get[split[0]]=split[1];});var fixtureInterval;var groupInterval;var matchInterval;var playInterval;var screenArr=['latest','overview','matchtracker'];for(var i=0;i<2;i++){sym.getSymbol("menuBtns").getSymbol("menuBtn"+i).$("icon").attr('src','images/menuIcon'+i+'.png');}
var menuTxtArr=[];var headlinetext=sym.getSymbol("styleMc").$("headlinetxt").css("pointer-events","none");var sourcetxt=sym.getSymbol("styleMc").getSymbol("styleBase").$("sourceTxt").css("pointer-events","none");var menuTxt=sym.getSymbol("styleMc").$("menuTxt").css("pointer-events","none");var text=[];text[0]=sym.getSymbol("overview").$("txt0").css("pointer-events","none");text[1]=sym.getSymbol("overview").$("txt1").css("pointer-events","none");for(var t=2;t<15;t++){text[t]=sym.getSymbol("overview").getSymbol("knockout").$("txt"+t).css("pointer-events","none");}
text[15]=sym.getSymbol("overview").$("txt15").css("pointer-events","none");var txtArr=[];var teamArr=[];var tableCaps=[];var months=[];var key=[];var timetxt=[];var winner=[];var recordArr=[];var qualArr=[];var rankArr=[];var trophyArr=[];var venueArr=[];var teamShortArr=[];var zoneArr=[];var showstage=0;sym.getSymbol("overview").$("knockout").on('click',showStages);sym.getSymbol("overview").$("knockout").css({'cursor':'pointer'});$(".knockoutCaps").fadeOut(0);function showStages(){e.preventDefault();e.stopPropagation();if(showstage==0){$(".knockoutCaps").fadeIn(500);$(".groupCaps").fadeOut(500);$(".kstage").fadeIn(500);sym.getSymbol("overview").$("up").fadeOut(0);sym.getSymbol("overview").$("down").delay(400).fadeIn(300);for(var i=1;i<=8;i++){var moveIt=Math.floor((i-1)/2);sym.getSymbol("overview").getSymbol("groupStage").$("group"+(i)).stop().animate({'height':'35px','top':16+(moveIt*42)},500,'easeOutQuad');}
sym.getSymbol("overview").$("groupStage").animate({'height':'190px'},500,'easeOutQuad');sym.getSymbol("overview").$("knockout").off('click');sym.getSymbol("overview").$("groupStage").on('click',showStages);sym.getSymbol("overview").$("groupStage").css({'cursor':'pointer'});sym.getSymbol("overview").$("knockout").css({'cursor':'auto'});sym.getSymbol("overview").play();showstage=1;}else if(showstage==1){$(".knockoutCaps").fadeOut(500);$(".groupCaps").fadeIn(500);$(".kstage").fadeOut(500);sym.getSymbol("overview").$("up").delay(400).fadeIn(300);sym.getSymbol("overview").$("down").fadeOut(0);for(var i=1;i<=8;i++){var moveIt=Math.floor((i-1)/2);sym.getSymbol("overview").getSymbol("groupStage").$("group"+(i)).animate({'height':'80px','top':16+(moveIt*101)},500,'easeInQuad');$("#gt"+i).css({'display':'none'});}
sym.getSymbol("overview").$("groupStage").animate({'height':'405px'},500);sym.getSymbol("overview").$("knockout").on('click',showStages);sym.getSymbol("overview").$("groupStage").off('click');sym.getSymbol("overview").$("knockout").css({'cursor':'pointer'});sym.getSymbol("overview").$("groupStage").css({'cursor':'auto'});sym.getSymbol("overview").playReverse();showstage=0;}}
if(todayTime<startR2){sym.getSymbol("overview").$("down").fadeOut(0);}else{showStages();}
function loadMatch(match){resetmenu();clearInterval(matchInterval);clearInterval(playInterval);matchInterval=setInterval(function(){getMatchInfo(match);},60000);playInterval=setInterval(function(){getMatch(match);},60000);getMatchInfo(match);getMatch(match);sym.$("matchtracker").fadeIn(400);sym.$("overview").fadeOut(400);sym.$("latest").fadeOut(400);sym.getSymbol("matchtracker").$("preloaderh").fadeIn(0);sym.getSymbol("matchtracker").$("preloadera").fadeIn(0);showguide=0;sym.getSymbol("matchtracker").$("guide").fadeOut(0)}
var showMatch=function(match){return function(e){loadMatch(match);e.preventDefault();e.stopPropagation();};};function openMatch(){if(get["match"]+""!="undefined"){var startMatch=parseInt(get["match"],10);loadMatch(startMatch);sym.$("cup").animate({opacity:0.3},1000);sym.$("bg").animate({opacity:0.25},1000);}else{sym.play();}}
var groupShow;var showMatches=function(group){return function(e){if(showstage==0){if(groupShow==group){sym.getSymbol("overview").getSymbol("groupStage").$("group"+group).animate({'height':'80px'},300);$("#gt"+group).css({'display':'none'});groupShow="";}else{for(var i=1;i<=8;i++){if(group==i){$("#gt"+group).css({'display':'block'});sym.getSymbol("overview").getSymbol("groupStage").$("group"+group).animate({'height':'173px'},300);}else{sym.getSymbol("overview").getSymbol("groupStage").$("group"+i).animate({'height':'80px'},300);$("#gt"+i).css({'display':'none'});}}
groupShow=group;}}
e.preventDefault();};};var teamId=[2,4209,4012,4014,4015,4017,4019,4034,4038,4025,4054,4067,4075,4222,4008,4771,4094,4103,4009,4112,4291,4123,4721,4718,4417,119310,104941,4007,4991,4452,4048,4011];$.ajax({type:"GET",url:"GN"+gn+".xml",dataType:"xml",success:function(xml){var headline=$(xml).find('headline').text();headlinetext.html(headline);var source=$(xml).find('source').text();sourcetxt.html(source);dateFormat=$(xml).find('dateformat').text();for(var m=0;m<2;m++){menuTxtArr[m]=$(xml).find('menuTxt'+m).text();}
for(var i=0;i<47;i++){txtArr[i]=$(xml).find('txt'+i).text();if(i<text.length){text[i].html(txtArr[i]);}}
sym.getSymbol("matchtracker").getSymbol("guide").$("txt2").html(txtArr[36]);var timerTxt="<div class='action period4'>";timerTxt+="<div class='personh'>"+txtArr[37]+"</div>";timerTxt+="<div class='type'><img src='images/goal.png'></div>";timerTxt+="<div class='actiontime'>"+txtArr[38]+"</div>";timerTxt+="<div class='type'></div>";timerTxt+="<div class='persona'></div>";timerTxt+="</div>";timerTxt+="<div class='action period4'>";timerTxt+="<div class='personh'></div>";timerTxt+="<div class='type'></div>";timerTxt+="<div class='actiontime'>"+txtArr[39]+"</div>";timerTxt+="<div class='type'><img src='images/sub.png'></div>";timerTxt+="<div class='persona'>"+txtArr[40]+"</div>";timerTxt+="</div>";timerTxt+="<div class='action period4'>";timerTxt+="<div class='personh'></div>";timerTxt+="<div class='type'></div>";timerTxt+="<div class='actiontime'>"+txtArr[41]+"</div>";timerTxt+="<div class='type'><img src='images/yellow.png'></div>";timerTxt+="<div class='persona'>"+txtArr[42]+"</div>";timerTxt+="</div>";timerTxt+=txtArr[45];timerTxt+="<img src='images/samplestats.png'>";timerTxt+=txtArr[20]+", "+txtArr[21]+", "+txtArr[22]+", "+txtArr[23];sym.getSymbol("matchtracker").getSymbol("guide").$("txt2").append(timerTxt);$('.action').css({'display':'inline-table','height':'20px','width':'100%','font-size':'12px','font-family':'pragmatica-web, sans-serif','text-align':'left','border-bottom':'solid 1px rgb(150,150,150)','border-top':'solid 1px rgba(255,255,255,0.6)'});$(".period4").css({'background-color':'rgba(255,170,50,0.1)'});$('.personh').css({'text-align':'right','display':'table-cell','width':'37%'});$('.actiontime').css({'background-color':'rgba(100,100,100,0.6)','text-align':'center','display':'table-cell','width':'12%','color':'rgb(255,255,255)'});$('.type').css({'display':'table-cell','width':'7%','text-align':'center'});$('.persona').css({'text-align':'left','display':'table-cell','width':'37%'});$(".action img").css({'width':'20px'});sym.getSymbol("matchtracker").$("h2hTxt0").html(txtArr[24]);sym.getSymbol("matchtracker").$("txt16").html(txtArr[17]);sym.getSymbol("matchtracker").$("txt17").html(txtArr[17]);sym.getSymbol("matchtracker").getSymbol("matchStats").$("txt18").html(txtArr[20]);sym.getSymbol("latest").$("txt0").html(menuTxtArr[0]);var tableHeadCaps=$(xml).find('table0').text();tableCaps=tableHeadCaps.split(";");var tableHead="<table style='width:60%; position:left; margin-left:40%; font-family:pragmatica-web, sans-serif; font-weight:700; border:none; border-collapse:collapse; font-size:12px'>";tableHead+="<tr><td width='13%'><center id='tp'></center></td><td width='13%'><center id='tw'></center></td><td width='13%'><center id='td'></center></td><td width='13%'><center id='tl'></center></td><td width='14%'><center id='tf'></center></td><td width='14%'><center id='ta'></center></td><td width='20%'><center id='tpts'></td></tr>";tableHead+="</table>";sym.getSymbol("overview").$("tableHead").append(tableHead);$("#tw").text(tableCaps[0]);$("#td").text(tableCaps[1]);$("#tl").text(tableCaps[2]);$("#tf").text(tableCaps[3]);$("#ta").text(tableCaps[4]);$("#tpts").text(tableCaps[5]);var tooltipCaps=$(xml).find('table1').text();sym.getSymbol("overview").$("tooltip0").html(tooltipCaps);sym.getSymbol("overview").$("tooltip0").css({'background-color':'rgb(255,235,165)','border':'solid 1px rgb(0,0,0)','border-radius':'2px','display':'none'});var monthsArr=$(xml).find('months').text();months=monthsArr.split(";");var keyArr=$(xml).find('key').text();key=keyArr.split(";");var timeArr=$(xml).find('time').text();timetxt=timeArr.split(";");var winArr=$(xml).find('winner').text();winner=winArr.split(";");sym.getSymbol("latest").$("timezoneTxt").html(timetxt[1]);for(var t=0;t<32;t++){$(xml).find("team"+t).each(function(){var $teams=$(this);teamArr[t]=$teams.find('name').text();recordArr[t]=$teams.find('record').text();qualArr[t]=$teams.find('qualifier').text();rankArr[t]=$teams.find('rank').text();trophyArr[t]=$teams.find('trophy').text();venueArr[t]=$teams.find('home').text();teamShortArr[t]=$teams.find('teamshort').text();zoneArr[t]=$teams.find('zone').text();});}},complete:function(){setTimeout(openMatch,400);}});sym.getSymbol("overview").$("tipBtn0").on('click',showTip);var showtip=0;function showTip(){if(showtip==0){sym.getSymbol("overview").$("tooltip0").fadeIn(0);showtip=1;}else{sym.getSymbol("overview").$("tooltip0").fadeOut(0);showtip=0}}
function rowColOver(e){$(this).css({'background-color':'rgba(255,0,0,1.0)','color':'rgba(255,255,255,1.0)','font-weight':700});var row=(e.data.row);var col=(e.data.col);var group=(e.data.group);for(var c=0;c<teamId.length;c++){if(row==teamId[c]){var x=teamId[c];}
if(col==teamId[c]){var y=teamId[c];}
for(var t=0;t<teamId.length;t++){$("#m"+group+"_h"+x+"_a"+teamId[t]).addClass("view");$("#m"+group+"_h"+teamId[t]+"_a"+y).addClass("view");}}
$(".view").css({'background-color':'rgba(255,180,0,0.2)'});}
function rowColOut(e){$(this).css({'background-color':'rgba(255,255,255,0)','color':'rgba(0,0,0,1.0)','font-weight':400});var row=(e.data.row);var col=(e.data.col);var group=(e.data.group);for(var c=0;c<teamArr.length;c++){if(row==teamId[c]){var x=teamId[c];}
if(col==teamId[c]){var y=teamId[c];}
for(var t=0;t<teamArr.length;t++){$("#m"+group+"_h"+x+"_a"+teamId[t]).removeClass("view");$("#m"+group+"_h"+teamId[t]+"_a"+y).removeClass("view");}}
$(".green").css({'background-color':'rgba(215,230,245,1.0)'});$(".white").css({'background-color':'rgba(255,255,255,0.8)'});$(".noMatch").css({'background-color':'rgba(235,240,250,1.0)'});}
menuArray=[];for(var m=0;m<2;m++){var menuBtnSymbols=sym.getSymbol("menuBtns").getSymbol("menuBtn"+m);menuBtnSymbols.setVariable("menuId",m);menuArray.push(menuBtnSymbols);}
$.each(menuArray,function(count,menuInTheArray){var menuBtnItem=$(menuInTheArray);var menuBtnElement=menuInTheArray.getSymbolElement();menuBtnElement.on("click",{menuId:count},menuBtnClick);menuBtnElement.on("touchstart click",{menuId:count},menuBtnClick);menuBtnElement.on("mouseover",{menuId:count},menuShow);menuBtnElement.on("mouseout",{menuId:count},menuHide);menuBtnElement.css({"cursor":"pointer"});})
function resetmenu(){for(var m=0;m<menuArray.length;m++){menuArray[m].$("menuBg").fadeOut(0);}
menuTxt.fadeOut(0);}
resetmenu();function menuBtnClick(e){e.preventDefault();e.stopPropagation();resetmenu();clearInterval(matchInterval);clearInterval(playInterval);var menuMenu_id=(e.data.menuId);for(var i=0;i<3;i++){if(menuMenu_id==i){sym.$(screenArr[i]).fadeIn(400);sym.getSymbol("menuBtns").getSymbol("menuBtn"+i).$("menuBg").fadeIn(0);menuTxt.html(menuTxtArr[i]);menuTxt.fadeIn(0);}else{sym.$(screenArr[i]).fadeOut(400);}}}
function menuShow(e){var menuMenu_id=(e.data.menuId);menuTxt.html(menuTxtArr[menuMenu_id]);menuTxt.fadeIn(0);}
function menuHide(e){var menuMenu_id=(e.data.menuId);menuTxt.fadeOut(0);}
sym.getSymbol("menuBtns").getSymbol("menuBtn0").$("menuBg").fadeIn(0);sym.getSymbol("matchtracker").$("statsBtn").on('click',matchStats);sym.getSymbol("matchtracker").$("statsBtn").on('mouseover',statsOver);sym.getSymbol("matchtracker").$("statsBtn").on('mouseout',statsOut);sym.getSymbol("matchtracker").$("statsBtn").css({'cursor':'pointer'});var showStats=0;sym.getSymbol("matchtracker").$("statTxt").fadeOut(0);sym.getSymbol("matchtracker").$("statsBtn").fadeIn(0);function matchStats(){if(showStats==0){sym.getSymbol("matchtracker").$("timer").animate({'width':0,'left':'397px','opacity':0},200);sym.getSymbol("matchtracker").$("statsBtn").attr('src','images/clockbtn.png');sym.getSymbol("matchtracker").$("statTxt").html(txtArr[31]);sym.getSymbol("matchtracker").$("statTxt").fadeIn(0);showStats=1;}else{sym.getSymbol("matchtracker").$("timer").animate({'width':391,'left':'201px','opacity':1.0},200);sym.getSymbol("matchtracker").$("statsBtn").attr('src','images/menuIcon2.png');sym.getSymbol("matchtracker").$("statTxt").html(txtArr[32]);sym.getSymbol("matchtracker").$("statTxt").fadeIn(0);showStats=0}}
function statsOver(){if(showStats==0){sym.getSymbol("matchtracker").$("statTxt").html(txtArr[32]);sym.getSymbol("matchtracker").$("statTxt").fadeIn(0);}else{sym.getSymbol("matchtracker").$("statTxt").html(txtArr[31]);sym.getSymbol("matchtracker").$("statTxt").fadeIn(0);}}
function statsOut(){sym.getSymbol("matchtracker").$("statTxt").fadeOut(0);}
var showguide=0;function showGuide(){if(showguide==0){sym.getSymbol("matchtracker").$("guide").fadeIn(600);showguide=1;}else{sym.getSymbol("matchtracker").$("guide").fadeOut(600);showguide=0;}}
sym.getSymbol("latest").$("timezone").on("click",function(){if(showLocal==0){showLocal=1;getFixtures();}else{showLocal=0;getFixtures();}sym.getSymbol("latest").$("timezoneTxt").html(timetxt[showLocal]);});sym.getSymbol("latest").$("timezone").on("mouseover",function(){if(showLocal==0){sym.getSymbol("latest").$("timezoneTxt").html(timetxt[0]);}else{sym.getSymbol("latest").$("timezoneTxt").html(timetxt[1]);}});sym.getSymbol("latest").$("timezone").on("mouseout",function(){if(showLocal==0){sym.getSymbol("latest").$("timezoneTxt").html(timetxt[1]);}else{sym.getSymbol("latest").$("timezoneTxt").html(timetxt[0]);}});sym.getSymbol("latest").$("timezone").css({'cursor':'pointer'});function getDDMMYY(thisDateStr){var dateTxt=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf(')'));var thisDate=new Date(parseInt((dateTxt+localOffset),10));var mm=thisDate.getMonth()+1;var dd=thisDate.getDate();mm=((mm<10)?'0':"")+mm;dd=((dd<10)?'0':"")+dd;return dd+"/"+mm+"/"+(thisDate.getFullYear()).toString();}
function getDDmonthYY(thisDateStr){var dateTxt=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf(')'));var thisDate=new Date(parseInt(dateTxt,10));var matchDate=thisDate.getTime()+localOffset;var matchTime=new Date(matchDate);var mm=matchTime.getMonth();var dd=matchTime.getDate();if(dateFormat=="dayMonth"){return dd.toString()+months[mm];}else{return months[mm]+" "+dd.toString();}}
function getDateLocal(thisDateStr){var dateTxt=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf(')'));var thisDate=new Date(parseInt(dateTxt,10));var mm=thisDate.getMonth();var dd=thisDate.getDate();if(dateFormat=="dayMonth"){return dd.toString()+months[mm];}else{return months[mm]+" "+dd.toString();}}
function getMatchTime(thisDateStr,braziltime){var timeTxt=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf(')'));var thisDate=new Date(parseInt(timeTxt,10));var thisTime=thisDate.getTime()+localOffset-braziltime;var matchTime=new Date(thisTime);var hh=matchTime.getHours();var mm=parseInt(matchTime.getMinutes(),10);mm=(mm<10)?"0"+mm:mm;return hh+":"+mm;}
function getMatchLocal(thisDateStr){var timeTxt=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf(')'));var thisDate=new Date(parseInt(timeTxt,10));var hh=thisDate.getHours();var mm=parseInt(thisDate.getMinutes(),10);mm=(mm<10)?"0"+mm:mm;return hh+":"+mm;}
function parsedDate(thisDateStr){var matchRndDate=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf(')'));var dDate=parseInt(matchRndDate,10)+localOffset;return dDate;}
var offsetVenue;function getDST(thisDateStr,offsetZone){var thisDate=thisDateStr.substring(thisDateStr.indexOf('(')+1,thisDateStr.indexOf('+'));if(thisDate<gmtStart||thisDate>gmtEnd){var offsetUTC=-3600000-offsetZone;}else{var offsetUTC=0-offsetZone;}
return offsetUTC;}
function getDetails(groupIndex){var group=groupIndex-1;var id=firstGroup+group;$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&phaseID="+id,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,error:function(){console.log("Error retrieving Group["+groupIndex+"]");},success:function(groupDetails){for(var i=0;i<4;i++){grpTeams[i]=groupDetails[i].n_TeamID;}
loadDetails(groupDetails,group);}});}
function loadDetails(groupDetails,group){var imgHTML;for(var i=0;i<4;i++){var teamName=groupDetails[i].c_Team;for(var c=0;c<32;c++){if(groupDetails[i].n_TeamID==teamId[c]){teamName=teamArr[c];var crestHTML="<img src='crests/"+teamId[c]+".png' id='teamBtn"+c+"'>"+teamShortArr[c];}}
var fixTxt="<table class='fixtable'>";fixTxt+="<tr class='fixHead'><td class='fixName' id='fixName"+group+"_"+i+"'></td>";for(var t=0;t<4;t++){if(t==i){fixTxt+="<td class='matchBox noMatch' id='m"+group+"_"+i+"_"+t+"'>";}else{if((i%2==0&&t%2==0)||(i%2>0&&t%2>0)){fixTxt+="<td class='matchBox green' id='m"+group+"_h"+grpTeams[i]+"_a"+grpTeams[t]+"'>";}else{fixTxt+="<td class='matchBox white' id='m"+group+"_h"+grpTeams[i]+"_a"+grpTeams[t]+"'>";}}}
fixTxt+="</tr>";fixTxt+="</table>";$('#tab'+group).append(fixTxt);$('#g'+group+"_"+i).html(crestHTML);$('#fixName'+group+"_"+i).html(teamName);$('#t'+group+'n'+i).text(teamName);$('#t'+group+'p'+i).text(groupDetails[i].n_Matches);$('#t'+group+'w'+i).text(groupDetails[i].n_MatchesWon);$('#t'+group+'d'+i).text(groupDetails[i].n_MatchesDrawn);$('#t'+group+'l'+i).text(groupDetails[i].n_MatchesLost);$('#t'+group+'f'+i).text(groupDetails[i].n_GoalsFor);$('#t'+group+'a'+i).text(groupDetails[i].n_GoalsAgainst);$('#t'+group+'pts'+i).text(groupDetails[i].n_Points);imgHTML='<img src="flags/'+(groupDetails[i].c_TeamNatioShort)+'.png" height="12px" width="22px">';$('#t'+group+'flag'+i).html(imgHTML);$(".fixtable").css({'width':'100%','font-size':'11px','font-family':'pragmatica-web,sans-serif','border':'none','border-collapse':'collapse'});$(".fixName").css({'width':'40%','padding-left':'4px'});$(".matchBox").css({'width':'15%','font-size':'11px','text-align':'center'});$(".noMatch").css({'background-color':'rgba(235,240,250,1.0)','box-shadow':'inset rgba(100,100,100,0.5) 1px 2px 1px 1px'});$(".green").css({'background-color':'rgba(215,230,245,1.0)'});$(".white").css({'background-color':'rgba(255,255,255,0.8)'});$(".matchBox img").css({'width':'20px'});$(".matchBox.fixHead").css({'font-size':'11px','font-family':'pragmatica-web,sans-serif','font-weight':400})}}
var resultsData;function getGroupResults(){$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&editionID=17694",contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){resultsData=data;for(var group=1;group<=8;group++){sym.getSymbol("overview").getSymbol("groupStage").$("group"+group).empty();var tableTxt="<div id='gt"+group+"' style='display:none; position:absolute; bottom:3px; width:100%'>";tableTxt+="<table class='fixtable'>";tableTxt+="<tr class='fixHead'><td class='fixName'>"+txtArr[33]+"</td>";for(var c=0;c<4;c++){tableTxt+="<td class='matchBox fixHead' id='g"+(group-1)+"_"+c+"'></td>";}
tableTxt+="</tr><tr><td colspan='5' id='tab"+(group-1)+"'></td></tr></table>";tableTxt+="</div>";tableTxt+="<div id='grptable"+group+"'>";tableTxt+="<table style='width:100%; position:absolute; background-color:rgb(215,230,245); font-family:pragmatica-web, sans-serif; border:none; border-collapse:collapse; font-size:12px'>";tableTxt+="<tr style='background-color:rgb(235,240,250);'><td width='7%' id='t"+(group-1)+"flag0'></td><td width='38%' ><span id='t"+(group-1)+"n0'></td><td width='7%'><center id='t"+(group-1)+"w0'></center></td><td width='7%'><center id='t"+(group-1)+"d0'></center></td><td width='7%'><center id='t"+(group-1)+"l0'></center></td><td width='8%'><center id='t"+(group-1)+"f0'></center></td><td width='8%'><center id='t"+(group-1)+"a0'></center></td><td width='11%'><center id='t"+(group-1)+"pts0'></td></tr>";tableTxt+="<tr style='background-color:rgb(235,240,250);'><td id='t"+(group-1)+"flag1'></td><td><span id='t"+(group-1)+"n1'></td><td><center id='t"+(group-1)+"w1'></center></td><td><center id='t"+(group-1)+"d1'></center></td><td><center id='t"+(group-1)+"l1'></center></td><td><center id='t"+(group-1)+"f1'></center></td><td><center id='t"+(group-1)+"a1'></center></td><td><center id='t"+(group-1)+"pts1'></td></tr>";tableTxt+="<tr><td id='t"+(group-1)+"flag2'></td><td><span id='t"+(group-1)+"n2'></td><td><center id='t"+(group-1)+"w2'></center></td><td><center id='t"+(group-1)+"d2'></center></td><td><center id='t"+(group-1)+"l2'></center></td><td><center id='t"+(group-1)+"f2'></center></td><td><center id='t"+(group-1)+"a2'></center></td><td><center id='t"+(group-1)+"pts2'></td></tr>";tableTxt+="<tr><td id='t"+(group-1)+"flag3'></td><td><span id='t"+(group-1)+"n3'></td><td><center id='t"+(group-1)+"w3'></center></td><td><center id='t"+(group-1)+"d3'></center></td><td><center id='t"+(group-1)+"l3'></center></td><td><center id='t"+(group-1)+"f3'></center></td><td><center id='t"+(group-1)+"a3'></center></td><td><center id='t"+(group-1)+"pts3'></td></tr></table>";tableTxt+="<table style='position:absolute; top:0px; width:165px; background-color:rgb(215,230,245); border:none; border-collapse:collapse; font-family:pragmatica-web, sans-serif; font-size:12px'>";tableTxt+="</div>";sym.getSymbol("overview").getSymbol("groupStage").$("group"+group).append(tableTxt);getDetails(group);sym.getSymbol("overview").getSymbol("groupStage").$("group"+group).on('click',showMatches(group));sym.getSymbol("overview").getSymbol("groupStage").$("group"+group).css({'cursor':'pointer'});}}});}
var fixtureData;function getFixtures(){$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&editionID=17694",contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){fixtureData=data;for(var k=1;k<9;k++){sym.getSymbol("overview").getSymbol("knockout").$("r16-"+k).empty();sym.getSymbol("overview").getSymbol("knockout").$("qf"+k).empty();sym.getSymbol("overview").getSymbol("knockout").$("sf"+k).empty();}
sym.getSymbol("overview").getSymbol("knockout").$("ru").empty();sym.getSymbol("overview").getSymbol("knockout").$("final").empty();sym.getSymbol("latest").$('table').empty();for(var i=0;i<fixtureData.length;i++){var matchesRnd=parsedDate(fixtureData[i].d_DateUTC);var matchDay=fixtureData[i].n_PhaseID;var phaseLevel=fixtureData[i].n_PhaseLevel;var matchNo=fixtureData[i].n_KnockoutPhaseID;var teamHome;var teamAway;var timeZone;var string1=(fixtureData[i].c_HomeTeam!=null)?fixtureData[i].c_HomeTeam:"";var string2=(fixtureData[i].c_AwayTeam!=null)?fixtureData[i].c_AwayTeam:"";var winArr=["Winner","Loser"];teamHome=string1.replace(winArr[0],winner[0]);teamHome=teamHome.replace(winArr[1],winner[1]);teamAway=string2.replace(winArr[0],winner[0]);teamAway=teamAway.replace(winArr[1],winner[1]);for(var c=0;c<32;c++){if(fixtureData[i].n_HomeTeamID==teamId[c]){teamHome=teamArr[c];timeZone=zoneArr[c];var city=venueArr[c];}
if(fixtureData[i].n_AwayTeamID==teamId[c]){teamAway=teamArr[c];}}
if(fixtureData[i].n_CityGeoID==16274){city=txtArr[46];}
var offsetZone;switch(timeZone){case"1":offsetZone=3600000;break;case"2":offsetZone=7200000;break;case"3":offsetZone=10800000;break;default:offsetZone=0;break;}
var offsetVenue=getDST(fixtureData[i].d_DateUTC,offsetZone);if((todayTime<startWC&&matchesRnd>startWC&&matchesRnd<startWC+(oneDay*2))||((todayTime>startR2&&todayTime<endR2&&matchesRnd>startR2&&matchesRnd<endR2)||(todayTime>endR2&&todayTime<endQF&&matchesRnd>endR2&&matchesRnd<endQF)||(todayTime>endQF&&todayTime<endSF&&matchesRnd>endQF&&matchesRnd<endSF))&&matchesRnd>todayTime-(oneDay*4)||(matchesRnd>todayTime-(oneDay*0.75)&&matchesRnd<todayTime+(oneDay*14))||todayTime>endWC&&matchesRnd>endWC-(oneDay*35)){if(i%2==0){var fixtureTxt="<table class='fixtxt even' id='matchf"+i+"'>";}else{var fixtureTxt="<table class='fixtxt' id='matchf"+i+"'>";}
fixtureTxt+="<tr>";fixtureTxt+="<td class='crestf' style='crest' id='homecrestf"+i+"'></td>";fixtureTxt+="<td class='teamf' style='padding-left:3px' id='homef"+i+"'></td>";fixtureTxt+="<td style='width:30%;text-align:center' id='scoref"+i+"'></td>";fixtureTxt+="<td class='teamf away' style='text-align:right' id ='awayf"+i+"'></td>";fixtureTxt+="<td class='crestf away' id='awaycrestf"+i+"'></td>";fixtureTxt+="</tr></table>";}
sym.getSymbol("latest").$('table').append(fixtureTxt);var fixtBox="<div id='matchg"+i+"'></div>";var overviewTxt="<table class='tie' id='tie"+i+"'>";overviewTxt+="<tr>";overviewTxt+="<td class='flag' id='flagh"+i+"'></td>";overviewTxt+="<td class='team' id='hometeam"+i+"'></td>";overviewTxt+="</tr>";overviewTxt+="<tr>";overviewTxt+="<td class='flag' id='flaga"+i+"'></td>";overviewTxt+="<td class='team' id='awayteam"+i+"'></td>";overviewTxt+="</tr>";overviewTxt+="</table>";if(fixtureData[i].n_Leg!=2){var leg1Txt="<table class='leg' id='match"+i+"'>";leg1Txt+="<tr><td id='legh"+i+"'></td></tr>";leg1Txt+="<tr><td id='lega"+i+"'></td></tr>";leg1Txt+="</table>";}
if(fixtureData[i].n_Leg==2){var leg2Txt="<table class='leg' id='match"+i+"'>";leg2Txt+="<tr><td id='leg2a"+i+"'></td></tr>";leg2Txt+="<tr><td id='leg2h"+i+"'></td></tr>";leg2Txt+="</table>";}
var groupPhase=[];for(var p=0;p<8;p++){groupPhase[p]=firstGroup+p;if(fixtureData[i].n_PhaseID==groupPhase[p]){$("#m"+p+"_h"+fixtureData[i].n_HomeTeamID+"_a"+fixtureData[i].n_AwayTeamID).html(fixtBox);var group=p;}}
var r16match=[];if(phaseLevel==9){for(var r=0;r<8;r++){r16match[r]=firstKnOut+r;if(matchNo==r16match[r]){if((fixtureData[i].n_Leg)==1){var r16Ov="<div class='kstage' id='tie"+matchNo+"'>"+overviewTxt+leg1Txt+"</div>";sym.getSymbol("overview").getSymbol("knockout").$('r16-'+(r+1)).append(r16Ov);}else{$("#tie"+matchNo).append(leg2Txt)}}}}
var qmatch=[];if(phaseLevel==5){for(var q=0;q<4;q++){qmatch[q]=firstKnOut+8+q;if(matchNo==qmatch[q]){if((fixtureData[i].n_Leg)==1){var qfOv="<div class='kstage' id='tie"+matchNo+"'>"+overviewTxt+leg1Txt+"</div>";sym.getSymbol("overview").getSymbol("knockout").$('qf'+(q+1)).append(qfOv);}else{$("#tie"+matchNo).append(leg2Txt)}}}}
var smatch=[];if(phaseLevel==3){for(var s=0;s<2;s++){smatch[s]=firstKnOut+12+s;if(matchNo==smatch[s]){if((fixtureData[i].n_Leg)==1){var sfOv="<div class='kstage' id='tie"+matchNo+"'>"+overviewTxt+leg1Txt+"</div>";sym.getSymbol("overview").getSymbol("knockout").$('sf'+(s+1)).append(sfOv);}else{$("#tie"+matchNo).append(leg2Txt)}}}}
var finTxt;if(phaseLevel==2){var finalOv="<div class='kstage' id='tie"+matchNo+"'>"+overviewTxt+leg1Txt+"</div>";sym.getSymbol("overview").getSymbol("knockout").$('final').append(finalOv);city=fixtureData[i].c_City;}
var matchID=fixtureData[i].n_MatchID;var homeTeamID=fixtureData[i].n_HomeTeamID;var awayTeamID=fixtureData[i].n_AwayTeamID;var matchDate=getDDmonthYY(fixtureData[i].d_DateUTC);if(showLocal==0){var matchTime=getDateLocal(fixtureData[i].d_Date)+", "+getMatchLocal(fixtureData[i].d_Date);}else{var matchTime=getDDmonthYY(fixtureData[i].d_DateUTC)+", "+getMatchTime(fixtureData[i].d_Date,offsetVenue);}
$(".kstage").css({'display':'inline-table','width':'100%','height':'32px','font-size':'12px','font-family':'pragmatica-web,sans-serif',});$(".leg").css({'padding-left':'2px','display':'table-cell','width':'10%','border-collapse':'collapse','border-left':'1px solid rgb(175,175,175)','text-align':'center'});$('.even').css({'background-color':'rgba(215,230,245,0.5)'});$('.fixtxt').css({'font-size':'14px','font-family':'pragmatica-web,sans-serif','width':'100%'});$('.teamf').css({'width':'25%','font-weight':700});$(".crestf").css({'width':'10%'});$(".away").css({'text-align':'right'});var crestH=((fixtureData[i].n_HomeTeamID)<=0)?'<img src="crests/null.png">':'<img src="crests/'+fixtureData[i].n_HomeTeamID+'.png">';var crestA=((fixtureData[i].n_HomeTeamID)<=0)?'<img src="crests/null.png">':'<img src="crests/'+fixtureData[i].n_AwayTeamID+'.png">';$('#homecrestf'+i).html(crestH);$('#awaycrestf'+i).html(crestA);$(".crestf img").css({'border':'none','width':'44px','height':'44px'});$('.tie').css({'margin-left':'2px','border-collapse':'collapse','display':'table-cell','cursor':'pointer'});$('.grpmatch').css({'cursor':'pointer','height':'12px','font-size':'12px','font-family':'pragmatica-web,sans-serif','border-collapse':'collapse','width':'100%'});$('#tie'+matchNo).off('click');if(homeTeamID>0||awayTeamID>0){$('#tie'+matchNo).on('click',showMatch(matchID));$("#match"+i).css({'cursor':'pointer'});$("#match"+i).on('click',showMatch(matchID));}
$("#match"+i).on('mouseover',function(){$(this).css({'background-color':'rgba(255,0,0,1.0)','color':'rgba(255,255,255,1.0)','font-weight':700});});$("#match"+i).on('mouseout',function(){$(this).css({'background-color':'rgba(255,255,255,0)','color':'rgba(0,0,0,1.0)','font-weight':400});});$("#matchf"+i).css({'cursor':'pointer'});$("#matchf"+i).on('click',showMatch(matchID));$("#matchf"+i).on('mouseover',function(){$(this).css({'background-color':'rgba(220,155,0,0.2)','font-weight':700});});$("#matchf"+i).on('mouseout',function(){if(this.className=="fixtxt even"){$(this).css({'background-color':'rgba(215,230,245,0.5)','font-weight':400});}else{$(this).css({'background-color':'rgba(255,255,255,0)','font-weight':400});}});$("#matchg"+i).on('click',showMatch(matchID));$("#matchg"+i).on('mouseover',{'group':group,'row':homeTeamID,'col':awayTeamID},rowColOver);$("#matchg"+i).on('mouseout',{'group':group,'row':homeTeamID,'col':awayTeamID},rowColOut);$('#tie'+matchNo).on('mouseover',function(){$(this).css({'background-color':'rgba(220,155,0,0.2)'});});$('#tie'+matchNo).on('mouseout',function(){$(this).css({'background-color':'rgba(255,255,255,0)'});});var imgH=((fixtureData[i].n_HomeTeamID)<=0)?'<img src="flags/null.png">':'<img src="flags/'+fixtureData[i].c_HomeTeamNatioShort+'.png">';var imgA=((fixtureData[i].n_HomeTeamID)<=0)?'<img src="flags/null.png">':'<img src="flags/'+fixtureData[i].c_AwayTeamNatioShort+'.png">';$('#flagh'+i).html(imgH);$('#flaga'+i).html(imgA);$(".team").css({'padding-bottom':'1px'});$(".flag").css({'width':'22px','padding':'0 2px 0 2px'});$(".flag img").css({'border':'none','width':'22px','height':'12px'});$('#hometeam'+i).text(teamHome);$('#awayteam'+i).text(teamAway);$('#homef'+i).text(teamHome);$('#awayf'+i).text(teamAway);$('.grpteamh').css({'text-align':'left','width':'35%','padding':'0px'});$('.grpteama').css({'text-align':'right','width':'35%','padding':'0px'});$('.grpscore').css({'padding':'0px'});var scoreH=(fixtureData[i].n_HomeGoals!=null||fixtureData[i].n_HomeGoals!=undefined)?'<b>'+(fixtureData[i].n_HomeGoals)+'</b>':'';var scoreA=(fixtureData[i].n_AwayGoals!=null||fixtureData[i].n_AwayGoals!=undefined)?'<b>'+(fixtureData[i].n_AwayGoals)+'</b>':'';if(fixtureData[i].n_Leg==2){$('#leg2h'+i).html(scoreH);$('#leg2a'+i).html(scoreA);}else{$('#legh'+i).html(scoreH);$('#lega'+i).html(scoreA);}
var score=(fixtureData[i].n_HomeGoals!=null||fixtureData[i].n_HomeGoals!=undefined)?(fixtureData[i].n_HomeGoals)+'-'+(fixtureData[i].n_AwayGoals):matchDate;var scoref=(fixtureData[i].n_HomeGoals!=null||fixtureData[i].n_HomeGoals!=undefined)?'<b>'+(fixtureData[i].n_HomeGoals)+'-'+(fixtureData[i].n_AwayGoals)+'</b>':'<i>'+matchTime+'</i>';$('#scoref'+i).html(scoref+"<br/><i>"+city+"</i>");$("#matchg"+i).html(score);matchResult=(fixtureData[i].n_MatchStatusCode>4)&&(fixtureData[i].n_MatchStatusCode<128)?'<img src="images/ball.png" height="13px" width="13px">':'';$('#result'+i).html(matchResult);if(phaseLevel<=9){for(var p=0;p<15;p++){if(matchNo==firstKnOut+p){if(fixtureData[i].n_Leg==2){sym.getSymbol("overview").getSymbol("knockout").$("dateTxt"+p).append(" / "+matchDate);}else{sym.getSymbol("overview").getSymbol("knockout").$("dateTxt"+p).text(matchDate);}}}}
if(showstage==0){$(".kstage").fadeOut(0);}}}});}
getGroupResults();setTimeout(getFixtures,1000);if(todayTime>startWC-(oneDay*3)&&todayTime<endWC+(oneDay*3)){groupInterval=setInterval(getGroupResults,600000);fixtureInterval=setInterval(getFixtures,120000);}
function getMatchInfo(matchID){var infoData;sym.getSymbol("matchtracker").$("penaltiesTxt").fadeOut(0);sym.getSymbol("matchtracker").$("statsBtn").off('click',showGuide);$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&match="+matchID+"&q=info",contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){infoData=data;var matchteam1;var matchteam2;getTeams(matchID,infoData[0].n_HomeTeamID,infoData[0].n_AwayTeamID);var string1=infoData[0].c_HomeTeam;var string2=infoData[0].c_AwayTeam;var winArr=["Winner","Loser"];matchteam1=string1.replace(winArr[0],winner[0]);matchteam1=matchteam1.replace(winArr[1],winner[1]);matchteam2=string2.replace(winArr[0],winner[0]);matchteam2=matchteam2.replace(winArr[1],winner[1]);for(var c=0;c<32;c++){if(infoData[0].n_HomeTeamID==teamId[c]){matchteam1=teamArr[c];var timeZone=zoneArr[c];var city=venueArr[c]}
if(infoData[0].n_AwayTeamID==teamId[c]){matchteam2=teamArr[c];}}
if(fixtureData[i].n_CityGeoID==16274){city=txtArr[46];}
var score1;var score2;var notStarted=['h2hmatch','h2h','h2hgoals'];var showStarted=['matchStats','timer','timeTxt','clock'];if(infoData[0].b_Started==false){score1="0";score2="0";for(var n=0;n<notStarted.length;n++){sym.getSymbol("matchtracker").$(notStarted[n]).fadeIn(600);}
for(var m=0;m<showStarted.length;m++){sym.getSymbol("matchtracker").$(showStarted[m]).fadeOut(0);}
clearInterval(playInterval);sym.getSymbol("matchtracker").$("statsBtn").on('click',showGuide);getH2H(matchID);}else{if(infoData[0].b_Live==true){clearInterval(matchInterval);clearInterval(playInterval);matchInterval=setInterval(function(){getMatchInfo(matchID);},60000);playInterval=setInterval(function(){getMatch(matchID);},60000);}
score1=infoData[0].n_HomeGoals;score2=infoData[0].n_AwayGoals;for(var n=0;n<notStarted.length;n++){sym.getSymbol("matchtracker").$(notStarted[n]).fadeOut(0);}
for(var m=0;m<showStarted.length;m++){sym.getSymbol("matchtracker").$(showStarted[m]).fadeIn(600);}
getmatchStats(matchID);sym.getSymbol("matchtracker").$("statsBtn").off('click',showGuide);}
var offsetZone;switch(timeZone){case"1":offsetZone=3600000;break;case"2":offsetZone=7200000;break;case"3":offsetZone=10800000;break;default:offsetZone=0;break;}
var offsetVenue=getDST(fixtureData[i].d_DateUTC,offsetZone);if(infoData[0].b_Finished==true){clearInterval(matchInterval);matchInterval=setInterval(function(){getMatchInfo(matchID);},300000);clearInterval(playInterval);var matchTime=getDDmonthYY(infoData[0].d_DateUTC);}else{if(showLocal==0){var matchTime=getMatchLocal(infoData[0].d_Date)+" "+getDateLocal(infoData[0].d_Date);}else{var matchTime=getMatchTime(infoData[0].d_Date,offsetVenue)+" "+getDDmonthYY(infoData[0].d_DateUTC);}}
var matchRef=(infoData[0].c_Referee==null)?"":txtArr[18]+infoData[0].c_Referee+" <i>"+infoData[0].c_RefereeNatioShort+"</i>";var spectators=(infoData[0].n_Spectators==null)?"":txtArr[19]+infoData[0].n_Spectators;var matchscore=score1+"-"+score2;var imgH="crests/"+infoData[0].n_HomeTeamID+".png";var imgA="crests/"+infoData[0].n_AwayTeamID+".png";var matchStatus=infoData[0].n_MatchStatusCode;var tacticsH=(infoData[0].c_HomeTactics==null)?"":infoData[0].c_HomeTactics;var tacticsA=(infoData[0].c_AwayTactics==null)?"":infoData[0].c_AwayTactics;var matchDate=getDDmonthYY(infoData[0].d_DateUTC);var matchInfo=infoData[0].c_Stadium+", "+infoData[0].c_City+"<br />"+matchTime+", 2014<br />"+matchRef+"<br />"+spectators;sym.getSymbol("matchtracker").$("matchcrest1").attr("src",imgH);sym.getSymbol("matchtracker").$("matchcrest2").attr("src",imgA);sym.getSymbol("matchtracker").$("matchteam1Txt").text(matchteam1);sym.getSymbol("matchtracker").$("matchteam2Txt").text(matchteam2);sym.getSymbol("matchtracker").$("matchscoreTxt").text(matchscore);sym.getSymbol("matchtracker").$("matchinfoTxt").html(matchInfo);if(infoData[0].n_PeriodSort>=10&&infoData[0].n_HomeGoalsShootout!=null){var pensH=(infoData[0].n_HomeGoalsShootout>=0)?infoData[0].n_HomeGoalsShootout:"";var pensA=(infoData[0].n_AwayGoalsShootout>=0)?infoData[0].n_AwayGoalsShootout:"";var penalties=txtArr[30]+" ("+pensH+"-"+pensA+")";if(infoData[0].n_HomeGoalsShootout>=0||infoData[0].n_AwayGoalsShootout>=0){sym.getSymbol("matchtracker").$("penaltiesTxt").html(penalties);sym.getSymbol("matchtracker").$("penaltiesTxt").fadeIn(0);}}}});}
var matchData;var lastAction;var lastTime;var lastPeriod;function getMatch(matchID){var minutes=sym.getSymbol("matchtracker").$("timeTxt");minutes.text("0");$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&match="+matchID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){matchData=data;if(matchData){lastAction=matchData[0].n_ActionTime;lastPeriod=matchData[0].n_PeriodSort;var lastTimetxt;var minutes=sym.getSymbol("matchtracker").$("timeTxt");sym.getSymbol("matchtracker").$("timer").empty();var actionTxt;var penTxt;var HorA;var actionSet;var actionType;var action;var actionTime;var actionMs;var actionPeriod;var keyTxt="<div class='action'>";keyTxt+="<div class='key'><img src='images/goal.png' style='width:15px'> "+key[0]+"</div>";keyTxt+="<div class='key'>"+"<img src='images/pen.png' style='width:15px'> "+key[1]+"</div>";keyTxt+="<div class='key'>"+"<img src='images/sub.png' style='width:15px'> "+key[2]+"</div>";keyTxt+="<div class='key'>"+"<img src='images/yellow.png' style='width:15px'> "+key[3]+"</div>";keyTxt+="</div>";sym.getSymbol("matchtracker").$("timer").append(keyTxt);for(var i=0;i<=matchData.length;i++){if(matchData[i].n_ActionTime>lastAction){lastAction=matchData[i].n_ActionTime;}
if(matchData[i].n_PeriodSort>lastPeriod){lastPeriod=matchData[i].n_PeriodSort;}
actionSet=matchData[i].n_ActionSet;actionType=matchData[i].n_ActionCode;actionTime=(matchData[i].c_ActionMinute==null)?"":matchData[i].c_ActionMinute;var HorA=(matchData[i].n_HomeOrAway==1)?"h":"a";if(actionSet==1||actionSet==2||actionSet==3||actionSet==5){actionMs=matchData[i].n_ActionTime;actionPeriod=matchData[i].n_PeriodSort;var actionTxt="<div class='action period"+actionPeriod+"' id=action"+i+"'>";actionTxt+="<div class='personh' id='person"+i+"h'></div>";actionTxt+="<div class='type' id='type"+i+"h'></div>";actionTxt+="<div class='actiontime' id='actionMins"+i+"'></div>";actionTxt+="<div class='type' id='type"+i+"a'></div>";actionTxt+="<div class='persona' id='person"+i+"a'></div>";actionTxt+="</div>";sym.getSymbol("matchtracker").$("timer").prepend(actionTxt);var player=matchData[i].c_PersonShort;if(matchData[i].n_ActionSet==5){var sub=" ("+matchData[i].c_SubPersonShort+")";}else{var sub="";}
$('#person'+i+HorA).text(player+sub);$('#actionMins'+i).text(actionTime);switch(actionSet){case 1:if(actionType==12){action="pen";}else{action="goal";}
break;case 2:if(actionType==12){action="pen";}else{action="miss";}
break;case 3:if(actionType==2048){action="yellow";}else{action="red";}
break;case 5:action="sub";break;}
var imgHTML="<img src='images/"+action+".png' height='20px' width='20px'>";$('#type'+i+HorA).html(imgHTML);$('.key').css({'display':'table-cell','font-style':'italic','padding-left':'5px'});$('.action').css({'display':'inline-table','height':'20px','width':'100%','font-size':'12px','font-family':'pragmatica-web, sans-serif','text-align':'left','border-bottom':'solid 1px rgb(150,150,150)','border-top':'solid 1px rgba(255,255,255,0.6)'});$(".period4").css({'background-color':'rgba(255,170,50,0.1)'});$(".period6, .period8").css({'background-color':'rgba(255,0,0,0.1)'});$(".period10").css({'background-color':'rgba(255,40,0,0.3)'});$('.personh').css({'text-align':'right','display':'table-cell','width':'37%'});$('.actiontime').css({'background-color':'rgba(100,100,100,0.6)','text-align':'center','display':'table-cell','width':'12%','color':'rgb(255,255,255)'});$('.type').css({'display':'table-cell','width':'7%','text-align':'center'});$('.persona').css({'text-align':'left','display':'table-cell','width':'37%'});}
if(lastAction>7200000){lastTime=7200000;}else if((lastAction>6300000)&&(lastPeriod<7)){lastTime=6300000;}else if((lastAction>5400000)&&(lastPeriod==11)){lastTime=5400000;}else if((lastAction>5400000)&&(lastPeriod<5)){lastTime=5400000;}else if((lastAction>2700000)&&(lastPeriod<4)){lastTime=2700000;}else{lastTime=lastAction;}
if(lastPeriod==11){lastTimetxt=Math.round(lastTime/60000);}else if(lastPeriod<9){if(lastAction>0){lastTimetxt=Math.round(lastAction/60000);}}else{lastTimetxt="120";}
minutes.text(lastTimetxt);}
if(lastPeriod>5){}}},error:function(){console.log("Match not started");}});}
function getTeams(matchID,home,away){sym.getSymbol("matchtracker").$("matchSquadh").empty();sym.getSymbol("matchtracker").$("matchSquada").empty();var teamData;$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&q=teams&match="+matchID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){teamData=data;if(!teamData){getSquad(home,"home");getSquad(away,"away");sym.getSymbol("matchtracker").$("txt16").html(txtArr[17]);sym.getSymbol("matchtracker").$("txt17").html(txtArr[17]);sym.getSymbol("matchtracker").$("tableHeadh").fadeIn(0);sym.getSymbol("matchtracker").$("tableHeada").fadeIn(0);}else{var coach;var teamlist;var team;var hORa;sym.getSymbol("matchtracker").$("txt16").html(txtArr[16]);sym.getSymbol("matchtracker").$("txt17").html(txtArr[16]);sym.getSymbol("matchtracker").$("preloaderh").fadeOut(0);sym.getSymbol("matchtracker").$("preloadera").fadeOut(0);sym.getSymbol("matchtracker").$("tableHeadh").fadeOut(0);sym.getSymbol("matchtracker").$("tableHeada").fadeOut(0);for(var i=0;i<teamData.length;i++){if(teamData[i].n_HomeOrAway==1){teamlist="matchSquadh";hORa='h';}else if(teamData[i].n_HomeOrAway==-1){teamlist="matchSquada";hORa='a';}
if(teamData[i].n_ActionSet<8){if(teamData[i].n_ActionSet==4){var lineupTxt="<div class='lineup' id='lineup"+i+"'>";}else if(teamData[i].n_ActionSet==5||teamData[i].n_ActionSet==6){var lineupTxt="<div class='substitute' id='lineup"+i+"'>";}
lineupTxt+="<div class='shirtNr' id='teamShirt"+i+"'></div>";lineupTxt+="<div class='playerNm' id='teamPerson"+i+"'></div>";lineupTxt+="</div>";sym.getSymbol("matchtracker").$("matchSquad"+hORa).append(lineupTxt);}
if(teamData[i].n_FunctionType==16){coach="<div style='padding-left:3px'><b>"+teamData[i].c_Person+"</b> <span style='text-align:right; font-style:oblique; font-size:12px'>"+teamData[i].c_PersonNatioShort+"</span></div>";sym.getSymbol("matchtracker").$("matchSquad"+hORa).prepend(coach);}
sym.getSymbol("matchtracker").$("matchSquad"+hORa).css({'font-family':'pragmatica-web,sans-serif','font-size':'13px'});$('.lineup').css({'width':'100%','display':'inline-table'});$('.substitute').css({'width':'100%','display':'inline-table','font-style':'oblique'});$('.shirtNr').css({'width':'10%','display':'table-cell','text-align':'left','padding-left':'3px'});$('.playerNm').css({'width':'90%','display':'table-cell','text-align':'left','padding-left':'5px'});var actionMins;if(teamData[i].c_ActionMinute==null){actionMins="";}else{actionMins=" ("+teamData[i].c_ActionMinute+")";}
$('#teamShirt'+i).text(teamData[i].n_ShirtNr);$('#teamPerson'+i).html(teamData[i].c_Person+actionMins);$('#subPerson'+i).text(teamData[i].c_SubPersonShort);var posn=teamData[i].n_Position;}}}});}
function getSquad(team,homeOrAway){$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&squad="+team,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){squadData=data;var hORa=(homeOrAway=="home")?"h":"a";for(var i=0;i<squadData.length;i++){var shirtNr=(squadData[i].n_ShirtNr!=null)?squadData[i].n_ShirtNr:"";var player=squadData[i].c_Person;var ycards=squadData[i].n_CardsYellow;var rcards=squadData[i].n_CardsRed;var cards=ycards+"/"+rcards;var goals=squadData[i].n_Goals;var position=squadData[i].n_FunctionCode;var contractEnd=(squadData[i].d_ContractEndDate==null)?endWC:parsedDate(squadData[i].d_ContractEndDate);if(todayTime<contractEnd){if(position>0&&position<16){var squadlist="<div id='"+hORa+"player"+i+"'>";squadlist+="<div class='squadCol1' id='"+hORa+"sqdshirt"+i+"'></div>";squadlist+="<div class='squadCol2' id='"+hORa+"sqdplayerName"+i+"'></div>";squadlist+="<div class='squadCol3' id='"+hORa+"sqdcards"+i+"'></div>";squadlist+="<div class='squadCol4' id='"+hORa+"sqdgls"+i+"'></div>";squadlist+="</div>";}
sym.getSymbol("matchtracker").$("matchSquad"+hORa).append(squadlist);sym.getSymbol("matchtracker").$("preloader"+hORa).fadeOut(0);$('#'+hORa+'player'+i).css({'width':'100%','font-size':'12px','font-family':'pragmatica-web, sans-serif','display':'inline-table'});$('.squadCol1').css({'width':'8%','color':'rgb(0,156,178)','padding-left':'3px','text-align':'right','display':'table-cell'});$('.squadCol2').css({'width':'72%','padding-left':'3%','display':'table-cell'});$('#'+hORa+'sqdplayerName'+i).css({'font-weight':400});$('.squadCol3').css({'width':'10%','display':'table-cell','text-align':'center'});$('.squadCol4').css({'width':'10%','display':'table-cell','text-align':'right'});$('#'+hORa+'sqdshirt'+i).text(shirtNr);$('#'+hORa+'sqdplayerName'+i).text(player);$('#'+hORa+'sqdcards'+i).text(cards);$('#'+hORa+'sqdgls'+i).text(goals);}}}});}
function pieChart(hwins,awins,draws,placeHolder){var canvasWidth=145,canvasHeight=90,outerRadius=45,color=d3.scale.ordinal().range(["#006666","#4e9799","#33c5cc","#FF6666"]);var dataSet=[{"legendLabel":"Won","magnitude":awins},{"legendLabel":"Drawn","magnitude":draws},{"legendLabel":"Won","magnitude":hwins}];var vis=d3.select(placeHolder).append("svg:svg").data([dataSet]).attr("width",canvasWidth).attr("height",canvasHeight).append("svg:g").attr("transform","translate("+canvasWidth/2+","+canvasHeight/2+")").style("-webkit-transform","translate("+canvasWidth/2+"px,"+canvasHeight/2+"px)");var arc=d3.svg.arc().outerRadius(outerRadius).innerRadius(outerRadius-30);var pie=d3.layout.pie().value(function(d){return d.magnitude;}).sort(function(d){return null;});var arcs=vis.selectAll("g.slice").data(pie).enter().append("svg:g").attr("class","slice");arcs.append("svg:path").attr("fill",function(d,i){return color(i);}).attr("d",arc);}
function getH2H(match){$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&q=h2hsum&match="+match,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){sym.getSymbol("matchtracker").$("h2hmatch").empty();sym.getSymbol("matchtracker").$("h2hgoals").empty();sym.getSymbol("matchtracker").$("h2hTxt1").empty();sym.getSymbol("matchtracker").$("h2hTxt2").empty();sym.getSymbol("matchtracker").$("h2hTxt3").empty();sym.getSymbol("matchtracker").$("h2hTxt4").fadeIn(0);h2hData=data;if(h2hData.length>0&&h2hData[0].n_Matches>0){var hwins=h2hData[0].n_MatchesWonHome;var awins=h2hData[0].n_MatchesWonAway;var draws=h2hData[0].n_MatchesDrawn;var hgoals=h2hData[0].n_GoalsForHome;var agoals=h2hData[0].n_GoalsForAway;var placeHolder="#Stage_matchtracker_h2hmatch";pieChart(hwins,awins,draws,placeHolder);sym.getSymbol("matchtracker").$("h2hTxt1").html(txtArr[25]+": <b>"+hwins+"</b>");sym.getSymbol("matchtracker").$("h2hTxt2").html(txtArr[26]+": <b>"+awins+"</b>");sym.getSymbol("matchtracker").$("h2hTxt3").html(txtArr[27]+": <b>"+draws+"</b>");sym.getSymbol("matchtracker").$("h2hTxt4").html(txtArr[35]);var barTxt="<div class='barGraph'>";barTxt+="<div id='capGoals'></div>";barTxt+="<div id='hbarGoals'></div>";barTxt+="<div id='abarGoals'></div>";barTxt+="</div>";sym.getSymbol("matchtracker").$("h2hgoals").append(barTxt);var hwidth=(hgoals/(hgoals+agoals)*100)+"%";var awidth=(agoals/(hgoals+agoals)*100)+"%";$("#hbarGoals").text(hgoals);$("#abarGoals").text(agoals);var acolor=(agoals==0)?'#33c5cc':'#006666';var hcolor=(hgoals==0)?'#006666':'#33c5cc';$("#capGoals").html(txtArr[28]);$(".barGraph").css({'font-family':'pragmatica-web,sans-serif','width':'100%','height':'20px','font-size':'13px','font-weight':700,'display':'inline-table'});$("#capGoals").css({'text-align':'center','width':'100%','display':'table-caption'});$("#hbarGoals").css({'background-color':hcolor,'color':'#ffffff','padding-left':'5px','padding-top':'2px','text-align':'left','display':'table-cell','width':hwidth});$("#abarGoals").css({'background-color':acolor,'color':'#ffffff','padding-right':'5px','padding-top':'2px','text-align':'right','width':awidth,'display':'table-cell'});}else{sym.getSymbol("matchtracker").$("h2hTxt4").fadeOut(0);sym.getSymbol("matchtracker").$("h2hmatch").append("<div style='font-family:pragmatica-web;text-align:center;font-size:14px'>"+txtArr[29]+"</div>");}}});}
function getmatchStats(match){$.ajax({type:"GET",url:dataURL,data:"gn="+gn+"&yr="+gnYear+"&q=stats&match="+match,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){sym.getSymbol("matchtracker").getSymbol("matchStats").$("chartHolder").empty();sym.getSymbol("matchtracker").getSymbol("matchStats").$("barCharts").empty();matchData=data;var bar;var placeHolder="#Stage_matchtracker_matchStats_chartHolder";if(matchData.length>0){function drawBar(){var barTxt="<div class='barGraph'>";barTxt+="<div id='cap"+bar+"'></div>";barTxt+="<div id='hbar"+bar+"'></div>";barTxt+="<div id='abar"+bar+"'></div>";barTxt+="</div>";sym.getSymbol("matchtracker").getSymbol("matchStats").$("barCharts").append(barTxt);}
for(var i=0;i<matchData.length;i++){if(matchData[i].n_ActionSet==13&&matchData[i].c_ActionShort=="BP"){var hPoss=matchData[i].n_HomePoints;var aPoss=matchData[i].n_AwayPoints;pieChart(hPoss,aPoss,0,placeHolder);sym.getSymbol("matchtracker").getSymbol("matchStats").$("hpiTxt").html(hPoss+"%");sym.getSymbol("matchtracker").getSymbol("matchStats").$("apiTxt").html(aPoss+"%");}else if(matchData[i].n_ActionSet==12){if(matchData[i].n_ActionSort==104){var hPts=matchData[i].n_HomePoints;var aPts=matchData[i].n_AwayPoints;bar="shots";drawBar();}
if(matchData[i].n_ActionSort==106){var hPts=matchData[i].n_HomePoints;var aPts=matchData[i].n_AwayPoints;bar="saves";drawBar();}
if(matchData[i].n_ActionSort==112){var hPts=matchData[i].n_HomePoints;var aPts=matchData[i].n_AwayPoints;bar="fouls";drawBar();}
var hwidth=(hPts/(hPts+aPts)*100)+"%";var awidth=(aPts/(hPts+aPts)*100)+"%";$("#hbar"+bar).text(hPts);$("#abar"+bar).text(aPts);$(".barGraph").css({'margin':'10px 0px','font-family':'pragmatica-web,sans-serif','width':'100%','height':'20px','font-size':'13px','display':'inline-table'});$("#cap"+bar).css({'text-align':'center','width':'100%','display':'table-caption','font-weight':700});$("#hbar"+bar).css({'background-color':'#33c5cc','color':'#ffffff','padding-left':'5px','text-align':'left','display':'table-cell','width':hwidth});$("#abar"+bar).css({'background-color':'#006666','color':'#ffffff','padding-right':'5px','text-align':'right','width':awidth,'display':'table-cell'});}
$("#capshots").html(txtArr[21]);$("#capsaves").html(txtArr[22]);$("#capfouls").html(txtArr[23]);}}}});}
$('img').on('dragstart',function(e){e.preventDefault();});});
//Edge binding end
})("stage");
//Edge symbol end:'stage'

//=========================================================

//Edge symbol: 'StyleMc'
(function(symbolName){})("StyleMc");
//Edge symbol end:'StyleMc'

//=========================================================

//Edge symbol: 'StyleBase'
(function(symbolName){})("StyleBase");
//Edge symbol end:'StyleBase'

//=========================================================

//Edge symbol: 'Match'
(function(symbolName){})("Match");
//Edge symbol end:'Match'

//=========================================================

//Edge symbol: 'Overview'
(function(symbolName){})("Overview");
//Edge symbol end:'Overview'

//=========================================================

//Edge symbol: 'Knockout'
(function(symbolName){})("Knockout");
//Edge symbol end:'Knockout'

//=========================================================

//Edge symbol: 'GroupStage'
(function(symbolName){})("GroupStage");
//Edge symbol end:'GroupStage'

//=========================================================

//Edge symbol: 'menuBtn'
(function(symbolName){})("MenuBtn");
//Edge symbol end:'MenuBtn'

//=========================================================

//Edge symbol: 'MenuBtns'
(function(symbolName){})("MenuBtns");
//Edge symbol end:'MenuBtns'

//=========================================================

//Edge symbol: 'Latest'
(function(symbolName){})("Latest");
//Edge symbol end:'Latest'

//=========================================================

//Edge symbol: 'TableHead'
(function(symbolName){})("TableHead");
//Edge symbol end:'TableHead'

//=========================================================

//Edge symbol: 'BarGraph'
(function(symbolName){})("BarGraph");
//Edge symbol end:'BarGraph'

//=========================================================

//Edge symbol: 'MatchStats'
(function(symbolName){})("MatchStats");
//Edge symbol end:'MatchStats'

//=========================================================

//Edge symbol: 'Preloader'
(function(symbolName){})("Preloader");
//Edge symbol end:'Preloader'

//=========================================================

//Edge symbol: 'example'
(function(symbolName){})("example");
//Edge symbol end:'example'
})(jQuery,AdobeEdge,"GraphicNews31990");