
(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.getSymbol("styleMc").$("headlineTxt").css("pointer-events","none");var menuIcon0;var menuIcon0txt=sym.getSymbol("styleMc").getSymbol("menuBtn0").$("txt").css("pointer-events","none");var menuIcon1;var menuIcon1txt=sym.getSymbol("styleMc").getSymbol("menuBtn1").$("txt").css("pointer-events","none");var menuIcon2;var menuIcon2txt=sym.getSymbol("styleMc").getSymbol("menuBtn2").$("txt").css("pointer-events","none");var menuIcon3;var menuIcon3txt=sym.getSymbol("styleMc").getSymbol("menuBtn3").$("txt").css("pointer-events","none");var menuIcon4;var menuIcon4txt=sym.getSymbol("styleMc").getSymbol("menuBtn4").$("txt").css("pointer-events","none");var menuIcon5;var menuIcon5txt=sym.getSymbol("styleMc").getSymbol("menuBtn5").$("txt").css("pointer-events","none");var menuIcon6;var menuIcon6txt=sym.getSymbol("styleMc").getSymbol("menuBtn6").$("txt").css("pointer-events","none");var menuIcon7;var menuIcon7txt=sym.getSymbol("styleMc").getSymbol("menuBtn7").$("txt").css("pointer-events","none");var menuTxt0;var menuTxt0txt=sym.getSymbol("styleMc").$("menuTxt0").css("pointer-events","none");var menuTxt1;var menuTxt1txt=sym.getSymbol("styleMc").$("menuTxt1").css("pointer-events","none");var menuTxt2;var menuTxt2txt=sym.getSymbol("styleMc").$("menuTxt2").css("pointer-events","none");var menuTxt3;var menuTxt3txt=sym.getSymbol("styleMc").$("menuTxt3").css("pointer-events","none");var menuTxt4;var menuTxt4txt=sym.getSymbol("styleMc").$("menuTxt4").css("pointer-events","none");var menuTxt5;var menuTxt5txt=sym.getSymbol("styleMc").$("menuTxt5").css("pointer-events","none");var menuTxt6;var menuTxt6txt=sym.getSymbol("styleMc").$("menuTxt6").css("pointer-events","none");var teamstxt=sym.getSymbol("screen2").$("teamsTxt").css("pointer-events","none");var countstring;var countdown;var timetxt0=sym.getSymbol("screen0").$("timeTxt0").css("pointer-events","none");var timetxt1=sym.getSymbol("screen0").$("timeTxt1").css("pointer-events","none");var timetxt2=sym.getSymbol("screen0").$("timeTxt2").css("pointer-events","none");var timetxt3=sym.getSymbol("screen0").$("timeTxt3").css("pointer-events","none");var timetxt4=sym.getSymbol("screen0").$("timeTxt4").css("pointer-events","none");var string;var teams;var string1;var teamshort;var teamname;var longname;var countdowncaps;var txt1;var txt2;var txt3;var txt3txt=sym.getSymbol("screen2").$("txt3").css("pointer-events","none");var txt4;var txt4txt=sym.getSymbol("screen2").$("txt4").css("pointer-events","none");var txt5;var txt5txt=sym.getSymbol("screen3").$("txt5").css("pointer-events","none");var txt6;var txt6txt=sym.getSymbol("screen2").$("txt6").css("pointer-events","none");var txt7;var txt7txt=sym.getSymbol("screen2").$("txt7").css("pointer-events","none");var txt8;var txt8txt=sym.getSymbol("screen3").$("txt8").css("pointer-events","none");var txt9;var txt9txt=sym.getSymbol("screen3").$("txt9").css("pointer-events","none");var txt10;var txt10txt=sym.getSymbol("screen3").$("txt10").css("pointer-events","none");var txt11;var txt12;var txt12txt=sym.getSymbol("screen5").$("txt12").css("pointer-events","none");var txt13;var txt13txt=sym.getSymbol("screen6").$("txt13").css("pointer-events","none");var txt14;var txt14txt=sym.getSymbol("screen5").$("txt14").css("pointer-events","none");var txt15;var txt15txt=sym.getSymbol("screen7").$("txt15").css("pointer-events","none");var race0txt;var racetxt0;var racetxt0txt=sym.getSymbol("screen4").$("raceTxt0").css("pointer-events","none");var racetxt1;var racetxt1txt=sym.getSymbol("screen4").$("raceTxt1").css("pointer-events","none");var racetxt2;var racetxt2txt=sym.getSymbol("screen4").$("raceTxt2").css("pointer-events","none");var racetxt3;var racetxt3txt=sym.getSymbol("screen4").$("raceTxt3").css("pointer-events","none");var racetxt4;var racetxt4txt=sym.getSymbol("screen4").$("raceTxt4").css("pointer-events","none");var racetxt5;var racetxt5txt=sym.getSymbol("screen4").$("raceTxt5").css("pointer-events","none");var racetxt6;var racetxt6txt=sym.getSymbol("screen4").$("raceTxt6").css("pointer-events","none");var racetxt7;var racetxt7txt=sym.getSymbol("screen4").$("raceTxt7").css("pointer-events","none");var racetxt8;var racetxt8txt=sym.getSymbol("screen4").$("raceTxt8").css("pointer-events","none");var racetxt9;var racetxt9txt=sym.getSymbol("screen4").$("raceTxt9").css("pointer-events","none");var racetxt10;var racetxt10txt=sym.getSymbol("screen4").$("raceTxt10").css("pointer-events","none");var racetxt11;var racetxt11txt=sym.getSymbol("screen4").$("raceTxt11").css("pointer-events","none");var string2;var races;var string3;var racestats;var pitstoptxt;var carPos=0;var hidden=1;var showTeam=function(teamdetails,longteam){return function(e){getStats(teamdetails,3);if(carPos==0){carPos=1;hidden=0;}else{carPos=0;hidden=1;}
sym.getSymbol("screen3").$("driveCar"+carPos).css({'left':-400});sym.getSymbol("screen3").$("teamsTxt").html("<b>"+longteam+"</b>");sym.getSymbol("screen3").getSymbol("driveCar"+carPos).$("mainCar").attr("src","cars/"+teamdetails+"big.png");sym.getSymbol("screen3").getSymbol("driveCar"+carPos).$("reflection").attr("src","cars/"+teamdetails+"big.png");sym.getSymbol("screen3").getSymbol("driveCar"+carPos).$("driverHead").attr("src","drivers/"+teamdetails+".png");sym.getSymbol("screen3").getSymbol("driveCar"+carPos).$("bkwheel").attr("src","cars/"+teamdetails+"bk.png");sym.getSymbol("screen3").getSymbol("driveCar"+carPos).$("frwheel").attr("src","cars/"+teamdetails+"fr.png");sym.getSymbol("screen3").$("driveCar"+carPos).delay(200).animate({left:415},800);sym.getSymbol("screen3").getSymbol("driveCar"+carPos).play();sym.getSymbol("screen3").$("driveCar"+hidden).delay(100).animate({left:815},800);sym.getSymbol("screen3").getSymbol("driveCar"+hidden).play();e.preventDefault()};};function hideTeamBtn(){$(this).fadeOut(0);$(this).delay(1000).fadeIn(500);}
$.ajax({type:"GET",url:"GN30349.xml",dataType:"xml",success:function(xml){headline=$(xml).find('headline').text();headlinetxt.html(headline);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);menuIcon4=$(xml).find('menuIcon4').text();menuIcon4txt.html(menuIcon4);menuIcon5=$(xml).find('menuIcon5').text();menuIcon5txt.html(menuIcon5);menuIcon6=$(xml).find('menuIcon6').text();menuIcon6txt.html(menuIcon6);menuIcon7=$(xml).find('menuIcon7').text();menuIcon7txt.html(menuIcon7);menuTxt0=$(xml).find('menuTxt0').text();menuTxt0txt.html(menuTxt0);menuTxt1=$(xml).find('menuTxt1').text();menuTxt1txt.html(menuTxt1);menuTxt2=$(xml).find('menuTxt2').text();menuTxt2txt.html(menuTxt2);menuTxt3=$(xml).find('menuTxt3').text();menuTxt3txt.html(menuTxt3);race0txt=$(xml).find('race0').text();menuTxt4=$(xml).find('menuTxt4').text();menuTxt4txt.html(race0txt+" "+menuTxt4);menuTxt5=$(xml).find('menuTxt5').text();menuTxt5txt.html(race0txt+" "+menuTxt5);menuTxt6=$(xml).find('menuTxt6').text();menuTxt6txt.html(race0txt+" "+menuTxt6);countstring=$(xml).find('countdown0').text();countdown=countstring.split(",");timetxt0.text(countdown[0]);timetxt1.text(countdown[1]);timetxt2.text(countdown[2]);timetxt3.text(countdown[3]);timetxt4.text(countdown[4]);txt1=$(xml).find('txt1').text();txt2=$(xml).find('txt2').text();countdowncaps=[txt1,txt2];txt10=$(xml).find('txt3').text();txt10txt.html(txt10.toUpperCase());txt11=$(xml).find('txt11').text();txt12=$(xml).find('txt12').text();txt13=$(xml).find('txt13').text();txt13txt.html(txt13);pitstoptxt=$(xml).find('txt14').text()
txt15=$(xml).find('txt15').text();txt15txt.html(txt15);string=$(xml).find('teams').text();teams=string.split(",");longname=teams[0];string1=$(xml).find('teamshort').text();teamshort=string1.split(",");teamname=teamshort[0];for(i=0;i<11;i++){sym.getSymbol("screen3").getSymbol("teamBtns").getSymbol("teamBtnStrip").$("teamBtn"+i).click(showTeam(teamshort[i],teams[i]));}
sym.getSymbol("screen3").$("teamsTxt").html(longname);txt3=$(xml).find(teamname+'1no').text();sym.getSymbol("screen3").$("txt3").html(txt3);txt4=$(xml).find(teamname+'1').text();sym.getSymbol("screen3").$("txt4").html(txt4);txt5=$(xml).find(teamname+'1details').text();sym.getSymbol("screen3").$("txt5").html(txt5);txt6=$(xml).find(teamname+'2no').text();sym.getSymbol("screen3").$("txt6").html(txt6);txt7=$(xml).find(teamname+'2').text();sym.getSymbol("screen3").$("txt7").html(txt7);txt8=$(xml).find(teamname+'2details').text();sym.getSymbol("screen3").$("txt8").html(txt8);txt9=$(xml).find(teamname+'car').text();sym.getSymbol("screen3").$("txt9").html(txt9);flag1txt=$(xml).find(teamname+'1flag').text();sym.getSymbol("screen3").$("flagtxt1").html(flag1txt);flag2txt=$(xml).find(teamname+'2flag').text();sym.getSymbol("screen3").$("flagtxt2").html(flag2txt);racetxt0=$(xml).find('race0txt0').text();racetxt0txt.html(racetxt0);racetxt1=$(xml).find('race0txt1').text();racetxt1txt.html(racetxt1);racetxt2=$(xml).find('race0txt2').text();racetxt2txt.html(racetxt2);racetxt3=$(xml).find('race0txt3').text();racetxt3txt.html(racetxt3);string2=$(xml).find('racetxt0').text();races=string2.split(",");racetxt4txt.html(races[0]);racetxt5txt.html(races[1]);racetxt6txt.html(races[2]);racetxt7txt.html(races[3]);racetxt8txt.html(races[4]);racetxt10txt.html(races[5]);racetxt11txt.html(races[6]);string3=$(xml).find('racetxt1').text();racestats=string3.split(",");}});var firstRace=Date.UTC(2013,02,17,06,00,01);var counter;var dd1=sym.getSymbol("screen0").$("dd1");var dd2=sym.getSymbol("screen0").$("dd2");var hh1=sym.getSymbol("screen0").$("hh1");var hh2=sym.getSymbol("screen0").$("hh2");var mm1=sym.getSymbol("screen0").$("mm1");var mm2=sym.getSymbol("screen0").$("mm2");var ss1=sym.getSymbol("screen0").$("ss1");var ss2=sym.getSymbol("screen0").$("ss2");var diff=0;function countDown(){var todayDate=new Date();if(todayDate>=firstRace){sym.$("screen0").fadeOut(0);sym.getSymbol("styleMc").$("menuTxt0").fadeIn(0);sym.getSymbol("styleMc").getSymbol("menuBtn0").$("btnClick").fadeIn(0);clearInterval(counter);}else{diff=firstRace-todayDate;var days=Math.floor(diff/86400000);var hours=Math.floor((diff%86400000)/3600000);var mins=Math.floor((diff%86400000)%3600000/60000);var secs=Math.floor((diff%86400000)%3600000%60000/1000);var dd=leadingZero(days).toString();var hh=leadingZero(hours).toString();var mm=leadingZero(mins).toString();var ss=leadingZero(secs).toString();dd1.attr("src","numbers/"+dd.substring(0,1)+".png");dd2.attr("src","numbers/"+dd.substring(1)+".png");hh1.attr("src","numbers/"+hh.substring(0,1)+".png");hh2.attr("src","numbers/"+hh.substring(1)+".png");mm1.attr("src","numbers/"+mm.substring(0,1)+".png");mm2.attr("src","numbers/"+mm.substring(1)+".png");ss1.attr("src","numbers/"+ss.substring(0,1)+".png");ss2.attr("src","numbers/"+ss.substring(1)+".png");}}
function leadingZero(time){return(time<10)?"0"+time:time;}
countDown();counter=setInterval(countDown,1000);if(diff>=0){sym.getSymbol("styleMc").$("headPanel").css("background-color",'rgba(0,0,0,1.0)');sym.getSymbol("styleMc").$("btnPanel").css("background-color",'rgba(0,0,0,1.0)');}else{sym.getSymbol("styleMc").$("headPanel").css("background-color",'rgba(0,0,0,0.15)');sym.getSymbol("styleMc").$("btnPanel").css("background-color",'rgba(0,0,0,0.15)');}
var dataURL=('http:'==document.location.protocol?"http://www2.graphicnews.com/":"https://www.graphicnews.org/")+"infostradasports/api.php";var barHeight;var nRaceDrivers;var maxPoints;var scale;function getDriverStandings(){$.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){sym.getSymbol("screen1").$("loading").fadeOut(0);var rankData=data;nRaceDrivers=rankData.length;if(rankData.length>20){barHeight=((385/rankData.length)-2);}else{barHeight=17;}
maxPoints=rankData[0].n_PointsSort;var min=(maxPoints!=null)?maxPoints:0;for(var n=0;n<rankData.length;n++){if(rankData[n].n_PointsSort!=null&&rankData[n].n_PointsSort<min){min=rankData[n].n_PointsSort;}}
for(var i=0;i<rankData.length;i++){if(i==0){sym.getSymbol("screen1").$("graph").empty();var drivershort=rankData[i].c_PersonShort;var driverID=rankData[i].n_PersonID;var imgCar=rankData[i].c_TeamShort;var leadDriver='<b>'+rankData[i].c_Person+'</b> '+rankData[i].c_NOCShort+'</span>';sym.getSymbol("screen1").$("driversTxt").html(leadDriver);sym.getSymbol("screen1").$("driverPic").attr("src","drivers/"+driverID+".jpg");}
var tableText="<div class='driverschamp'><div id='driverdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='driverrnk"+i+"' width='20px' style='font-weight:bold'></td><td id='driverNm"+i+"'width='75px'></td><td id='driverteam"+i+"' style='font-style:italic'></td><td id='driverpts"+i+"' style='font-weight:bold'></td></tr></table></div></div>";sym.getSymbol("screen1").$("graph").append(tableText);$('#driverrnk'+i).text(rankData[i].n_Rank);$('#driverNm'+i).text(rankData[i].c_PersonShort);$('#driverteam'+i).text(rankData[i].c_TeamShort);$('#driverpts'+i).text(rankData[i].c_Points);if(maxPoints==min&&rankData[i].n_PointsSort==maxPoints){scale=100;}else if(rankData[i].n_PointsSort==null){scale=54;}else{scale=100-((maxPoints-rankData[i].n_PointsSort)*45/(maxPoints-min));}
$(".driverschamp").css({'font-size':'11px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$("#driverdata"+i).css({'height':barHeight+'px','width':'54%','background-color':'rgba(230,225,215,0.8)','padding-left':'3px','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)'});$("#driverpts"+i).css({'text-align':'right','padding-right':'3px'});$("#driverdata"+i).animate({width:scale+'%'},1500);}}});}
getDriverStandings();intervalId=setInterval(getDriverStandings,300000);var nTeams;var teamBar;function getConsStandings(){$.ajax({type:"GET",url:dataURL,data:"gn=30146&q=champteams&yr=2013&race=",contentType:"text/plain",dataType:"jsonp",jsonp:"callback",async:true,crossDomain:true,success:function(data){var teamData=data;nTeams=teamData.length;if(teamData.length>11){teamBar=((195/teamData.length)-2);}else{teamBar=18;}
teamPoints=teamData[0].n_PointsSort;var minpts=(teamPoints!=null)?teamPoints:0;for(var n=0;n<teamData.length;n++){if(teamData[n].n_PointsSort!=null&&teamData[n].n_PointsSort<minpts){minpts=teamData[n].n_PointsSort;}}
for(var i=0;i<teamData.length;i++){teamname=teamData[i].c_TeamShort;longname=teamData[i].c_Team;sym.getSymbol("screen3").getSymbol("teamBtns").getSymbol("teamBtnStrip").$("teamBtn"+i).unbind("click");sym.getSymbol("styleMc").$("menuBtn2").unbind("click",showTeam);if(i==0){sym.getSymbol("screen2").$("graph").empty();var imgCar=teamData[i].c_TeamShort;sym.getSymbol("screen2").$("teamsTxt").html("<b>"+longname+"</b>");sym.getSymbol("screen2").$("teamsTxt").fadeIn(500);sym.getSymbol("screen2").getSymbol("carPic").$("mainCar").attr("src","cars/"+imgCar+"big.png");sym.getSymbol("screen2").getSymbol("carPic").$("reflection").attr("src","cars/"+imgCar+"big.png");sym.getSymbol("screen2").getSymbol("carPic").$("driverHead").attr("src","drivers/"+imgCar+".png");sym.getSymbol("screen2").getSymbol("carPic").$("bkwheel").attr("src","cars/"+imgCar+"bk.png");sym.getSymbol("screen2").getSymbol("carPic").$("frwheel").attr("src","cars/"+imgCar+"fr.png");sym.getSymbol("styleMc").$("menuBtn2").click(showTeam(teamname,longname));getStats(teamname,2);}
var constructorsText="<div class='teamchamp'><div id='teamdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='teamrnk"+i+"' width='20px' style='font-weight:bold'></td><td id='teamNm"+i+"'></td><td id='teampts"+i+"' style='font-weight:bold'></td></tr></table></div></div>";sym.getSymbol("screen2").$("graph").append(constructorsText);$('#teamrnk'+i).text(teamData[i].n_Rank);$('#teamNm'+i).text(teamData[i].c_Team);$('#teampts'+i).text(teamData[i].c_Points);if(teamPoints==minpts&&teamData[i].n_PointsSort==teamPoints){scale=100;}else if(teamData[i].n_PointsSort==null){scale=56;}else{scale=100-((teamPoints-teamData[i].n_PointsSort)*44/(teamPoints-minpts));}
$(".teamchamp").css({'font-size':'12px','font-family':'pragmatica-web, sans-serif','width':'99%','margin-bottom':'2px'});$("#teamdata"+i).css({'height':teamBar+'px','width':scale+'%','background-color':'rgba(230,225,215,0.8)','padding-left':'3px','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)'});$("#teamdata"+i+" table").css({'height':teamBar+'px'});$("#teampts"+i).css({'text-align':'right','padding-right':'3px'});sym.getSymbol("screen3").getSymbol("teamBtns").getSymbol("teamBtnStrip").$("teamBtn"+i).attr("src","images/"+teamData[i].c_TeamShort+".png");sym.getSymbol("screen3").getSymbol("teamBtns").getSymbol("teamBtnStrip").$("teamBtn"+i).css({"cursor":'pointer'});sym.getSymbol("screen3").getSymbol("teamBtns").getSymbol("teamBtnStrip").$("teamBtn"+i).click(showTeam(teamname,longname));sym.getSymbol("screen3").getSymbol("teamBtns").getSymbol("teamBtnStrip").$("teamBtn"+i).click(hideTeamBtn);}}});}
getConsStandings();intervalId=setInterval(getConsStandings,300000);var flag1txt;var flag2txt;function getStats(teamdetails,view){$.ajax({type:"GET",url:"GN30349.xml",dataType:"xml",success:function(xml){txt3=$(xml).find(teamdetails+'1no').text();sym.getSymbol("screen"+view).$("txt3").html(txt3);txt4=$(xml).find(teamdetails+'1').text();sym.getSymbol("screen"+view).$("txt4").html(txt4);txt5=$(xml).find(teamdetails+'1details').text();sym.getSymbol("screen"+view).$("txt5").html(txt5);txt6=$(xml).find(teamdetails+'2no').text();sym.getSymbol("screen"+view).$("txt6").html(txt6);txt7=$(xml).find(teamdetails+'2').text();sym.getSymbol("screen"+view).$("txt7").html(txt7);txt8=$(xml).find(teamdetails+'2details').text();sym.getSymbol("screen"+view).$("txt8").html(txt8);txt9=$(xml).find(teamdetails+'car').text();sym.getSymbol("screen"+view).$("txt9").html(txt9);flag1txt=$(xml).find(teamdetails+'1flag').text();sym.getSymbol("screen"+view).$("flagtxt1").html(flag1txt);sym.getSymbol("screen"+view).$("driverflag1").attr("src","images/"+flag1txt+".gif");flag2txt=$(xml).find(teamdetails+'2flag').text();sym.getSymbol("screen"+view).$("flagtxt2").html(flag2txt);sym.getSymbol("screen"+view).$("driverflag2").attr("src","images/"+flag2txt+".gif");var driver1=$(xml).find(teamdetails+'1id').text();sym.getSymbol("screen"+view).$("driverpic1").attr("src","drivers/"+driver1+".jpg");var driver2=$(xml).find(teamdetails+'2id').text();sym.getSymbol("screen"+view).$("driverpic2").attr("src","drivers/"+driver2+".jpg");sym.getSymbol("screen"+view).$("driverHelmet1").attr("src","drivers/"+driver1+".png");sym.getSymbol("screen"+view).$("driverHelmet2").attr("src","drivers/"+driver2+".png");}});}
sym.getSymbol("styleMc").$("menuBtn4").fadeOut(0);sym.getSymbol("styleMc").$("menuBtn5").fadeOut(0);sym.getSymbol("styleMc").$("menuBtn6").fadeOut(0);menuArray=[];for(var h=0;h<8;h++){var menuBtnSymbols=sym.getSymbol("styleMc").getSymbol("menuBtn"+h);menuBtnSymbols.setVariable("menuId",h);menuArray.push(menuBtnSymbols);sym.getSymbol("styleMc").$("menuBtn"+h).css({"cursor":"pointer"});}
$.each(menuArray,function(count,menuInTheArray){var menuBtnElement=menuInTheArray.getSymbolElement();menuBtnElement.bind("click touchstart",{menuId:count},menuBtnClick);menuBtnElement.bind("mouseover",{menuId:count},menuShow);menuBtnElement.bind("mouseout",{menuId:count},menuHide);});function resetmenu(){for(var h=0;h<menuArray.length;h++){var resetmenu_arr=["menuTxt0","menuTxt1","menuTxt2","menuTxt3","menuTxt4","menuTxt5","menuTxt6"];$.each(resetmenu_arr,function(index,value){sym.getSymbol("styleMc").$(value).fadeOut(0);});menuArray[h].$("btnClick").fadeOut(0);menuArray[h].$("btnOver").fadeOut(0);}}
resetmenu();var firstCar=sym.getSymbol("screen3").$("driveCar0");var secondCar=sym.getSymbol("screen3").$("driveCar1");var screen2play=0;var screen3play=0;var raceIDs=[832176,832196,832216,832222,832238,832260,832268,832287,832298,832309,832328,807135,832344,832367,832371,832382,832393,832407,832414];var raceNo=0;var clicked=0;var raceInterval;function menuBtnClick(e){resetmenu();var menuMenu_id=(e.data.menuId);sym.getSymbol("styleMc").getSymbol("menuBtn"+menuMenu_id).$("btnClick").fadeIn(0);for(i=0;i<8;i++){var screen=i+1;if(menuMenu_id==i){clicked=i;if(diff>0&&i<2){sym.$("screen0").fadeIn(400);sym.getSymbol("styleMc").$("headPanel").css("background-color",'rgba(0,0,0,1.0)');sym.getSymbol("styleMc").$("btnPanel").css("background-color",'rgba(0,0,0,1.0)');timetxt4.html(countdowncaps[i]+" "+countdown[4]);timetxt4.fadeIn(400);counter=setInterval(countDown,1000);}else{sym.$("screen"+screen).fadeIn(400);sym.$("screen0").fadeOut(400);clearInterval(counter);clearInterval(raceInterval);sym.getSymbol("styleMc").$("headPanel").css("background-color",'rgba(0,0,0,0.15)');sym.getSymbol("styleMc").$("btnPanel").css("background-color",'rgba(0,0,0,0.15)');if(menuMenu_id==0){}
else if(menuMenu_id==1){if(screen2play==0){sym.getSymbol("screen2").$("carPic").delay(200).animate({left:415},800,'easeOutCirc');sym.getSymbol("screen2").getSymbol("carPic").play();}
screen2play=1;}else if(menuMenu_id==2){showTeam(teamname,longname);}else if(menuMenu_id==3){getRace(raceIDs[raceNo]);raceInterval=setInterval(function(){getRace(raceIDs[raceNo]);},60000);}else if(menuMenu_id==4){getRace(raceIDs[raceNo]);raceInterval=setInterval(function(){getRace(raceIDs[raceNo]);},60000);}else if(menuMenu_id==5){sym.getSymbol("screen6").$("slidePanel").delay(200).animate({top:340},800,'easeOutCirc');sym.getSymbol("screen6").$("slidePanel").delay(6000).animate({top:390},800,'easeOutCirc');}}}else{sym.$("screen"+screen).fadeOut(400);}
sym.getSymbol("styleMc").$("menuTxt"+menuMenu_id).fadeIn(0);}}
function menuShow(e){var menuMenu_id=(e.data.menuId);sym.getSymbol("styleMc").getSymbol("menuBtn"+menuMenu_id).$("btnOver").fadeIn(0);}
function menuHide(e){var menuMenu_id=(e.data.menuId);sym.getSymbol("styleMc").getSymbol("menuBtn"+menuMenu_id).$("btnOver").fadeOut(0);}
var thumbWidth=41;var n=19;var thumbs=7;var space=1;var ttime=400;var stripw=773;var RTL="false";var igmeasure=320;var teamn=11;var teamstripw=449;var rtloff=igmeasure-stripw;var fwd;var back;fwd=(RTL=="true")?0:1;back=(RTL=="true")?1:0;sym.setVariable("number",0);sym.setVariable("strip",0);var btnArray=["stripBtn0","stripBtn1"];for(var b=0;b<btnArray.length;b++){sym.getSymbol("screen4").$("stripBtn"+b).bind('click',stripbtnClick);}
function stripbtnClick(){var selected_id=$(this).attr("id");var s=sym.getVariable("strip");if(selected_id=="Stage_screen4_stripBtn"+back){if(s>0){if(s<=1){sym.getSymbol("screen4").$("stripBtn"+back).hide();}else{sym.getSymbol("screen4").$("stripBtn"+back).show();}
s=s-1;}else{s=0;sym.getSymbol("screen4").$("stripBtn"+back).hide();}
if(RTL=="true"){sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:rtloff+(thumbs*s*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:(thumbs*s*-(thumbWidth))+space},ttime);}
sym.getSymbol("screen4").$("stripBtn"+fwd).show();}else{if(s>(n/thumbs)-2){s=Math.floor(n/thumbs);if(RTL=="true"){sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:rtloff+((n-thumbs)*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:((n-thumbs)*-(thumbWidth))+space},ttime);}
sym.getSymbol("screen4").$("stripBtn"+fwd).hide();}else{s=s+1;if(RTL=="true"){sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:rtloff+(thumbs*s*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:(thumbs*s*-(thumbWidth))+space},ttime);}
sym.getSymbol("screen4").$("stripBtn"+fwd).show();}
sym.getSymbol("screen4").$("stripBtn"+back).show();}
sym.setVariable("strip",s);e.preventDefault()}
var fpArray=["FP1","FP2","FP3"];var qArray=["Q1","Q2","Q3"];var sessionArray=["phaseBtn0","phaseBtn1","phaseBtn2"];for(var j=0;j<n;j++){sym.getSymbol("screen4").getSymbol("flagBtns").getSymbol("buttonstrip").$("flagBtn"+j).bind('click',thClick);sym.getSymbol("screen4").getSymbol("flagBtns").getSymbol("buttonstrip").$("flagBtn"+j).css({"border-width":"1px","border-style":"solid","border-color":"rgba(255,255,255,0)","background-color":"rgba(255,255,255,0)"});}
function thClick(){var selected_id=$(this).attr("id");resetLive();$.ajax({   
    type:"GET",    url:"GN30349.xml",    dataType:"xml",    success:function(xml){$.each(fpArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).unbind("click");});$.each(qArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).unbind("click");});$.each(sessionArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).unbind("click");});for(var i=0;i<n;i++){if(selected_id=="Stage_screen4_flagBtns_buttonstrip_flagBtn"+i){raceNo=i;getRace(raceIDs[i]);racetxt0=$(xml).find('race'+i+'txt0').text();racetxt0txt.html(racetxt0);race0txt=$(xml).find('race'+i).text();sym.getSymbol("styleMc").$("menuTxt3").html(race0txt);sym.getSymbol("styleMc").$("menuTxt4").html(race0txt+" "+menuTxt4);sym.getSymbol("styleMc").$("menuTxt5").html(race0txt+" "+menuTxt5);sym.getSymbol("styleMc").$("menuTxt6").html(race0txt+" "+menuTxt6);racetxt1=$(xml).find('race'+i+'txt1').text();racetxt1txt.html(racetxt1);racetxt2=$(xml).find('race'+i+'txt2').text();racetxt2txt.html(racetxt2);racetxt3=$(xml).find('race'+i+'txt3').text();racetxt3txt.html(racetxt3);sym.getSymbol("screen4").$("trackPic").attr("src","images/race"+i+".jpg");sym.getSymbol("screen4").getSymbol("flagBtns").getSymbol("buttonstrip").$("flagBtn"+i).css({"border-width":"1px","border-style":"solid","border-color":"rgba(255,255,255,1.0)","background-color":"rgba(255,255,255,0.7)"});if(i>0){sym.getSymbol("screen4").$("stripBtn"+back).show();}
if(i<1){sym.getSymbol("screen4").$("stripBtn0"+back).hide();}
if(i<n-thumbs-1){sym.getSymbol("screen4").$("stripBtn"+fwd).show();}
if(i>n-thumbs-1){sym.getSymbol("screen4").$("stripBtn"+fwd).hide();}
if(i<n-thumbs+1){if(RTL=="true"){sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:rtloff+(i*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:(i*-(thumbWidth))+space},ttime);}}else{if(RTL=="true"){sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:rtloff+((n-thumbs)*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip").animate({left:((n-thumbs)*-(thumbWidth))+space},ttime);}}
sym.setVariable("strip",Math.floor(i/thumbs));sym.setVariable("number",i);}else{sym.getSymbol("screen4").getSymbol("flagBtns").getSymbol("buttonstrip").$("flagBtn"+i).css({"border-width":"1px","border-style":"solid","border-color":"rgba(255,255,255,0)","background-color":"rgba(255,255,255,0)"});}}
               }
   });e.preventDefault()}
sym.getSymbol("screen4").$("stripBtn"+back).hide();var teamrtloff=igmeasure-teamstripw;sym.setVariable("teamNumber",0);sym.setVariable("teamStrip",0);var teamstripArray=["stripBtn0","stripBtn1"];for(var t=0;t<teamstripArray.length;t++){sym.getSymbol("screen3").$("stripBtn"+t).bind('click',teambtnClick);}
function teambtnClick(){var selected_id=$(this).attr("id");var s=sym.getVariable("teamStrip");if(selected_id=="Stage_screen3_stripBtn"+back){sym.getSymbol("screen3").$("stripBtn"+fwd).show();if(s>0){if(s<=1){sym.getSymbol("screen3").$("stripBtn"+back).hide();}else{sym.getSymbol("screen3").$("stripBtn"+back).show();}
s=s-1;}else{s=0;sym.getSymbol("screen3").$("stripBtn"+back).hide();}
if(RTL=="true"){sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip").animate({left:teamrtloff+(thumbs*s*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip").animate({left:(thumbs*s*-(thumbWidth))+space},ttime);}}else{if(s>(teamn/thumbs)-2){s=Math.floor(teamn/thumbs);if(RTL=="true"){sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip").animate({left:teamrtloff+((teamn-thumbs)*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip").animate({left:((teamn-thumbs)*-(thumbWidth))+space},ttime);}
sym.getSymbol("screen3").$("stripBtn"+fwd).hide();}else{s=s+1;if(RTL=="true"){sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip").animate({left:teamrtloff+(thumbs*s*(thumbWidth))-space},ttime);}else{sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip").animate({left:(thumbs*s*-(thumbWidth))+space},ttime);}
sym.getSymbol("screen3").$("teamBtns"+fwd).show();}
sym.getSymbol("screen3").$("stripBtn"+back).show();}
sym.setVariable("teamStrip",s);e.preventDefault()}
sym.getSymbol("screen3").$("stripBtn"+back).hide();function resetPhases(){$.each(fpArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).css({'opacity':0.5});});for(i=0;i<3;i++){sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn'+i).css({'padding':'5px 5px 0px 5px','color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});}
sym.getSymbol("screen6").getSymbol('slidePanel').$("FP1").css({'opacity':1.0});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn0').css({'color':'rgb(255,255,255)','background-color':'rgba(0,0,0,1.0)'});sym.getSymbol("screen6").$("gridSlider").fadeOut(0);sym.getSymbol("screen6").$("graph").fadeIn(0);}
resetPhases();var raceData;var barHeightr;var order;var raceFinished=0;var raceStage;var firstPhase;var phase;var resultCar;var scaleresult;var minTime;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("screen6").getSymbol('slidePanel').$(value).css({'opacity':0.5});});}else{$.each(qArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).css({'opacity':0.5});});}
sym.getSymbol("screen6").getSymbol('slidePanel').$(stage).css({'opacity':1.0});e.preventDefault()};};var gridClicker=function(phaseNo){return function(e){getGrid(phaseNo);e.preventDefault()};};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("screen6").getSymbol('slidePanel').$(value).show();});$.each(fpArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).css({'opacity':0.5});});$.each(qArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).hide();});sym.getSymbol("screen6").getSymbol('slidePanel').$("FP1").css({'opacity':1.0});sym.getSymbol("styleMc").$("menuTxt5").html(race0txt+" "+racestats[0]);sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn0').css({'color':'rgb(255,255,255)','background-color':'rgba(0,0,0,1.0)'});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn1').css({'color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn2').css({'color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});}else{$.each(fpArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).hide();});$.each(qArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).show();});$.each(qArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).css({'opacity':0.5});});sym.getSymbol("styleMc").$("menuTxt5").html(race0txt+" "+racestats[1]);sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn0').css({'color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn1').css({'color':'rgb(255,255,255)','background-color':'rgba(0,0,0,1.0)'});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn2').css({'color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});}
sym.getSymbol("screen6").$("gridSlider").fadeOut(500);sym.getSymbol("screen6").$("graph").fadeIn(500);e.preventDefault()}}
function getRace(raceID){$.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;firstPhase=racePhases[0].n_PhaseID;if(racePhases[0].b_Finished==true){getPhases(firstPhase);resetPhases();}
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("screen6").getSymbol('slidePanel').$(raceStage).show();sym.getSymbol("screen6").getSymbol('slidePanel').$(raceStage).click(phaseClicker(phase,raceStage));sym.getSymbol("screen6").getSymbol('slidePanel').$("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("screen6").getSymbol('slidePanel').$(raceStage).click(phaseClicker(phase,raceStage));sym.getSymbol("screen6").getSymbol('slidePanel').$("phaseBtn1").click(showPhase(racePhases[3].n_PhaseID,raceStage));}else if(racePhases[i].n_Phase1Nr==5){sym.getSymbol("screen6").getSymbol('slidePanel').$("phaseBtn2").click(gridClicker(phase));}else if(racePhases[i].n_Phase1Nr==6){raceStage="Race";sym.getSymbol("styleMc").$("menuBtn6").fadeIn(0);if(clicked!=6){sym.getSymbol("styleMc").getSymbol("menuBtn6").$("btnClick").fadeOut(0);sym.getSymbol("styleMc").getSymbol("menuBtn6").$("btnOver").fadeOut(0);}
sym.getSymbol("styleMc").$("menuBtn6").unbind("click touchstart");sym.getSymbol("styleMc").$("menuBtn6").bind("click touchstart",{menuId:6},menuBtnClick);sym.getSymbol("screen4").$("light").css({'background-color':'rgb(255,0,0)'});sym.getSymbol("screen4").$("grad").fadeIn(0);racetxt9txt.html(racestats[3]);racetxt8txt.html(racestats[5]);sym.getSymbol("screen5").$("pitstop").fadeIn(0);raceFinished=1;getInfo(phase);getLive(phase);}}else if(racePhases[i].b_Started==true&&racePhases[i].b_Current==true){if(racePhases[i].b_Race==true){raceStage="Race";}
getInfo(phase);getLive(phase);}else{sym.getSymbol("styleMc").$("menuBtn4").fadeOut(0);sym.getSymbol("styleMc").$("menuBtn5").fadeOut(0);sym.getSymbol("styleMc").$("menuBtn6").fadeOut(0);racetxt9txt.html("");racetxt8txt.html("");sym.getSymbol("screen4").$("light").css({'background-color':'rgb(255,255,255)'});sym.getSymbol("screen4").$("grad").fadeOut(0);}
sym.getSymbol("screen6").getSymbol('slidePanel').$(raceStage).css({"cursor":"pointer"});}},error:function(){sym.getSymbol("styleMc").$("menuBtn4").fadeOut(0);sym.getSymbol("styleMc").$("menuBtn5").fadeOut(0);sym.getSymbol("styleMc").$("menuBtn6").fadeOut(0);}});}
getRace(raceIDs[raceNo]);function resetLive(){sym.getSymbol("screen4").$("weather").empty();sym.getSymbol("screen4").$("conditions").empty();sym.getSymbol("screen4").$("raceflag").empty();sym.getSymbol("screen5").$("lapCounter").fadeOut(0);sym.getSymbol("screen5").$("txt11").fadeOut(0);}
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("screen4").$("weather").empty();sym.getSymbol("screen4").$("conditions").empty();sym.getSymbol("screen4").$("raceflag").empty();sym.getSymbol("screen5").$("lapCounter").fadeOut(0);sym.getSymbol("screen5").$("txt11").fadeOut(0);if(data[0].n_WeatherConditionType!=null){var weather='<img src="images/weather'+data[0].n_WeatherConditionType+'.png" width="33px" height="33px">';var track='<img src="images/track'+data[0].n_TrackConditionType+'.png" width="33px" height="33px">';var flagtype='<img src="images/flag'+data[0].n_FlagType+'.png" width="33px" height="33px">';sym.getSymbol("screen4").$("weather").append(weather);sym.getSymbol("screen4").$("conditions").append(track);sym.getSymbol("screen4").$("raceflag").append(flagtype);}
if(data[0].b_Started==true&&data[0].b_Live==true){sym.getSymbol("screen4").$("light").css({'background-color':'rgb(0,200,50)'});sym.getSymbol("screen4").$("grad").fadeIn(0);}
var sessionNo=(data[0].n_SessionNr>0)?data[0].n_SessionNr:"";if(data[0].b_FreePractice==true){racetxt9txt.html(racestats[0]+" "+sessionNo);txt12txt.html(txt13);txt12txt.css({top:369,left:219,"color":"rgb(255,255,255)"});pitstoptxt="";}else if(data[0].b_Qualifying==true){racetxt9txt.html(racestats[1]+" "+sessionNo);txt12txt.html(txt13);txt12txt.css({top:369,left:219,"color":"rgb(255,255,255)"});pitstoptxt="";}else if(data[0].b_StartingGrid==true){racetxt9txt.html(racestats[2]);txt12txt.html("");pitstoptxt="";}else if(data[0].b_Race==true){racetxt9txt.html(racestats[3]);txt12txt.html(txt12);txt12txt.css({top:261,left:209,"color":"rgb(0,0,0)","text-align":"center"});var laps=data[0].n_LapsScheduled;var lapsDriven=data[0].n_LapsDriven;var lapsAngle=360*lapsDriven/laps;sym.getSymbol("screen5").$("txt11").text(txt11+": "+lapsDriven);sym.getSymbol("screen5").$("pitstop").fadeIn(0);sym.getSymbol("screen5").$("lapCounter").fadeIn(400);sym.getSymbol("screen5").$("txt11").fadeIn(400);if(lapsDriven/laps<0.5){sym.getSymbol("screen5").getSymbol("lapCounter").$("laps2").hide();sym.getSymbol("screen5").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("screen5").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("screen5").getSymbol("lapCounter").$("laps2").show();sym.getSymbol("screen5").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');}
if(data[0].b_Finished==true){racetxt8txt.html(racestats[5]);}else{racetxt8txt.html(racestats[4]);}}}});}
var nDrivers;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;nDrivers=raceData.length;if(raceData.length>20){barHeightr=((385/raceData.length)-2);}else{barHeightr=17;}
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;}}}
sym.getSymbol("screen7").$("graph").empty();for(var i=0;i<raceData.length;i++){if(i==0){sym.getSymbol("screen5").$("graph").empty();var imgDriver1=raceData[i].n_PersonID;var leadDriver1='<b>'+raceData[i].c_Person+'</b> '+raceData[i].c_NOCShort;sym.getSymbol("screen7").$("driverPic1").attr("src","drivers/"+imgDriver1+".jpg");sym.getSymbol("screen7").$("drivertxt1").html(leadDriver1);}
if(i==1){var imgDriver2=raceData[i].n_PersonID;var leadDriver2='<b>'+raceData[i].c_Person+'</b> '+raceData[i].c_NOCShort;sym.getSymbol("screen7").$("driverPic2").attr("src","drivers/"+imgDriver2+".jpg");sym.getSymbol("screen7").$("drivertxt2").html(leadDriver2);}
if(i==2){var imgDriver3=raceData[i].n_PersonID;var leadDriver3='<b>'+raceData[i].c_Person+'</b> '+raceData[i].c_NOCShort;sym.getSymbol("screen7").$("driverPic3").attr("src","drivers/"+imgDriver3+".jpg");sym.getSymbol("screen7").$("drivertxt3").html(leadDriver3);}
if(i==0){var tableText="<div class='liverace'><div id='livedriverdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='driver"+i+"'width='75px'></td><td id='team"+i+"' style='font-style:italic' width='30px'></td><td id='pitstops"+i+"' style='font-weight:bold' width='15px'></td><td style='font-weight:bold; color:rgba(0,0,0,0.30)'>"+pitstoptxt+"</td><td id='time"+i+"'></td></tr></table></div></div>";}else{var tableText="<div class='liverace'><div id='livedriverdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='driver"+i+"'width='75px'></td><td id='team"+i+"' style='font-style:italic' width='30px'></td><td id='pitstops"+i+"' style='font-weight:bold' width='15px'></td><td id='time"+i+"'></td></tr></table></div></div>";}
var resultsText="<div class='resultrace'><div id='resultdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='resultorder"+i+"' width='20px'></td><td id='resultdriver"+i+"' width='75px'></td><td id='resultteam"+i+"' style='font-style:italic' width='30px'></td><td id='points"+i+"'></td></tr></table></div></div>";sym.getSymbol("screen5").$("graph").append(tableText);$('#driver'+i).text(raceData[i].c_PersonShort);$('#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)'});}
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=59;}else{scale=100-((raceData[i].n_TimeAbs-minTime)*39/(mxm-minTime));}}else if(timeRel==0){var txt11lc=txt11.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=59;if(raceData[i].c_ResultSuffix==null){$('#time'+i).text("+"+raceData[i].n_LapsRel+" "+txt11lc.substr(0,4));}else{$('#time'+i).text(raceData[i].c_ResultSuffix);}}else{scale=100-(raceData[i].n_TimeRel*39/mxm);$('#time'+i).text(raceData[i].c_Result);}}
$(".liverace").css({'font-size':'11px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$("#livedriverdata"+i).css({'height':barHeightr+'px','width':scale+'%','background-color':'rgb(230,225,215)','padding-left':'3px','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("screen7").$("graph").append(resultsText);order=raceData[i].n_RankSort;if(raceData[i].c_ChampionshipPoints!=undefined){points=raceData[i].c_ChampionshipPoints;}else{points="";}
$('#resultorder'+i).html("<b>"+order+"</b>");$('#resultdriver'+i).text(raceData[i].c_PersonShort);$('#resultteam'+i).text(raceData[i].c_TeamShort);$('#points'+i).html("<b>"+points+"</b>");$(".resultrace").css({'font-size':'11px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$("#resultdata"+i).css({'height':barHeightr+'px','width':'59%','padding-left':'3px','background-color':'rgb(230,225,215)','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)'});$("#points"+i).css({'text-align':'right','padding-right':'5px'});}}
sym.getSymbol("styleMc").$("menuBtn4").fadeIn(0);if(clicked!=4){sym.getSymbol("styleMc").getSymbol("menuBtn4").$("btnClick").fadeOut(0);sym.getSymbol("styleMc").getSymbol("menuBtn4").$("btnOver").fadeOut(0);}
sym.getSymbol("styleMc").$("menuBtn4").unbind("click touchstart");sym.getSymbol("styleMc").$("menuBtn4").bind("click touchstart",{menuId:4},menuBtnClick);},error:function(){sym.getSymbol("styleMc").$("menuBtn4").fadeOut(0);}});}
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.getSymbol("styleMc").$("menuBtn5").fadeIn(0);if(clicked!=5){sym.getSymbol("styleMc").getSymbol("menuBtn5").$("btnClick").fadeOut(0);sym.getSymbol("styleMc").getSymbol("menuBtn5").$("btnOver").fadeOut(0);}
sym.getSymbol("styleMc").$("menuBtn5").unbind("click touchstart");sym.getSymbol("styleMc").$("menuBtn5").bind("click touchstart",{menuId:5},menuBtnClick);sym.getSymbol("screen6").$("graph").empty();if(phaseData.length>20){barHeight=(385/phaseData.length)-2;}else{barHeight=17;}
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++){var phaseText="<div class='phaserace'><div id='phasedriverdata"+i+"'><table style='width:100%; border:none; border-collapse:collapse; padding:0; margin:0'><tr><td id='phasedriver"+i+"'width='75px'></td><td id='phaseteam"+i+"' style='font-style:italic' width='30px'></td><td id='phasetime"+i+"'></td></tr></table></div></div>";sym.getSymbol("screen6").$("graph").append(phaseText);$('#phasedriver'+i).text(phaseData[i].c_PersonShort);$('#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':'11px','font-family':'pragmatica-web, sans-serif','width':'100%','margin-bottom':'2px'});$("#phasedriverdata"+i).css({'height':barHeight+'px','width':scalePhase+'%','padding-left':'3px','background-color':'rgb(230,225,215)','box-shadow':'3px 2px 5px rgba(100,100,100,0.75)'});$("#phasetime"+i).css({'text-align':'right','padding-right':'5px'});}},error:function(){sym.getSymbol("styleMc").$("menuBtn5").fadeOut(0);}});}
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("screen6").getSymbol('slidePanel').$(value).hide();});$.each(qArray,function(index,value){sym.getSymbol("screen6").getSymbol('slidePanel').$(value).hide();});sym.getSymbol("styleMc").$("menuTxt5").html(race0txt+" "+racestats[2]);sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn0').css({'color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn1').css({'color':'rgb(206,206,206)','background-color':'rgba(0,0,0,0)'});sym.getSymbol('screen6').getSymbol('slidePanel').$('phaseBtn2').css({'color':'rgb(255,255,255)','background-color':'rgba(0,0,0,1.0)'});sym.getSymbol("screen6").$("gridSlider").fadeIn(500);sym.getSymbol("screen6").$("graph").fadeOut(500);sym.getSymbol("screen6").$("txt13").fadeOut(500);var gridMove;var go;for(var i=0;i<gridData.length;i++){sym.getSymbol("screen6").getSymbol("gridSlider").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>";sym.getSymbol("screen6").getSymbol("gridSlider").getSymbol("grid").$("gridtxt").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':'11px','font-family':'pragmatica-web, sans-serif','width':'100%','height':'35px'});sym.getSymbol("screen6").getSymbol("gridSlider").getSymbol("grid").$("grid"+i).append(gridCar);if(i%2==0){gridMove=5+i*35;}else{gridMove=-16+i*35;}
sym.getSymbol("screen6").getSymbol("gridSlider").getSymbol("grid").$("grid"+i).delay(i*400).animate({'top':gridMove},1000);}}});}
sym.getSymbol("screen3").$("teamBtns").css({'cursor':'pointer'});sym.getSymbol("screen3").$("teamBtns").bind("touchmove",moveTeams);sym.getSymbol("screen4").$("flagBtns").bind("touchmove",moveFlags);var rail=sym.getSymbol("screen3").$("teamBtns");var railWidth=rail.width();var railX=rail.offset().left;var railRightX=railX+railWidth;var stripShow=sym.getSymbol("screen3").getSymbol("teamBtns").$("teamBtnStrip");var stripWidth=stripShow.width();var moveStrip=stripWidth-railWidth+15;var flagStrip=sym.getSymbol("screen4").getSymbol("flagBtns").$("buttonstrip");var flagStripWidth=flagStrip.width();var moveStrip2=flagStripWidth-railWidth+30;function moveTeams(e){e.preventDefault();var orig=e.originalEvent;var pos=0;sym.getSymbol("screen3").$("stripBtn0").fadeIn(0);sym.getSymbol("screen3").$("stripBtn1").fadeIn(0);pos=orig.touches[0].pageX;if(pos>=railX&&pos<=railRightX){var moveIt=(pos-railWidth)/railWidth*moveStrip;stripShow.css({'left':moveIt});}};function moveFlags(e){e.preventDefault();var orig=e.originalEvent;var pos=0;sym.getSymbol("screen4").$("stripBtn0").fadeIn(0);sym.getSymbol("screen4").$("stripBtn1").fadeIn(0);pos=orig.touches[0].pageX;if(pos>=railX&&pos<=railRightX){var moveIt=(pos-railWidth)/railWidth*moveStrip2;flagStrip.css({'left':moveIt});}};function handleTouchUp(jqEvent){sym.getComposition().getStage().getSymbolElement().unbind("touchmove");sym.getComposition().getStage().getSymbolElement().unbind("touchend");}});
//Edge binding end
})("stage");
//Edge symbol end:'stage'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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