/***********************
* 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("nucMc").$("txt0").css("pointer-events","none");
	txt[1] = sym.getSymbol("nucMc").$("txt1").css("pointer-events","none");
	txt[2] = sym.getSymbol("nucMc").$("txt2").css("pointer-events","none");
	txt[3] = sym.getSymbol("nucMc").$("txt3").css("pointer-events","none");
	txt[4] = sym.getSymbol("nucMc").$("txt4").css("pointer-events","none");
	txt[5] = sym.getSymbol("nucMc").$("txt5").css("pointer-events","none");
	txt[6] = sym.getSymbol("nucMc").$("txt6").css("pointer-events","none");
	txt[7] = sym.getSymbol("nucMc").$("txt7").css("pointer-events","none");
	txt[8] = sym.getSymbol("nucMc").$("txt8").css("pointer-events","none");
	txt[9] = sym.getSymbol("nucMc").$("txt9").css("pointer-events","none");
	txt[10] = sym.getSymbol("nucMc").$("txt10").css("pointer-events","none");
	txt[11] = sym.getSymbol("nucMc").$("txt11").css("pointer-events","none");
	txt[12] = sym.getSymbol("nucMc").$("txt12").css("pointer-events","none");
	
	var txtArr=[];
	
	$.ajax({	
		type: "GET",
		url: "GN31209.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<13; i++){
			txtArr[i]=$(xml).find('txt'+i).text();
			txt[i].html(txtArr[i]);
			}
		}
	}); // END XML
	//set the value of a Symbol variable
	sym.setVariable("loop", 0);
	
	sym.getSymbol("nucMc").$("nextBtn").on('touchstart click', function(e){
	e.stopPropagation(); e.preventDefault();
	btnClick();
	});
	
	sym.getSymbol("nucMc").$("replayBtn").on('touchstart click', function(e){
	e.stopPropagation(); e.preventDefault();
	btnClick();
	});
	
	function btnClick() {
		//get the value of a Symbol variable
		var removalloop = sym.getVariable("loop");
		if(removalloop>0){
		sym.getSymbol("nucMc").play(15325);
		}else{
		sym.getSymbol("nucMc").play();
		}
	}

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


      

      

      

      

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

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

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

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

   //=========================================================
   
   //Edge symbol: 'nucMc'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 250, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 4243, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 5286, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 15853, function(sym, e) {
         sym.getComposition().getStage().setVariable("loop", 0);
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 22118, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 15225, function(sym, e) {
         //get the value of a Symbol variable
         var myloop = sym.getComposition().getStage().getVariable("loop");
         if (myloop<10){
         sym.play(11708);
         }else{
         sym.play();
         }

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 11708, function(sym, e) {
         var nextloop = sym.getComposition().getStage().getVariable("loop");
         nextloop++;
         sym.getComposition().getStage().setVariable("loop", nextloop);

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 10999, function(sym, e) {
         sym.getComposition().getStage().setVariable("loop", 1);

      });
      //Edge binding end

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

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