/***********************
* 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");
	var menuIcon0;
	var menuIcon0txt = sym.getSymbol("styleHead").getSymbol("menuBtn0").$("txt").css("pointer-events","none");
	var menuTxt0;
	var menuTxt0txt = sym.getSymbol("styleHead").$("menuTxt0").css("pointer-events","none");
	
	//create array of text elements
	var txt=[];
	txt[0] = sym.getSymbol("courseMc").$("txt0").css("pointer-events","none");
	txt[1] = sym.$("txt1").css("pointer-events","none");
	txt[2] = sym.$("txt2").css("pointer-events","none");
	txt[3] = sym.$("txt3").css("pointer-events","none");
	txt[4] = sym.getSymbol("courseMc").$("txt4").css("pointer-events","none");
	txt[5] = sym.getSymbol("courseMc").$("txt5").css("pointer-events","none");
	txt[6] = sym.getSymbol("courseMc").$("txt6").css("pointer-events","none");
	txt[7] = sym.getSymbol("courseMc").$("txt7").css("pointer-events","none");
	txt[8] = sym.getSymbol("courseMc").$("txt8").css("pointer-events","none");
	txt[9] = sym.getSymbol("courseMc").$("txt9").css("pointer-events","none");
	txt[10] = sym.getSymbol("courseMc").$("txt10").css("pointer-events","none");
	txt[11] = sym.getSymbol("courseMc").$("txt11").css("pointer-events","none");
	txt[12] = sym.getSymbol("courseMc").$("txt12").css("pointer-events","none");
	txt[13] = sym.getSymbol("courseMc").$("txt13").css("pointer-events","none");
	txt[14] = sym.getSymbol("courseMc").$("txt14").css("pointer-events","none");
	txt[15] = sym.getSymbol("courseMc").$("txt15").css("pointer-events","none");
	txt[16] = sym.getSymbol("courseMc").$("txt16").css("pointer-events","none");
	txt[17] = sym.getSymbol("courseMc").$("txt17").css("pointer-events","none");
	txt[18] = sym.getSymbol("courseMc").$("txt18").css("pointer-events","none");
	txt[19] = sym.getSymbol("courseMc").$("txt19").css("pointer-events","none");
	txt[20] = sym.getSymbol("courseMc").$("txt20").css("pointer-events","none");
	txt[21] = sym.getSymbol("courseMc").$("txt21").css("pointer-events","none");
	txt[22] = sym.getSymbol("courseMc").$("txt22").css("pointer-events","none");
	txt[23] = sym.getSymbol("courseMc").$("txt23").css("pointer-events","none");
	txt[24] = sym.getSymbol("courseMc").$("txt24").css("pointer-events","none");
	txt[25] = sym.getSymbol("courseMc").$("txt25").css("pointer-events","none");
	txt[26] = sym.getSymbol("courseMc").$("txt26").css("pointer-events","none");
	txt[27] = sym.getSymbol("courseMc").$("txt27").css("pointer-events","none");
	txt[28] = sym.getSymbol("courseMc").$("txt28").css("pointer-events","none");
	txt[29] = sym.getSymbol("courseMc").$("txt29").css("pointer-events","none");
	txt[30] = sym.getSymbol("courseMc").$("txt30").css("pointer-events","none");
	txt[31] = sym.getSymbol("courseMc").$("txt31").css("pointer-events","none");
	txt[32] = sym.getSymbol("courseMc").$("txt32").css("pointer-events","none");
	txt[33] = sym.getSymbol("courseMc").$("txt33").css("pointer-events","none");
	txt[34] = sym.getSymbol("courseMc").$("txt34").css("pointer-events","none");
	txt[35] = sym.getSymbol("courseMc").$("txt35").css("pointer-events","none");
	txt[36] = sym.getSymbol("courseMc").$("txt36").css("pointer-events","none");
	txt[37] = sym.getSymbol("courseMc").$("txt37").css("pointer-events","none");
	txt[38] = sym.getSymbol("courseMc").$("txt38").css("pointer-events","none");
	txt[39] = sym.getSymbol("courseMc").$("txt39").css("pointer-events","none");
	txt[40] = sym.getSymbol("courseMc").$("txt40").css("pointer-events","none");
	txt[41] = sym.getSymbol("courseMc").$("txt41").css("pointer-events","none");
	txt[42] = sym.getSymbol("courseMc").$("txt42").css("pointer-events","none");
	txt[43] = sym.getSymbol("courseMc").$("txt43").css("pointer-events","none");
	txt[44] = sym.getSymbol("courseMc").$("txt44").css("pointer-events","none");
	txt[45] = sym.getSymbol("courseMc").$("txt45").css("pointer-events","none");
	txt[46] = sym.getSymbol("courseMc").$("txt46").css("pointer-events","none");
	txt[47] = sym.getSymbol("courseMc").$("txt47").css("pointer-events","none");
	txt[48] = sym.getSymbol("torchMc").$("txt48").css("pointer-events","none");
	txt[49] = sym.getSymbol("torchMc").$("txt49").css("pointer-events","none");
	txt[50] = sym.getSymbol("torchMc").$("txt50").css("pointer-events","none");
	txt[51] = sym.getSymbol("torchMc").$("txt51").css("pointer-events","none");
	txt[52] = sym.getSymbol("torchMc").$("txt52").css("pointer-events","none");
	txt[53] = sym.getSymbol("torchMc").$("txt53").css("pointer-events","none");
	txt[54] = sym.getSymbol("torchMc").$("txt54").css("pointer-events","none");
	txt[55] = sym.getSymbol("torchMc").$("txt55").css("pointer-events","none");
	txt[56] = sym.getSymbol("torchMc").$("txt56").css("pointer-events","none");
	txt[57] = sym.getSymbol("torchMc").$("txt57").css("pointer-events","none");
	txt[58] = sym.getSymbol("torchMc").$("txt58").css("pointer-events","none");
	txt[59] = sym.getSymbol("torchMc").$("txt59").css("pointer-events","none");
	txt[60] = sym.getSymbol("torchMc").$("txt60").css("pointer-events","none");
	txt[61] = sym.getSymbol("torchMc").$("txt61").css("pointer-events","none");
	txt[62] = sym.getSymbol("torchMc").$("txt62").css("pointer-events","none");
	txt[63] = sym.getSymbol("torchMc").$("txt63").css("pointer-events","none");
	txt[64] = sym.getSymbol("torchMc").$("txt64").css("pointer-events","none");
	txt[65] = sym.getSymbol("torchMc").$("txt65").css("pointer-events","none");
	txt[66] = sym.getSymbol("torchMc").$("txt66").css("pointer-events","none");
	txt[67] = sym.getSymbol("torchMc").$("txt67").css("pointer-events","none");
	txt[68] = sym.getSymbol("torchMc").$("txt68").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: "GN31045.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);
			menuTxt0 = $(xml).find('menuTxt0').text();
			menuTxt0txt.html(menuTxt0);  
	
			//create array from xml, put it into array of text elements
			for (var i=0; i<69; i++){
			txtArr[i]=$(xml).find('txt'+i).text();
			txt[i].html(txtArr[i]);
			}
		}
	}); // END XML
	
	// STOP ELEMENTS INTERACTING WITH MOUSE
	sym.$("handMc").css("pointer-events","none");
	
	sym.getSymbol("courseMc").$("playBtn").animate ({opacity:0, left:400, top:335, width:1, height:1}, 0);
	sym.getSymbol("courseMc").$("playBtn").delay(500).animate ({opacity:1, left:365, top:300, width:70, height:70}, 2000, 'easeOutBounce');
	
	var btnClick = 0;
	
	// BUTTONS PLAY START
	sym.getSymbol("courseMc").$("playBtn").on('touchstart click', function(e){
	e.stopPropagation(); e.preventDefault();
		if (btnClick == 0) {
			sym.getSymbol("courseMc").play(1);
			sym.getSymbol("courseMc2").play(1);
			sym.getSymbol("courseMc3").play(1);
			sym.getSymbol("courseMc4").play(1);
			sym.getSymbol("courseMc").$("playBtn").animate ({opacity:0, left:400, top:335, width:1, height:1}, 800);
			btnClick = 1;
		}else{
			sym.getSymbol("courseMc").play(1);
			sym.getSymbol("courseMc2").play(1);
			sym.getSymbol("courseMc3").play(1);
			sym.getSymbol("courseMc4").play(1);
			sym.getSymbol("courseMc").$("playBtn").animate ({opacity:0, left:460, top:315, width:1, height:1}, 800);
	}
	});
	
	var torchUp = 0;
	
	// BUTTON TORCH
	
	sym.getSymbol("styleHead").$("menuBtn0").on('touchstart click', function(e){
		e.stopPropagation(); e.preventDefault();
		if (torchUp == 0) {
			torchPlay()
			sym.$("torchMc").animate ({top:0}, 500, 'easeOutCubic');
			torchUp = 1;
		}else{
			torchStop();
			sym.$("torchMc").animate ({top:800}, 500, 'easeInCubic');
			torchUp = 0;
		}
	});
	sym.getSymbol("styleHead").$("menuBtn0").mouseover(function(){
		sym.getSymbol("styleHead").getSymbol("menuBtn0").$("btnOut").fadeOut(200);
	});
	sym.getSymbol("styleHead").$("menuBtn0").mouseout(function(){
		sym.getSymbol("styleHead").getSymbol("menuBtn0").$("btnOut").fadeIn(200);
	});
	
	// CLOSE BTN
	sym.getSymbol("torchMc").$("closeBtn").on('touchstart click', function(e){
		e.stopPropagation(); e.preventDefault();
		torchStop();
		sym.$("torchMc").animate ({top:800}, 500, 'easeInCubic');
		torchUp = 0;
	});
	
	sym.$("torchMc").animate ({top:800}, 0);
	
	function torchPlay() {
		sym.getSymbol("torchMc").getSymbol("flameMc1").play(1);
		sym.getSymbol("torchMc").getSymbol("flameMc2").play(1500);
		sym.getSymbol("torchMc").getSymbol("flameMc3").play(500);
		sym.getSymbol("torchMc").getSymbol("flameMc4").play(2000);
		sym.getSymbol("torchMc").getSymbol("flameMc5").play(2500);
	}
	
	function torchStop() {
		sym.getSymbol("torchMc").getSymbol("flameMc1").stop();
		sym.getSymbol("torchMc").getSymbol("flameMc2").stop();
		sym.getSymbol("torchMc").getSymbol("flameMc3").stop();
		sym.getSymbol("torchMc").getSymbol("flameMc4").stop();
		sym.getSymbol("torchMc").getSymbol("flameMc5").stop();
	}
	
	

         	});//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: 'StyleBase'
   (function(symbolName) {   
   
   })("StyleBase");
   //Edge symbol end:'StyleBase'

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

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

   //=========================================================
   
   //Edge symbol: 'courseMc'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 25500, function(sym, e) {
         var mySymbolObject = sym.$("playBtn").animate ({opacity:0, left:460, top:315, width:1, height:1}, 0);
         var mySymbolObject = sym.$("playBtn").delay(500).animate ({opacity:0.2, left:440, top:290, width:50, height:50}, 2000, 'easeOutBounce');

      });
      //Edge binding end

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

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

   //=========================================================
   
   //Edge symbol: 'flameMc'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 3000, function(sym, e) {
         // play the timeline from the given position (ms or label)
         sym.play(1);

      });
      //Edge binding end

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

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

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

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

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