
(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 headline;var headlinetxt=sym.$("headlineTxt").css("pointer-events","none");var stand;var standtxt=sym.$("standTxt").css("pointer-events","none");var source;var sourcetxt=sym.$("sourceTxt").css("pointer-events","none");var menuIcon0;var menuIcon0txt=sym.getSymbol("menuBtn0").$("txt").css("pointer-events","none");var menuIcon1;var menuIcon1txt=sym.getSymbol("menuBtn1").$("txt").css("pointer-events","none");var menuIcon2;var menuIcon2txt=sym.getSymbol("menuBtn2").$("txt").css("pointer-events","none");var menuIcon3;var menuIcon3txt=sym.getSymbol("menuBtn3").$("txt").css("pointer-events","none");var menuTxt0;var menuTxt0txt=sym.$("menuTxt0").css("pointer-events","none");var menuTxt1;var menuTxt1txt=sym.$("menuTxt1").css("pointer-events","none");var menuTxt2;var menuTxt2txt=sym.$("menuTxt2").css("pointer-events","none");var menuTxt3;var menuTxt3txt=sym.$("menuTxt3").css("pointer-events","none");var menuTxt4;var consoletxt1txt=sym.$("consoleTxt1").css("pointer-events","none");var consoletxt2txt=sym.$("consoleTxt2").css("pointer-events","none");var flagBall;var flagBalltxt=sym.$("flagBall").css("pointer-events","none");var txt1
var txt1txt=sym.$("txt1").css("pointer-events","none");var txt2;var txt2txt=sym.$("txt2").css("pointer-events","none");var txt3;var txt3txt=sym.$("txt3").css("pointer-events","none");var txt4;var txt4txt=sym.$("txt4").css("pointer-events","none");var txt5;var txt5txt=sym.$("txt5").css("pointer-events","none");var txt6;var txt6txt=sym.$("txt6").css("pointer-events","none");var txt7;var txt7txt=sym.$("txt7").css("pointer-events","none");var txt8;var txt8txt=sym.$("txt8").css("pointer-events","none");var txt9;var txt9txt=sym.$("txt9").css("pointer-events","none");var txt10;var txt10txt=sym.getSymbol("phases").getSymbol("phaseBtn0").$("txt10");var txt11;var txt11txt=sym.getSymbol("phases").getSymbol("phaseBtn1").$("txt11");var txt12;var txt12txt=sym.getSymbol("phases").getSymbol("phaseBtn2").$("txt12");var txt13;var txt13txt=sym.getSymbol("phases").getSymbol("phaseBtn3").$("txt13");var txt14;var txt14txt=sym.$("txt14").css("pointer-events","none");var txt15;var txt15txt=sym.$("txt15").css("pointer-events","none");var txt16;var txt16txt=sym.$("txt16").css("pointer-events","none");var txt17;var txt17txt=sym.$("txt17").css("pointer-events","none");var txt18;var txt18txt=sym.getSymbol("resLive").$("txt18").css("pointer-events","none");var txt19;var txt19txt=sym.getSymbol("results").$("txt19").css("pointer-events","none");var txt20;var txt20txt=sym.getSymbol("results").$("txt20").css("pointer-events","none");var txt21;var txt21txt=sym.getSymbol("resLive").$("txt21").css("pointer-events","none");var txt22;var txt22txt=sym.getSymbol("phases").$("txt22").css("pointer-events","none");var txt23;var txt23txt=sym.getSymbol("results").$("txt23").css("pointer-events","none");var txt24;var txt24txt=sym.getSymbol("results").$("txt24").css("pointer-events","none");var txt25;var txt25txt=sym.getSymbol("resLive").getSymbol("pitstop").$("txt25").css("pointer-events","none");var txt26;var txt26txt=sym.getSymbol("results").$("txt26").css("pointer-events","none");var txt27;var txt27txt=sym.$("txt27").css("pointer-events","none");var txt28;var txt28txt=sym.$("txt28").css("pointer-events","none");var txt29;var txt29txt=sym.$("txt29").css("pointer-events","none");var txt30;var txt30txt=sym.$("txt30").css("pointer-events","none");var txt31;var txt31txt=sym.$("txt31").css("pointer-events","none");var txt32;var txt32txt=sym.$("txt32").css("pointer-events","none");var txt33;var txt33txt=sym.$("txt33").css("pointer-events","none");var txt34;var txt34txt=sym.$("txt34").css("pointer-events","none");var txt35;var txt35txt=sym.$("txt35").css("pointer-events","none");var txt36;var txt36txt=sym.$("txt36").css("pointer-events","none");var txt37;var txt37txt=sym.$("txt37").css("pointer-events","none");var txt38;var txt38txt=sym.$("txt38").css("pointer-events","none");var txt39;var txt39txt=sym.$("txt39").css("pointer-events","none");var txt40;var txt40txt=sym.$("txt40").css("pointer-events","none");var string;var corners;var cornerTxt0=sym.$("corner0txt").css("pointer-events","none");var cornerTxt1=sym.$("corner1txt").css("pointer-events","none");var cornerTxt2=sym.$("corner2txt").css("pointer-events","none");var cornerTxt3=sym.$("corner3txt").css("pointer-events","none");var cornerTxt4=sym.$("corner4txt").css("pointer-events","none");var cornerTxt5=sym.$("corner5txt").css("pointer-events","none");var cornerTxt6=sym.$("corner6txt").css("pointer-events","none");var cornerTxt7=sym.$("corner7txt").css("pointer-events","none");var cornerTxt8=sym.$("corner8txt").css("pointer-events","none");var cornerTxt9=sym.$("corner9txt").css("pointer-events","none");var cornerTxt10=sym.$("corner10txt").css("pointer-events","none");$.ajax({type:"GET",url:"GN30291.xml",dataType:"xml",success:function(xml){headline=$(xml).find('headline').text();headlinetxt.html(headline);stand=$(xml).find('stand').text();standtxt.html(stand);source=$(xml).find('source').text();sourcetxt.html(source);menuIcon0=$(xml).find('menuIcon0').text();menuIcon0txt.html(menuIcon0);menuIcon1=$(xml).find('menuIcon1').text();menuIcon1txt.html(menuIcon1);menuIcon2=$(xml).find('menuIcon2').text();menuIcon2txt.html(menuIcon2);menuIcon3=$(xml).find('menuIcon3').text();menuIcon3txt.html(menuIcon3);menuTxt0=$(xml).find('menuTxt0').text();menuTxt0txt.html(menuTxt0);menuTxt1=$(xml).find('menuTxt1').text();menuTxt2=$(xml).find('menuTxt2').text();menuTxt3=$(xml).find('menuTxt3').text();menuTxt4=$(xml).find('menuTxt4').text();menuTxt1txt.html(menuTxt1+menuTxt4);menuTxt2txt.html(menuTxt2+menuTxt4);menuTxt3txt.html(menuTxt3+menuTxt4);txt1=$(xml).find('txt1').text();txt1txt.html(txt1);txt2=$(xml).find('txt2').text();txt2txt.html(txt2);txt3=$(xml).find('txt3').text();txt3txt.html(txt3);txt4=$(xml).find('txt4').text();txt4txt.html(txt4)
txt5=$(xml).find('txt5').text();txt5txt.html(txt5);consoletxt1txt.html(txt5);txt6=$(xml).find('txt6').text();txt6txt.html(txt6);consoletxt2txt.html(txt6);flagBall=$(xml).find('flagBall').text();flagBalltxt.html(flagBall);txt7=$(xml).find('txt7').text();txt7txt.html(txt7);txt8=$(xml).find('txt8').text();txt8txt.html(txt8);txt9=$(xml).find('txt9').text();txt9txt.html(txt9);txt10=$(xml).find('txt10').text();txt10txt.html(txt10);txt11=$(xml).find('txt11').text();txt11txt.html(txt11);txt12=$(xml).find('txt12').text();txt12txt.html(txt12);txt13=$(xml).find('txt13').text();txt13txt.html(txt13);txt14=$(xml).find('txt14').text();txt14txt.html(txt14);txt15=$(xml).find('txt15').text();txt16=$(xml).find('txt16').text();txt16txt.html(txt16);txt17=$(xml).find('txt17').text();txt17txt.html(txt17);txt18=$(xml).find('txt18').text();txt18txt.html(txt18);txt19=$(xml).find('txt19').text();txt19txt.html(txt19);txt20=$(xml).find('txt20').text();txt20txt.html(txt20);txt21=$(xml).find('txt21').text();txt21txt.html(txt21);txt22=$(xml).find('txt22').text();txt22txt.html(txt22);txt23=$(xml).find('txt23').text();txt23txt.html(txt23);txt24=$(xml).find('txt24').text();txt24txt.html(txt24);txt25=$(xml).find('txt25').text();txt25txt.html(txt25);txt26=$(xml).find('txt26').text();txt26txt.html(txt26);txt27=$(xml).find('txt27').text();txt27txt.html(txt27);txt28=$(xml).find('txt28').text();txt28txt.html(txt28);txt29=$(xml).find('txt29').text();txt29txt.html(txt29);txt30=$(xml).find('txt30').text();txt30txt.html(txt30);txt31=$(xml).find('txt31').text();txt31txt.html(txt31);txt32=$(xml).find('txt32').text();txt32txt.html(txt32);txt33=$(xml).find('txt33').text();txt33txt.html(txt33);txt34=$(xml).find('txt34').text();txt34txt.html(txt34);txt35=$(xml).find('txt35').text();txt35txt.html(txt35);txt36=$(xml).find('txt36').text();txt36txt.html(txt36);txt37=$(xml).find('txt37').text();txt37txt.html(txt37);txt38=$(xml).find('txt38').text();txt38txt.html(txt38);txt39=$(xml).find('txt39').text();txt39txt.html(txt39);txt40=$(xml).find('txt40').text();txt40txt.html(txt40);string=$(xml).find('corners').text();corners=string.split(",");cornerTxt0.text(corners[0]);cornerTxt1.text(corners[1]);cornerTxt2.text(corners[2]);cornerTxt3.text(corners[3]);cornerTxt4.text(corners[4]);cornerTxt5.text(corners[5]);cornerTxt6.text(corners[6]);cornerTxt7.text(corners[7]);cornerTxt8.text(corners[8]);cornerTxt9.text(corners[9]);cornerTxt10.text(corners[10]);sym.$("txt4").animate({left:21+sym.$("txt3").width()+35},0);sym.$("bar2").animate({left:21+sym.$("txt3").width()+20},0);sym.$("iconGear").animate({left:7+sym.$("txt5").width()+5},0);sym.$("txt6").animate({left:7+sym.$("txt5").width()+70},0);sym.$("iconTime").animate({left:7+sym.$("txt5").width()+70+sym.$("txt6").width()+20},0);sym.$("txt7").animate({left:7+sym.$("txt5").width()+70+sym.$("txt6").width()+45},0);sym.$("iconDetect").animate({left:7+sym.$("txt5").width()+70+sym.$("txt6").width()+30+sym.$("txt7").width()+30},0);sym.$("txt8").animate({left:7+sym.$("txt5").width()+70+sym.$("txt6").width()+30+sym.$("txt7").width()+38+25},0);sym.$("iconActive").animate({left:7+sym.$("txt5").width()+70+sym.$("txt6").width()+30+sym.$("txt7").width()+38+sym.$("txt8").width()+40},0);sym.$("txt9").animate({left:7+sym.$("txt5").width()+70+sym.$("txt6").width()+30+sym.$("txt7").width()+38+sym.$("txt8").width()+30+45},0);}});sym.$("handMc").css("pointer-events","none");sym.$("handMc").animate({opacity:0},0);sym.$("handMc").delay(500).animate({opacity:1,left:493,top:21},2000);menuArray=[];for(var h=0;h<4;h++){var menuBtnSymbols=sym.getSymbol("menuBtn"+h);menuBtnSymbols.setVariable("menuId",h);menuArray.push(menuBtnSymbols);}
$.each(menuArray,function(count,menuInTheArray){var menuBtnItem=$(menuInTheArray);var menuBtnElement=menuInTheArray.getSymbolElement();menuBtnElement.bind("mouseover",{menuId:count},menuShow);menuBtnElement.bind("mouseout",{menuId:count},menuHide);})
sym.$("menuBtn0").bind("click touchstart",{menuId:0},menuBtnClick);sym.$("menuBtn0").bind("mouseover",{menuId:0},menuShow);sym.$("menuBtn0").bind("mouseout",{menuId:0},menuHide);function resetmenu(){for(var h=0;h<menuArray.length;h++){var resetmenu_arr=["menuTxt0","menuTxt1","menuTxt2","menuTxt3"];$.each(resetmenu_arr,function(index,value){sym.$(value).fadeOut(0);});menuArray[h].$("btnClick").fadeOut(0);menuArray[h].$("btnOver").fadeOut(0);sym.$("resLive").fadeOut(0);sym.$("phases").fadeOut(0);sym.$("results").fadeOut(0);}}
resetmenu();var raceInterval;function menuBtnClick(e){resetmenu();clearInterval(raceInterval);var menuMenu_id=(e.data.menuId);sym.getSymbol("menuBtn"+menuMenu_id).$("btnClick").fadeIn(0);sym.$("menuTxt"+menuMenu_id).fadeIn(0);if(menuMenu_id==0){sym.$("swiffycontainer").fadeIn(1000);sym.$("globe").fadeIn(1000);sym.$("resLive").fadeOut(1000);sym.$("phases").fadeOut(1000);sym.$("results").fadeOut(1000);}
if(menuMenu_id==1){raceInterval=setInterval(getRace,60000);sym.$("swiffycontainer").fadeOut(1000);sym.$("globe").fadeOut(1000);sym.$("resLive").fadeIn(1000);sym.$("phases").fadeOut(1000);sym.$("results").fadeOut(1000);sym.getSymbol("resLive").$("leadDriver").delay(500).fadeIn(1000);}
if(menuMenu_id==2){sym.$("swiffycontainer").fadeOut(1000);sym.$("globe").fadeOut(1000);sym.$("resLive").fadeOut(1000);sym.$("phases").fadeIn(1000);sym.$("results").fadeOut(1000);sym.getSymbol("phases").$("leadDriver").delay(500).fadeIn(1000);}
if(menuMenu_id==3){sym.$("swiffycontainer").fadeOut(1000);sym.$("globe").fadeOut(1000);sym.$("resLive").fadeOut(1000);sym.$("phases").fadeOut(1000);sym.$("results").fadeIn(1000);sym.getSymbol("results").$("txt23").delay(1000).fadeIn(1000);sym.getSymbol("results").$("txt24").delay(1000).fadeIn(1000);sym.getSymbol("results").$("standings").delay(500).fadeIn(1000);for(n=0;n<10;n++){carMove=32+n*430/nRaceDrivers;sym.getSymbol("results").$("car"+n).animate({'top':carMove},1000);}}}
function menuShow(e){var menuMenu_id=(e.data.menuId);sym.$('handMc').hide();sym.getSymbol("menuBtn"+menuMenu_id).$("btnOver").fadeIn(0);sym.$("menuTxt"+menuMenu_id).fadeIn(0);}
function menuHide(e){var menuMenu_id=(e.data.menuId);sym.getSymbol("menuBtn"+menuMenu_id).$("btnOver").fadeOut(0);sym.$("menuTxt"+menuMenu_id).fadeOut(0);}
sym.getSymbol("menuBtn0").$("btnClick").fadeIn(0);phaseBtnArray=[];for(var k=0;k<3;k++){var phaseBtnSymbols=sym.getSymbol("phases").getSymbol("phaseBtn"+k);phaseBtnSymbols.setVariable("phsId",k);phaseBtnArray.push(phaseBtnSymbols);}
var fpArray=["FP1","FP2","FP3"];var qArray=["Q1","Q2","Q3"];var raceID=832414;var dataURL=('http:'==document.location.protocol?"http://www2.graphicnews.com/":"https://www.graphicnews.org/")+"infostradasports/api.php";var raceData;var timer;var barHeight;var order;var raceFinished=0;var raceStage;var firstPhase;var phase;var resultCar;var scaleresult;var minTime;var scale;var nRaceDrivers;var points;var phaseClicker=function(phaseNo,stage){return function(e){getPhases(phaseNo);var ps=stage.substr(0,1);if(ps=="F"){$.each(fpArray,function(index,value){sym.getSymbol("phases").$(value).css({'opacity':0.6});});}else{$.each(qArray,function(index,value){sym.getSymbol("phases").$(value).css({'opacity':0.6});});}
sym.getSymbol("phases").$(stage).css({'opacity':1.0});};};var gridClicker=function(phaseNo){return function(e){getGrid(phaseNo);};};var showPhase=function(phaseNo,stage){return function(e){getPhases(phaseNo);var ps=stage.substr(0,1);if(ps=="F"){$.each(fpArray,function(index,value){sym.getSymbol("phases").$(value).show();});$.each(fpArray,function(index,value){sym.getSymbol("phases").$(value).css({'opacity':0.6});});$.each(qArray,function(index,value){sym.getSymbol("phases").$(value).hide();});sym.getSymbol("phases").$("FP1").css({'opacity':1.0});sym.getSymbol('phases').getSymbol('phaseBtn0').$('bg').css({'background-color':'rgb(255,255,255)'});sym.getSymbol('phases').getSymbol('phaseBtn1').$('bg').css({'background-color':'rgb(206,206,206)'});sym.getSymbol('phases').getSymbol('phaseBtn2').$('bg').css({'background-color':'rgb(206,206,206)'});}else{$.each(fpArray,function(index,value){sym.getSymbol("phases").$(value).hide();});$.each(qArray,function(index,value){sym.getSymbol("phases").$(value).show();});$.each(qArray,function(index,value){sym.getSymbol("phases").$(value).css({'opacity':0.6});});sym.getSymbol('phases').getSymbol('phaseBtn0').$('bg').css({'background-color':'rgb(206,206,206)'});sym.getSymbol('phases').getSymbol('phaseBtn1').$('bg').css({'background-color':'rgb(255,255,255)'});sym.getSymbol('phases').getSymbol('phaseBtn2').$('bg').css({'background-color':'rgb(206,206,206)'});}
sym.getSymbol("phases").$("grid").fadeOut(1000);sym.getSymbol("phases").$("graph").fadeIn(1000);e.preventDefault()}}
function getRace(){$.ajax({type:"GET",url:dataURL,data:"gn=30146&yr=2013&q=race&race="+raceID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){var racePhases=data;if(racePhases[0].b_Started==true){firstPhase=racePhases[0].n_PhaseID;getPhases(firstPhase);}
for(var i=0;i<racePhases.length;i++){phase=racePhases[i].n_PhaseID;if(racePhases[i].b_Finished==true){if(racePhases[i].n_Phase1Nr<4){raceStage="FP"+racePhases[i].n_Phase1Nr;sym.getSymbol("phases").$(raceStage).show();sym.getSymbol("phases").$(raceStage).click(phaseClicker(phase,raceStage));sym.getSymbol("phases").$("phaseBtn0").click(showPhase(firstPhase,raceStage));}else if(racePhases[i].n_Phase1Nr==4&&racePhases[i].n_Phase2Nr>0){raceStage="Q"+racePhases[i].n_Phase2Nr;sym.getSymbol("phases").$(raceStage).click(phaseClicker(phase,raceStage));sym.getSymbol("phases").$("phaseBtn1").click(showPhase(racePhases[3].n_PhaseID,raceStage));}else if(racePhases[i].n_Phase1Nr==5){sym.getSymbol("phases").$("phaseBtn2").click(gridClicker(phase));}else if(racePhases[i].n_Phase1Nr==6){raceStage="Race";sym.$("menuBtn3").bind("click touchstart",{menuId:3},menuBtnClick);menuTxt3txt.html(menuTxt3);sym.getSymbol("resLive").$("light").css({'background-color':'rgb(255,0,0)'});sym.getSymbol("resLive").$("txt10").html(txt13+txt17);sym.getSymbol("resLive").$("pitstop").fadeIn(0);sym.getSymbol("resLive").$("txt15").fadeIn(0);sym.getSymbol("resLive").$("lapCounter").fadeIn(0);getLive(phase);raceFinished=1;getInfo(phase);getStandings();}}else if(racePhases[i].b_Started==true&&racePhases[i].b_Current==true){if(racePhases[i].b_Race==true){raceStage="Race";sym.getSymbol("resLive").$("lapCounter").fadeIn(0);sym.getSymbol("resLive").$("txt15").fadeIn(0);}
getLive(phase);getInfo(phase);sym.getSymbol("resLive").$("light").css({'background-color':'rgb(0,200,50)'});}else{}
sym.getSymbol("phases").$(raceStage).css({"cursor":"pointer"});}}});}
getRace();raceInterval=setInterval(getRace,60000);sym.getSymbol("resLive").$("weather").append('<img src="images/weather0.png" width="27px" height="27px">');function getInfo(phaseID){$.ajax({type:"GET",url:dataURL,data:"gn=30146&yr=2013&q=info&race="+phaseID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){sym.getSymbol("resLive").$("weather").empty();if(data[0].n_WeatherConditionType!=null){var weather='<img src="images/weather'+data[0].n_WeatherConditionType+'.png" width="27px" height="27px">';sym.getSymbol("resLive").$("weather").append(weather);}
var sessionNo=(data[0].n_SessionNr>0)?data[0].n_SessionNr:"";if(data[0].b_FreePractice==true){sym.getSymbol("resLive").$("txt10").html(txt10+" "+sessionNo);txt21txt.html(txt21.substr(4,9));}else if(data[0].b_Qualifying==true){sym.getSymbol("resLive").$("txt10").html(txt11+" "+sessionNo);txt21txt.html(txt21.substr(4,9));}else if(data[0].b_StartingGrid==true){sym.getSymbol("resLive").$("txt10").html(txt12);txt21txt.html("");}else if(data[0].b_Race==true){txt21txt.html(txt21);sym.getSymbol("resLive").$("txt10").html(txt13+txt16);sym.getSymbol("resLive").$("pitstop").fadeIn(0);if(data[0].b_Finished==true){sym.getSymbol("resLive").$("txt10").html(txt13+txt17);}else{sym.getSymbol("resLive").$("txt10").html(txt13+txt16);}}
var laps=data[0].n_LapsScheduled;var lapsDriven=data[0].n_LapsDriven;var lapsAngle=360*lapsDriven/laps;sym.getSymbol("resLive").$("txt15").text(txt15+lapsDriven);if(lapsDriven/laps<0.5){sym.getSymbol("resLive").getSymbol("lapCounter").$("laps1").animate({rotate:lapsAngle},{step:function(now,fx){$(this).css('-webkit-transform','rotate('+now+'deg)');$(this).css('-moz-transform','rotate('+now+'deg)');$(this).css('-ms-transform','rotate('+now+'deg)');$(this).css('-op-transform','rotate('+now+'deg)');$(this).css('transform','rotate('+now+'deg)');},duration:'fast'},'linear');}else{sym.getSymbol("resLive").getSymbol("lapCounter").$("laps1").animate({rotate:180},{step:function(now,fx){$(this).css('-webkit-transform','rotate(180deg)');$(this).css('-moz-transform','rotate(180deg)');$(this).css('-moz-transform','rotate(180deg)');$(this).css('-ms-transform','rotate(180deg)');$(this).css('-op-transform','rotate(180deg)');$(this).css('transform','rotate(180deg)');},duration:'fast'},'linear');sym.getSymbol("resLive").getSymbol("lapCounter").$("laps2").show();sym.getSymbol("resLive").getSymbol("lapCounter").$("laps2").animate({rotate:lapsAngle},{step:function(now,fx){$(this).css('-webkit-transform','rotate('+now+'deg)');$(this).css('-moz-transform','rotate('+now+'deg)');$(this).css('-ms-transform','rotate('+now+'deg)');$(this).css('-op-transform','rotate('+now+'deg)');$(this).css('transform','rotate('+now+'deg)');},duration:'fast'},'linear');}}});}
function getLive(phaseID){$.ajax({type:"GET",url:dataURL,data:"gn=30146&yr=2013&race="+phaseID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){raceData=data;nRaceDrivers=raceData.length;if(raceData.length>20){barHeight=((430/raceData.length)-2);}else{barHeight=19;}
if(raceStage=="Race"){minTime=raceData[0].n_TimeRel;var mxm=(minTime!=null)?minTime:0;var timeRel=0;for(var n=0;n<raceData.length;n++){if(raceData[n].n_TimeRel!=null&&raceData[n].n_TimeRel>mxm){mxm=raceData[n].n_TimeRel;}}}else if(raceData[0].n_TimeAbs!=undefined){minTime=raceData[0].n_TimeAbs;var mxm=(minTime!=null)?minTime:0;var timeRel=1;for(var n=0;n<raceData.length;n++){if(raceData[n].n_TimeAbs!=null&&raceData[n].n_TimeAbs>mxm){mxm=raceData[n].n_TimeAbs;}
if(raceData[n].n_TimeAbs!=null&&raceData[n].n_TimeAbs<minTime){minTime=raceData[n].n_TimeAbs;}}}
sym.getSymbol("results").$("graph").empty();for(var i=0;i<raceData.length;i++){if(i==0){sym.getSymbol("resLive").$("graph").empty();sym.getSymbol("resLive").$("helmetPic").empty();sym.getSymbol("resLive").$("driverPic").empty();sym.getSymbol("resLive").$("carPic").empty();sym.getSymbol("results").$("helmetPic").empty();sym.getSymbol("results").$("driverPic").empty();var imgHelmet='<img src="drivers/'+raceData[i].n_PersonID+'.png" width="105px" height="82px">';var imgDriver='<img src="drivers/'+raceData[i].n_PersonID+'.jpg" width="105px">';var imgCar='<img src="cars/'+raceData[i].c_TeamShort+'.png" width="330px">';var leadDriver='<b>'+raceData[i].c_Person+'</b> <span style="font-size:12px"><i>'+raceData[i].c_NOCShort+'</i></span>';sym.getSymbol("resLive").$("txt13").html(leadDriver);sym.getSymbol("resLive").$("txt14").text(raceData[i].c_ConstructorTeam);sym.getSymbol("resLive").$("helmetPic").append(imgHelmet);sym.getSymbol("resLive").$("driverPic").append(imgDriver);sym.getSymbol("resLive").$("carPic").append(imgCar);sym.getSymbol("results").$("helmetPic").append(imgHelmet);sym.getSymbol("results").$("driverPic").append(imgDriver);sym.getSymbol("results").$("txt13").html(leadDriver);}
var tableText="<div class='race'><div id='driverdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='driver"+i+"'width='130px'></td><td id='team"+i+"' style='font-style:italic' width='35px'></td><td id='pitstops"+i+"' style='font-weight:bold' width='20px'></td><td id='time"+i+"'></td></tr></table></div></div>";var resultsText="<div class='resultrace'><div class='resultdata'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='resultorder"+i+"' width='10%'></td><td id='resultdriver"+i+"' width='70%'></td><td id='resultteam"+i+"' style='font-style:italic' width='20%'></td></tr></table></div><div id='points"+i+"'></div></div>";sym.getSymbol("resLive").$("graph").append(tableText);$('#driver'+i).text(raceData[i].c_Person);$('#team'+i).text(raceData[i].c_TeamShort);if(raceData[i].n_PitStops){$('#pitstops'+i).text(raceData[i].n_PitStops);$('#pitstops'+i).css({'font-weight':'bold','text-align':'center','color':'rgb(255,255,255)','background-color':'rgba(0,0,0,0.15)'});}
$('#time'+i).text(raceData[i].c_Result);if(timeRel==1){var hrs=(raceData[i].n_TimeAbs>3600000)?Math.floor(raceData[i].n_TimeAbs/3600000)+":":"";var mins=(raceData[i].n_TimeAbs>3600000)?Math.floor((raceData[i].n_TimeAbs%3600000)/60000):Math.floor(raceData[i].n_TimeAbs/60000);if(mins<10){mins="0"+mins+":";}else if(mins<1){mins="00:";}else{mins=mins+":";}
var secs=(raceData[i].n_TimeAbs>3600000)?(raceData[i].n_TimeAbs%3600000%60000)/1000:(raceData[i].n_TimeAbs%60000%60000)/1000;if(secs<10){secs="0"+secs;}
var timing=hrs+mins+secs;$('#time'+i).text(timing);if(minTime==mxm&&raceData[i].n_TimeAbs==mxm){scale=100;}else if(raceData[i].n_TimeAbs==null){scale=57;}else{scale=100-((raceData[i].n_TimeAbs-minTime)*43/(mxm-minTime));}}else if(timeRel==0){var txt15lc=txt15.toLowerCase();if(raceData[i].n_RankSort==1&&raceData[i].n_TimeAbs==null){scale=100;$('#time'+i).text();}else if(raceData[i].n_TimeRel==null){scale=57;if(raceData[i].c_ResultSuffix==null){$('#time'+i).text("+"+raceData[i].n_LapsRel+" "+txt15lc.substr(0,4));}else{$('#time'+i).text(raceData[i].c_ResultSuffix);}}else{scale=100-(raceData[i].n_TimeRel*43/mxm);$('#time'+i).text(raceData[i].c_Result);}}
$(".race").css({'font-size':'13px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$("#driverdata"+i).css({'height':barHeight+'px','width':scale+'%','background-color':'rgb(230,225,215)','padding-left':'5px','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)'});$("#time"+i).css({'text-align':'right','padding-right':'5px'});if(raceFinished==1){sym.getSymbol("results").$("graph").append(resultsText);sym.getSymbol("results").$("car"+i).empty();resultCar='<img src="cars/'+raceData[i].c_TeamShort+'o.png" width="30px">';order=raceData[i].n_RankSort;if(raceData[i].c_ChampionshipPoints!=undefined){points=raceData[i].c_ChampionshipPoints;}else{points=0;}
if(order<11){scaleresult=94-(i*6);}else{scaleresult=37;}
$('#resultorder'+i).html("<b>"+order+"</b>");$('#resultdriver'+i).text(raceData[i].c_Person);$('#resultteam'+i).text(raceData[i].c_TeamShort);$('#points'+i).html("<b>"+points+"</b>");$(".resultrace").css({'font-size':'13px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$(".resultdata").css({'height':barHeight+'px','width':'34%','float':'left','padding-left':'3px'});$("#points"+i).css({'height':barHeight+'px','background-color':'rgb(230,225,215)','text-align':'right','padding-right':'5px','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)','width':scaleresult+'%'});sym.getSymbol("results").$("car"+i).append(resultCar);}}
sym.$("menuBtn1").unbind("click touchstart");sym.$("menuBtn1").bind("click touchstart",{menuId:1},menuBtnClick);menuTxt1txt.html(menuTxt1);}});}
var scalePhase;function getPhases(phaseID){$.ajax({type:"GET",url:dataURL,data:"gn=30146&yr=2013&race="+phaseID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){var phaseData=data;sym.$("menuBtn2").unbind("click touchstart");sym.$("menuBtn2").bind("click touchstart",{menuId:2},menuBtnClick);menuTxt2txt.html(menuTxt2);if(phaseData.length>20){barHeight=(430/phaseData.length)-2;}else{barHeight=19;}
minTime=phaseData[0].n_TimeAbs;var max=(minTime!=null)?minTime:0;for(var n=0;n<phaseData.length;n++){if(phaseData[n].n_TimeAbs!=null&&phaseData[n].n_TimeAbs>max){max=phaseData[n].n_TimeAbs;}
if(phaseData[n].n_TimeAbs!=null&&phaseData[n].n_TimeAbs<minTime){minTime=phaseData[n].n_TimeAbs;}}
for(var i=0;i<phaseData.length;i++){if(i==0){sym.getSymbol("phases").$("graph").empty();sym.getSymbol("phases").$("helmetPic").empty();sym.getSymbol("phases").$("driverPic").empty();sym.getSymbol("phases").$("carPic").empty();var imgHelmet='<img src="drivers/'+phaseData[i].n_PersonID+'.png" width="105px" height="82px">';var imgDriver='<img src="drivers/'+phaseData[i].n_PersonID+'.jpg" width="105px">';var imgCar='<img src="cars/'+phaseData[i].c_TeamShort+'.png" width="330px">';var leadDriver='<b>'+phaseData[i].c_Person+'</b> <span style="font-size:12px"><i>'+phaseData[i].c_NOCShort+'</i></span>';sym.getSymbol("phases").$("txt13").html(leadDriver);sym.getSymbol("phases").$("txt14").text(phaseData[i].c_ConstructorTeam);sym.getSymbol("phases").$("helmetPic").append(imgHelmet);sym.getSymbol("phases").$("driverPic").append(imgDriver);sym.getSymbol("phases").$("carPic").append(imgCar);}
var phaseText="<div class='phaserace'><div class='phasedriverdata'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='phasedriver"+i+"' width='75%'></td><td id='phaseteam"+i+"' style='font-style:italic' width='25%'></td></tr></table></div><div id='phasetime"+i+"'></div></div>";sym.getSymbol("phases").$("graph").append(phaseText);$('#phasedriver'+i).text(phaseData[i].c_Person);$('#phaseteam'+i).text(phaseData[i].c_TeamShort);var mins=Math.floor(phaseData[i].n_TimeAbs/60000)+":";var secs=(phaseData[i].n_TimeAbs%60000%60000)/1000;if(secs<10){secs="0"+secs;}
$('#phasetime'+i).text(mins+secs);if(minTime==max&&phaseData[i].n_TimeAbs==max){scalePhase=100;}else if(phaseData[i].n_TimeAbs==null){scalePhase=59;}else{scalePhase=100-((phaseData[i].n_TimeAbs-minTime)*41/(max-minTime));}
$(".phaserace").css({'font-size':'13px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$(".phasedriverdata").css({'height':barHeight+'px','width':'40%','float':'left','padding-left':'3px'});$("#phasetime"+i).css({'height':barHeight+'px','background-color':'rgb(230,225,215)','text-align':'right','padding-right':'5px','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)','width':scalePhase+'%'});}}});}
function getGrid(phaseID){$.ajax({type:"GET",url:dataURL,data:"gn=30146&yr=2013&race="+phaseID,contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){var gridData=data;$.each(fpArray,function(index,value){sym.getSymbol("phases").$(value).hide();});$.each(qArray,function(index,value){sym.getSymbol("phases").$(value).hide();});sym.getSymbol('phases').getSymbol('phaseBtn0').$('bg').css({'background-color':'rgb(206,206,206)'});sym.getSymbol('phases').getSymbol('phaseBtn1').$('bg').css({'background-color':'rgb(206,206,206)'});sym.getSymbol('phases').getSymbol('phaseBtn2').$('bg').css({'background-color':'rgb(255,255,255)'});sym.getSymbol("phases").$("grid").fadeIn(1000);sym.getSymbol("phases").$("graph").fadeOut(1000);var gridMove;var go;for(var i=0;i<gridData.length;i++){sym.getSymbol("phases").getSymbol("grid").$("grid"+i).empty();var gridText="<div class='gridlist'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='gridorder"+i+"' width='10%'></td><td id='griddriver"+i+"' width='62%'></td><td id='gridteam"+i+"' width='28%' font-style:italic'></td></tr></table></div>";if(i<12){sym.getSymbol("phases").getSymbol("grid").$("grid1txt").append(gridText);}else{sym.getSymbol("phases").getSymbol("grid").$("grid2txt").append(gridText);}
var gridCar='<img src="cars/'+gridData[i].c_TeamShort+'o.png" width="24px">';var order=gridData[i].n_RankSort;$('#gridorder'+i).html("<b>"+order+"</b>");$('#griddriver'+i).text(gridData[i].c_Person);$('#gridteam'+i).text(gridData[i].c_TeamShort);$(".gridlist").css({'font-size':'13px','font-family':'pragmatica-web, sans-serif','width':'100%','height':'35px'});sym.getSymbol("phases").getSymbol("grid").$("grid"+i).append(gridCar);if(i<12){go=i;}else{go=i-12;}
if(i%2==0){gridMove=5+go*35;}else{gridMove=-15+go*35;}
sym.getSymbol("phases").getSymbol("grid").$("grid"+i).delay(i*400).animate({'top':gridMove},1000);}}});}
function getStandings(){$.ajax({type:"GET",url:dataURL,data:"gn=30146&q=champdrivers&yr=2013&race=",contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){var rankData=data;for(var i=0;i<rankData.length;i++){if(i<10){if(i%2==0){var rankText="<div class='rankingeven'><table style='width:98%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='rank"+i+"' width='20%'></td><td id='rankdriver"+i+"' width='55%' style='font-weight:600'></td><td id='rankpoints"+i+"' width='20%' style='text-align:right; font-style:italic'></td></tr></table></div>";}else{var rankText="<div class='rankingodd'><table style='width:98%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='rank"+i+"' width='20%'></td><td id='rankdriver"+i+"' width='55%' style='font-weight:600'></td><td id='rankpoints"+i+"' width='20%' style='text-align:right; font-style:italic'></td></tr></table></div>";}}
sym.getSymbol("results").$("standings").append(rankText);$('#rank'+i).text(rankData[i].n_RankSort);$('#rankdriver'+i).text(rankData[i].c_PersonShort);$('#rankpoints'+i).text((rankData[i].n_PointsSort)/1000);$(".rankingeven").css({'background-color':'rgb(150,210,255)','font-size':'13px','font-family':'pragmatica-web, sans-serif','width':'100%'});$(".rankingodd").css({'background-color':'rgb(213,239,255)','font-size':'13px','font-family':'pragmatica-web, sans-serif','width':'100%'});}}});}});
//Edge binding end 
})("stage");
//Edge symbol end:'stage'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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