/***********************
* 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) {
	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");
	
	//create array of text elements
	var txt=[];
	txt[0] = sym.getSymbol("pointersMc").$("txt0").css("pointer-events","none");
	txt[1] = sym.getSymbol("pointersMc").$("txt1").css("pointer-events","none");
	txt[2] = sym.getSymbol("pointersMc").$("txt2").css("pointer-events","none");
	txt[3] = sym.getSymbol("pointersMc").$("txt3").css("pointer-events","none");
	txt[4] = sym.getSymbol("pointersMc").$("txt4").css("pointer-events","none");
	txt[5] = sym.getSymbol("pointersMc").$("txt5").css("pointer-events","none");
	txt[6] = sym.getSymbol("pointersMc").$("txt6").css("pointer-events","none");
	txt[7] = sym.getSymbol("pointersMc").$("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.getSymbol("tableNos").$("txt11").css("pointer-events","none");
	txt[12] = sym.getSymbol("tableNos").$("txt12").css("pointer-events","none");
	txt[13] = sym.getSymbol("tableNos").$("txt13").css("pointer-events","none");
	txt[14] = sym.getSymbol("tableNos").$("txt14").css("pointer-events","none");
	txt[15] = sym.getSymbol("tableNos").$("txt15").css("pointer-events","none");
	txt[16] = sym.getSymbol("tableNos").$("txt16").css("pointer-events","none");
	txt[17] = sym.getSymbol("tableNos").$("txt17").css("pointer-events","none");
	txt[18] = sym.$("txt18").css("pointer-events","none");
	txt[19] = sym.getSymbol("pointersMc").$("txt19").css("pointer-events","none");
	txt[20] = sym.getSymbol("raceMc0").$("txt20").css("pointer-events","none");
	txt[21] = sym.getSymbol("raceMc1").$("txt21").css("pointer-events","none");
	txt[22] = sym.getSymbol("raceMc2").$("txt22").css("pointer-events","none");
	txt[23] = sym.getSymbol("raceMc3").$("txt23").css("pointer-events","none");
	txt[24] = sym.getSymbol("raceMc4").$("txt24").css("pointer-events","none");
	txt[25] = sym.getSymbol("raceMc5").$("txt25").css("pointer-events","none");
	txt[26] = sym.getSymbol("raceMc6").$("txt26").css("pointer-events","none");
	txt[27] = sym.getSymbol("raceMc7").$("txt27").css("pointer-events","none");
	txt[28] = sym.getSymbol("raceMc8").$("txt28").css("pointer-events","none");
	txt[29] = sym.getSymbol("raceMc9").$("txt29").css("pointer-events","none");
	txt[30] = sym.getSymbol("raceMc10").$("txt30").css("pointer-events","none");
	txt[31] = sym.getSymbol("raceMc11").$("txt31").css("pointer-events","none");
	txt[32] = sym.getSymbol("pointersMc").$("txt32").css("pointer-events","none");
	txt[33] = sym.$("txt33").css("pointer-events","none");
	txt[34] = sym.$("txt34").css("pointer-events","none");
	txt[35] = sym.$("txt35").css("pointer-events","none");
	txt[36] = sym.$("txt36").css("pointer-events","none");
	txt[37] = sym.$("txt37").css("pointer-events","none");
	txt[38] = sym.$("txt38").css("pointer-events","none");
	txt[39] = sym.$("txt39").css("pointer-events","none");
	txt[40] = sym.$("txt40").css("pointer-events","none");
	var txtArr=[];
	
	//AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
	$.ajax({	
		type: "GET",
		url: "GN30960.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);
	
			//create array from xml, put it into array of text elements
			for (var i=0; i<33; i++){
			txtArr[i]=$(xml).find('txt'+i).text();
			txt[i].html(txtArr[i]);
			}
	
			//sym.getSymbol("SYMBOL").$("txt").animate({top:yNUMBER - sym.getSymbol("SYMBOL").$("txt").height()+10}, 200);
	
		}
	}); // END XML
	
	
	// STOP ELEMENTS INTERACTING WITH MOUSE
	sym.$("handMc").css("pointer-events","none");
	sym.$("handMc").delay(11000).animate ({left:740, top:70}, 1500, 'easeOutCubic');
	
	// MENU BUTTONS --------------------------------------------	
	menuArray = []; //the array that will hold references to the buttons.
	
	for (var h = 0; h < 12; h++){
		var menuBtnSymbols = sym.getSymbol("tableNos").getSymbol("btn" +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 = ["raceMc0","raceMc1","raceMc2","raceMc3","raceMc4","raceMc5","raceMc6","raceMc7","raceMc8","raceMc9","raceMc10","raceMc11"];
			$.each(resetmenu_arr, function(index, value) {
			sym.$(value).fadeOut(0);
			});
         menuArray[h].$("btnClick").fadeOut(0);
         menuArray[h].$("btnOver").fadeOut(0);
		}
	}
	resetmenu();

	function menuBtnClick (e){
		sym.$('handMc').fadeOut(0);
		sym.$("trackMc").fadeOut(0);
		sym.$("start").fadeOut(0);
		sym.stop(9990);
		resetmenu(); //set them all back to normal state
		var menuMenu_id = (e.data.menuId); //get the id of the clicked item
		sym.getSymbol("tableNos").getSymbol("btn" + menuMenu_id).$("btnClick").fadeIn(0);
		sym.$("raceMc" + menuMenu_id).fadeIn(0);
		if (menuMenu_id==0) {
		}
		if (menuMenu_id==1) {
		}
		if (menuMenu_id==2) {
		}
	}
	function menuShow (e){
		var menuMenu_id = (e.data.menuId); //get the id of the over button
		sym.$('handMc').hide();
		sym.getSymbol("tableNos").getSymbol("btn" + menuMenu_id).$("btnOver").fadeIn(0);
	}
	function menuHide (e){
		var menuMenu_id = (e.data.menuId); //get the id of the out button
		sym.getSymbol("tableNos").getSymbol("btn" + menuMenu_id).$("btnOver").fadeOut(0);
	}



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


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

//=========================================================
   //Edge symbol: 'handMc'
   (function(symbolName) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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