/***********************
* Adobe Edge Composition Actions
*
* Edit this file with caution, being careful to preserve 
* function signatures and comments starting with 'Edge' to maintain the 
* ability to interact with these actions from within Adobe Edge
*
***********************/
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes

   //Edge symbol: 'stage'
   (function(symbolName) {
      
      
      Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
//EDIT THESE VARIABLES
	var sportID=218; //EDIT sport ID number for each graphic
	var sportarr=[10082,10076,10079,10081,10084,10080,10085,10075,10078,10784,11397]; //EDIT Include ID numbers for all the events to be covered e.g. Downhill, Super-G, Giant Slalom, Slalom
	var numberEvents=6;//EDIT to show how many events are to be shown. Men and Women count as two separate events
//END EDIT

var headline;
	var headlinetxt = sym.getSymbol("styleHead").$("headlineTxt").css("pointer-events","none");
	var stand;
	var standtxt = sym.getSymbol("styleHead").$("standTxt").css("pointer-events","none");
	var source;
	var sourcetxt = sym.getSymbol("styleBase").$("sourceTxt").css("pointer-events","none");
	var resultsHead;
	var resultsHeadtxt = sym.getSymbol("resultsMc").$("resultsHeadTxt").css("pointer-events","none");
	var resultsTable;
	var resultsTabletxt = sym.getSymbol("resultsMc").$("resultsTableTxt").css("pointer-events","none");
	var distance;
	var distancetxt = sym.$("distance").css("pointer-events","none");


	//create array of text elements
	var txt=[];
	txt[0] = sym.getSymbol("btns").getSymbol("longBtn0").$("txt").css("pointer-events","none");
	txt[1] = sym.getSymbol("btns").getSymbol("longBtn1").$("txt").css("pointer-events","none");
	txt[2] = sym.getSymbol("btns").getSymbol("longBtn2").$("txt").css("pointer-events","none");
	txt[3] = sym.getSymbol("btns").getSymbol("longBtn3").$("txt").css("pointer-events","none");
	txt[4] = sym.getSymbol("btns").getSymbol("longBtn4").$("txt").css("pointer-events","none");
	txt[5] = sym.$("txt5").css("pointer-events","none");
	txt[6] = sym.$("txt6").css("pointer-events","none");
	txt[7] = sym.$("txt7").css("pointer-events","none");
	txt[8] = sym.$("txt8").css("pointer-events","none");
	txt[9] = sym.$("txt9").css("pointer-events","none");
	txt[10] = sym.$("txt10").css("pointer-events","none");
	txt[11] = sym.$("txt11").css("pointer-events","none");
	txt[12] = sym.$("txt12").css("pointer-events","none");
	txt[13] = sym.$("txt13").css("pointer-events","none");
	txt[14] = sym.$("txt14").css("pointer-events","none");
	txt[15] = sym.$("txt15").css("pointer-events","none");
	txt[16] = sym.$("txt16").css("pointer-events","none");
	txt[17] = sym.$("txt17").css("pointer-events","none");
	txt[18] = sym.$("txt18").css("pointer-events","none");
	txt[19] = sym.$("txt19").css("pointer-events","none");
	txt[20] = sym.getSymbol("btns").getSymbol("sexBtnMan").$("txt").css("pointer-events","none");
	txt[21] = sym.getSymbol("btns").getSymbol("sexBtnWoman").$("txt").css("pointer-events","none");
	txt[22] = sym.$("txt22").css("pointer-events","none");
	txt[23] = sym.$("txt23").css("pointer-events","none");
	txt[24] = sym.$("txt24").css("pointer-events","none");
	txt[25] = sym.$("txt25").css("pointer-events","none");
	txt[26] = sym.$("txt26").css("pointer-events","none");
	txt[27] = sym.$("txt27").css("pointer-events","none");
	txt[28] = sym.$("txt28").css("pointer-events","none");
	txt[29] = sym.$("txt29").css("pointer-events","none");
	txt[30] = sym.$("txt30").css("pointer-events","none");

	var txtArr=[];

	var countryCaps=[];
	var resultArr=[];
	var sportCaps=[];
	var months=[];

	//AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
	$.ajax({	
		type: "GET",
		url: "GN31230.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);

			var sportString= $(xml).find('sportevents').text();
			sportCaps=sportString.split(";");
			var monthstring = $(xml).find('months').text();
			months=monthstring.split(";");
			for (var n=0; n<2+(numberEvents*4); n++){
			resultArr[n]= $(xml).find('result'+n).text();
			}
			resultsHeadtxt.html(resultArr[1]);
			for (var c=0; c<95; c++){
			countryCaps[c]= $(xml).find('country'+c).text();
			}

			distance = $(xml).find('distance0').text();
			distancetxt.html(distance);

			//create array from xml, put it into array of text elements
			for (var i=0; i<30; i++){
			txtArr[i]=$(xml).find('txt'+i).text();
			txt[i].html(txtArr[i]);
			}
			sym.getSymbol("resultsMc").$("resultsPanel").animate({height:6 + sym.getSymbol("resultsMc").$("table").height() + 0}, 0);
			sym.$("resultsMc").animate({top:505 - sym.getSymbol("resultsMc").$("table").height() + 47}, 0);

		}
	}); // END XML

//DATE FUNCTIONS ----------------------
var d=new Date();
function getDDMMYY(thisDateStr) {
            var dateTxt = thisDateStr.substring(thisDateStr.indexOf('(') + 1, thisDateStr.indexOf(')'));
            var thisDate = new Date(parseInt(dateTxt, 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 mm = thisDate.getMonth();
	var dd = thisDate.getDate();
	return months[mm] + " " + dd +", "+ (thisDate.getFullYear()).toString();
}
var oneday = 1000*60*60*24;
var startDate = new Date("February 8, 2014"); //first medals awarded Sat Feb 8 2014 13:55:00 GMT+0000 (GMT)
var olyDate = new Date();
var endDate = new Date("February 23, 2014");
var endTime = endDate.getTime();
var startTime = startDate.getTime();
var olyTime = olyDate.getTime();

// MEDAL BUTTON
	//sym.getSymbol('resultsMc').$('medalBtn').fadeOut(0);

	var medal = 0;
	var tablePos=sym.getSymbol('resultsMc').$('table').position();
	var tableLeft=tablePos.left;
	var tableWidth=sym.getSymbol('resultsMc').$('table').width();
//ADD THIS
	if (olyTime>startTime){
		var eventHeight=78;
	}else{
		var eventHeight=25;	
	}
//END	
	if (numberEvents>=6){
		if (olyTime>startTime){
			var tableHeight=485; //maximum height of table
		}else{
			var tableHeight=150; //maximum height of table
		}
	}else{
		var tableHeight=numberEvents*eventHeight;
	}
	sym.getSymbol("resultsMc").$("rectangle").css ({'opacity':'0.0'});
	sym.getSymbol("resultsMc").$("medalBtn").on('touchstart click', function(e){
	e.stopPropagation(); e.preventDefault();
	if (medal == 0) {
		sym.getSymbol("resultsMc").$('table').css({'height':tableHeight+'px','max-height':'485px','overflow-y':'auto'});
		$('.silver,.bronze').css({'display':'table'});
		sym.getSymbol("resultsMc").$("resultsPanel").animate({height:6+tableHeight}, 500);
		sym.$("resultsMc").stop().animate ({top:505-(tableHeight)+48}, 500);
		sym.getSymbol("resultsMc").$("rectangle").stop().animate ({opacity:1.0}, 500);
		sym.getSymbol("resultsMc").getSymbol("medalBtn").$("medalArrow").stop().animate ({rotate:180}, 300, 'easeOutCubic');
		medal = 1;
	}else{
		sym.getSymbol("resultsMc").$('table').css({'height':'48px','overflow':'hidden'});
		sym.getSymbol("resultsMc").$("resultsPanel").animate({height:6 + sym.getSymbol("resultsMc").$("table").height() + 0}, 500);
		sym.$("resultsMc").stop().animate ({top:505}, 500);
		sym.getSymbol("resultsMc").$("rectangle").stop().animate ({opacity:0.0}, 500);
		sym.getSymbol("resultsMc").getSymbol("medalBtn").$("medalArrow").stop().animate ({rotate:0}, 300, 'easeOutCubic');
		medal = 0;
	}

	});
	sym.getSymbol("resultsMc").$("medalBtn").mouseover(function(){
		sym.getSymbol("resultsMc").getSymbol("medalBtn").$("btnOver").fadeOut(200);
	});
	sym.getSymbol("resultsMc").$("medalBtn").mouseout(function(){
		sym.getSymbol("resultsMc").getSymbol("medalBtn").$("btnOver").fadeIn(200);
	});

	// ROTATE 
	(function($){
 var _e = document.createElement("canvas").width
 $.fn.cssrotate = function(d) {  
    return this.css({
  '-moz-transform':'rotate('+d+'deg)',
  '-webkit-transform':'rotate('+d+'deg)',
  '-o-transform':'rotate('+d+'deg)',
  '-ms-transform':'rotate('+d+'deg)'
 }).prop("rotate", _e ? d : null)
 }; 
 var $_fx_step_default = $.fx.step._default;
 $.fx.step._default = function (fx) {
 if(fx.prop != "rotate")return $_fx_step_default(fx);
 if(typeof fx.elem.rotate == "undefined")fx.start = fx.elem.rotate = 0;
 $(fx.elem).cssrotate(fx.now)
 }; 
})(jQuery);


// MENU BUTTONS --------------------------------------------	
	menuArray = []; //the array that will hold references to the buttons.

	for (var h = 0; h < 5; h++){
		var menuBtnSymbols = sym.getSymbol("btns").getSymbol("longBtn" +h); // Create an instance element of a symbol as a child of the given parent element
		menuBtnSymbols.setVariable("menuId", h); //set the value of a Symbol variable
		menuArray.push(menuBtnSymbols); //push it into the array
	}

	$.each(menuArray, function( count, menuInTheArray ){ //a 'for each' loop through the newly populated array
		var menuBtnItem = $(menuInTheArray); //create jQuery reference to the item
		var menuBtnElement = menuInTheArray.getSymbolElement(); //create a jQuery reference to the DIV element inside the symbol
		menuBtnElement.bind ("click", {menuId:count}, menuBtnClick);
		menuBtnElement.bind ("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 = ["path0","path1","path2","path3","path4","path5","path6","path7","path8","path9"];
			$.each(resetmenu_arr, function(index, value) {
			sym.$(value).fadeOut(0);
			});
         menuArray[h].$("btnClick").fadeOut(0);
         menuArray[h].$("btnOver").fadeOut(0);
		}
		//sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnOver").fadeOut(0);
		//sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnOver").fadeOut(0);
	}
	resetmenu();

	var gender = 0;
	var manWom = 0;

	function menuBtnClick (e){
		resetmenu(); //set them all back to normal state
		var menuMenu_id = (e.data.menuId); //get the id of the clicked item
		sym.getSymbol("btns").getSymbol("longBtn" + menuMenu_id).$("btnClick").fadeIn(0);
		gender = menuMenu_id;
		sxShw();
	}
	function menuShow (e){
		var menuMenu_id = (e.data.menuId); //get the id of the over button
		sym.getSymbol("btns").getSymbol("longBtn" + menuMenu_id).$("btnOver").fadeIn(0);
	}
	function menuHide (e){
		var menuMenu_id = (e.data.menuId); //get the id of the out button
		sym.getSymbol("btns").getSymbol("longBtn" + menuMenu_id).$("btnOver").fadeOut(0);
	}

// MAKE MENU 0 VISIBLE
	sym.getSymbol("btns").getSymbol("longBtn0").$("btnClick").fadeIn(0);

// BUTTON MEN
	sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnOver").fadeOut(0);

	sym.getSymbol("btns").$("sexBtnMan").on('touchstart click', function(e){
		e.stopPropagation(); e.preventDefault();
		manWom = 0;
		sxShw();
		sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnClick").fadeOut(200);
		sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnClick").fadeIn(200);
	});
	sym.getSymbol("btns").$("sexBtnMan").mouseover(function(e){
		sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnOver").fadeIn(200);
	});
	sym.getSymbol("btns").$("sexBtnMan").mouseout(function(e){
		sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnOver").fadeOut(200);
	});

// BUTTON WOMEN
	sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnClick").fadeOut(0);
	sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnOver").fadeOut(0);

	sym.getSymbol("btns").$("sexBtnWoman").on('touchstart click', function(e){
		e.stopPropagation(); e.preventDefault();
		manWom = 1;
		sxShw();
		sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnClick").fadeOut(0);
		sym.getSymbol("btns").getSymbol("sexBtnMan").$("btnOver").fadeOut(0);
		sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnClick").fadeIn(200);
	});
	sym.getSymbol("btns").$("sexBtnWoman").mouseover(function(e){
		sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnOver").fadeIn(200);
	});
	sym.getSymbol("btns").$("sexBtnWoman").mouseout(function(e){
		sym.getSymbol("btns").getSymbol("sexBtnWoman").$("btnOver").fadeOut(200);
	});

	function sxShw() {
			var resetmenu_arr = ["pathm0","pathw0","pathm1","pathw1","pathm2","pathw2","pathm3","pathw3","pathm4","pathw4"];
			$.each(resetmenu_arr, function(index, value) {
			sym.$(value).fadeOut(0);
			});
		if (manWom == 0){
			sym.$("pathm" + gender).fadeIn(500);
			sym.$("txt400").html("pathm" + gender);
			$.ajax({	
				type: "GET",
				url: "GN31230.xml",
				dataType: "xml",
				success: function(xml) {
				distance = $(xml).find('distance' + gender).text();
				distancetxt.html(distance);	
		}
		}); // END XML
		}
		if (manWom == 1){		
			sym.$("pathw" + gender).fadeIn(500);
			sym.$("txt400").html("pathw" + gender);
			$.ajax({	
				type: "GET",
				url: "GN31230.xml",
				dataType: "xml",
				success: function(xml) {
				distance = $(xml).find('distance' + (gender + 5)).text();
				distancetxt.html(distance);	
		}
		}); // END XML
		}
		}
sxShw();

		// LIVE MEDAL TABLE DATA FUNCTIONS
	var countries=[74,20,155,24,213,157,151,214,116,103,147,260,78,16,148,159,119,219,26,31,12,168,89,80,17,152,8,222,161,144,163,2,83,211,171,38,28,226,227,87,19,29,6,248,18,160,229,124,9,90,167,7,231,156,23,22,173,3679,172,274,1,158,94,153,236,174,130,150,10,164,146,175,165,239,107,14,30,178,106,145,154,149,132,33,13,5,15,162,241,72,73,197,242,11,3]
	var dataURL = ('http:'==document.location.protocol?"http://www2.graphicnews.com/":"https://www.graphicnews.org/")+ "infostradasports/api.php";
function getEvents(sportID){
	$.ajax({ type: "GET", url: dataURL,
		data: "type=olympics&yr=2014&gn=31160&q=events"+sportID,
		contentType: "text/plain", dataType: "jsonp", jsonp: "callback",
		async: true,
      crossDomain: true,
      success: function (data) {
				eventData=data;
				if (olyTime>=startTime){
					resultsHeadtxt.html(resultArr[0]);
					for (var i = 0; i < eventData.length; i++) {
						for (var n=0;n<sportarr.length; n++){			
							if (eventData[i].n_EventID==sportarr[n]){
								if (eventData[i].b_Finished==true){
								var phaseData=eventData[i].n_EventPhaseID;
								var eventTxt = "<div class='eventtab' id='event" +sportID + "_"+ i + "'>";
								eventTxt += "<div><span class='eventtitle' id='eventtitle"+sportID + "_"+ i + "'></span>"
								eventTxt += "<span class='date' id='date"+sportID + "_"+ i + "'></span></div>";
								eventTxt += "<div class='table'>";
								eventTxt += "<div class='medalwinners' id='results"+phaseData+"'></div><div class='gender' id='gender" + sportID + "_"+ i + "'></div></div></div>";
								sym.getSymbol("resultsMc").$("table").append(eventTxt);
								getPhase(phaseData);
							}else{
								var eventTxt = "<div class='eventtab' id='event" +sportID + "_"+ i + "'>";
								eventTxt += "<div><span class='eventtitle' id='eventtitle"+sportID + "_"+ i + "'></span>"
								eventTxt += "<span class='date' id='date"+sportID + "_"+ i + "'></span></div>";
								eventTxt += "<div class='gender' id='gender" + sportID + "_"+ i + "'></div></div>";
								sym.getSymbol("resultsMc").$("table").append(eventTxt);			
							}
							var eventID=eventData[i].n_EventID;
							var eventName;
							for(var c=0;c<sportarr.length;c++){
								if (eventID==sportarr[c]){
									eventName=sportCaps[c];
								}
							}
							$('#date' + sportID + '_' + i).text(getDDmonthYY(eventData[i].d_DateEndLocal));
							if (eventData[i].b_Finished==true){
									var imgGender='<img src="images/gender'+(eventData[i].n_GenderID)+'.png">';
									$('.date').css({'float':'right'});
									$('.gender').css({'opacity':'0.4','width':'8%'});
							}else{
									var imgGender='<img src="images/gender'+(eventData[i].n_GenderID)+'.png" height="18px">';
									$('.date').css({'float':'right', 'padding-right':'14%'});
									$('.gender').css({'width':'3.5%','padding':'0 3.5% 0 0'});
							}
							$('#gender' + sportID + '_' + i).html(imgGender);
							$('#eventtitle' + sportID + '_'  + i).text(eventName);
							$(".eventtab").css({'display':'table','width':'99%', 'font-size':'13px','font-family':'pragmatica-web, sans-serif', 'border-top':'1px solid rgb(255,255,255)','background-color':'rgba(255,255,255,0.4)', 'margin':'0 0 2px 0','padding':'0 0 0 1%', 'box-shadow':'0px 1px 0px rgba(150,150,150,0.5)'});	
							$('.eventtitle').css({'float':'left','font-weight':700});
							$('.table').css({'display':'table','clear':'both', 'width':'100%','height':'44px','overflow':'hidden'});
							$(".medalwinners").css({'display':'table-cell','float':'left','width':'100%'});
							$('.date').css({'float':'right'});
							$('.gender').css({'display':'table-cell'});
							}
						}
					}
				}else{
					resultsHeadtxt.html(resultArr[1]);
					if(numberEvents<3){
						sym.getSymbol('resultsMc').$('medalBtn').fadeOut(0);
						sym.getSymbol('resultsMc').$('table').css({'width': tableWidth+53+'px','left': tableLeft-52+'px'});
					}
					for (var i=0;i<numberEvents;i++){
						var eventTxt = "<div class='eventtab' id='event" +sportID + "_"+ i + "'>";
						eventTxt += "<div id='table'>";
						eventTxt += "<div id='medalwinners'>";
						eventTxt += "<div id='medalwinner'>";
						eventTxt += "<div class='medal' id='medal" + sportID + "_"+ i + "'><img src='images/gold2.png' height='16px'></div>";
						eventTxt += "<div class='flag' id='flag" + sportID + "_"+ i + "'></div>";
						eventTxt += "<div class='name' id ='name" + sportID + "_"+ i + "'></div>";
						eventTxt += "<div class='nation' id='nation" + sportID + "_"+ i + "'></div>";
						eventTxt += "<div class='gender' id='gender" + sportID + "_"+ i + "'></div>";
						eventTxt += "</div>";
						eventTxt += "</div></div>";
						sym.getSymbol("resultsMc").$("table").append(eventTxt);	
						var imgGender='<img src="images/gender'+(resultArr[i+2+(numberEvents*2)])+'.png" height="16px">';
						var imgFlag='<img src="flags/'+(resultArr[i+2+(numberEvents*3)])+'.png" height="14px">';
						$('#gender' + sportID + '_' + i).html(imgGender);
						$("#name" + sportID + "_"+ i).html(resultArr[i+2]);
						$("#nation" + sportID + "_"+ i).html(resultArr[i+2+numberEvents]);
						$("#flag" + sportID + "_"+ i).html(imgFlag);
						$(".eventtab").css({'display':'table','width':'99%', 'font-size':'13px','font-family':'pragmatica-web, sans-serif', 'border-top':'1px solid rgb(255,255,255)','background-color':'rgba(255,255,255,0.4)', 'margin':'0 0 2px 0','padding':'0 0 0 1%', 'box-shadow':'0px 1px 0px rgba(150,150,150,0.5)'});	
						$('.table').css({'display':'table','clear':'both', 'width':'100%','height':'44px','overflow':'hidden'});
						$(".medalwinners").css({'display':'table-cell','float':'left','width':'100%'});
						$('.date').css({'float':'right'});
						$('.gender').css({'display':'table-cell','padding':'0 3.5% 0 0'});
						$('.flag').css({'display':'table-cell','width':'10%','padding-left':'15px','padding-top':'3px'});
						$('.name').css({'display':'table-cell','width':'65%','padding-left':'5px'});
						$('.nation').css({'display':'table-cell','font-style':'oblique','width':'20%'});
						$('.medal').css({'display':'table-cell','width':'3%'});
					}
				}
		}
});
}
getEvents(sportID);

function getPhase(phase){
$.ajax({ type: "GET", url: dataURL,
		data: "type=olympics&yr=2014&gn=31160&q=result"+phase,
		contentType: "text/plain", dataType: "jsonp", jsonp: "callback",
		async: true,
      crossDomain: true,
      success: function (data) {
				phaseData=data;
				var medalNo=0;
				var medal=[' ','gold','silver','bronze'];
				for (var i = 0; i < phaseData.length; i++) {
					if (phaseData[i].b_MedalGold==true){
						medalNo=1;					
					}
					if(phaseData[i].b_MedalSilver==true){
						medalNo=2;
					}
					if (phaseData[i].b_MedalBronze==true){
						medalNo=3;
					}
					if (phaseData[i].b_MedalGold==true||phaseData[i].b_MedalSilver==true||phaseData[i].b_MedalBronze==true){
					var resultTxt = "<div class='medalwinner "+medal[medalNo]+"' id='"+medal[medalNo]+phase+"_"+i+"'>";
					resultTxt +="<div class='resultrank' id='resultrank"+phase+"_"+i+"'></div><div class='resultflag' id='resultflag" + phase + "_"+ i + "'></div>";
					resultTxt +="<div class='resultname' id='resultname" + phase + "_"+ i + "'></div>";
					resultTxt +="<div class='resultnation' id ='resultnation" + phase + "_"+ i + "'></div>";
					resultTxt +="<div class='medal' id='medalimg" + phase + "_"+ i + "'></div></div>";
					}else{
					var resultTxt = "";
					}
					$('#results'+phase).append(resultTxt);
					var medalHTML='<img src="images/'+medal[medalNo]+'2.png">';
					var imgHTML='<img src="flags/'+(phaseData[i].n_NOCID)+'.png" height="14px" width="24px">';
					$('#resultrank' + phase + '_'  + i).text(phaseData[i].c_Rank);
					$('#resultname' + phase + '_'  + i).text(phaseData[i].c_Participant);
               $('#resultnation' + phase + '_'  + i).text(phaseData[i].c_NOCShort);
               $('#resultflag' + phase + '_' + i).html(imgHTML);
               $('#medalimg' + phase + '_' + i).html(medalHTML);
					$(".medalwinner").css({'display':'table','width':'100%', 'padding':'0 0 0 3px', 'height':'18px','border-top':'1px solid rgb(114,206,255)'});
					$(".medal img").css({'height':'18px'});
               $(".resultflag").css({'display':'table-cell','width':'14%','padding-top':'3px'});
					$(".resultnation").css({'display':'table-cell','font-style':'oblique','width':'10%'});
					$(".resultname").css({'display':'table-cell','width':'45%'});
					$(".resultrank").css({'display':'table-cell','width':'6%'});
					$(".medal").css({'display':'table-cell','width':'5%'});
					$(".silver,.bronze").css({'display':'none'});
				}
		}
});
}


         	});//Edge binding end	
		
		// VIDEO BTN 1 =========================================================
         	
			
         	
         		
         	
			
			
         	// VIDEO BTN 2 =========================================================
         	
         	
         	
         		
         	
         	


   })("stage");
   //Edge symbol end:'stage'

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

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

   //=========================================================
   
   //Edge symbol: 'styleHead_1'
   (function(symbolName) {   
   
   })("styleHead");
   //Edge symbol end:'styleHead'

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

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

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

   //=========================================================
   
   //Edge symbol: 'medalBtn_1'
   (function(symbolName) {   
   
      })("sexBtn");
   //Edge symbol end:'sexBtn'

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

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

})(jQuery, AdobeEdge, "GraphicNews31230");