/***********************
* 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 xmlNo = "GN31823.xml";
	
	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 txt=[];
	txt[0] = sym.getSymbol("ballsMc").$("txt0").css({"pointer-events":"none",});
	txt[1] = sym.getSymbol("ballsMc").$("txt1").css({"pointer-events":"none"});
	txt[2] = sym.getSymbol("ballsMc").$("txt2").css({"pointer-events":"none"});
	txt[3] = sym.getSymbol("ballsMc").$("txt3").css({"pointer-events":"none"});
	txt[4] = sym.getSymbol("ballsMc").$("txt4").css({"pointer-events":"none"});
	txt[5] = sym.getSymbol("ballsMc").$("txt5").css({"pointer-events":"none"});
	txt[6] = sym.getSymbol("ballsMc").$("txt6").css({"pointer-events":"none"});
	txt[7] = sym.getSymbol("ballsMc").$("txt7").css({"pointer-events":"none"});
	txt[8] = sym.getSymbol("ballsMc").$("txt8").css({"pointer-events":"none"});
	txt[9] = sym.getSymbol("ballsMc").getSymbol("brazAllMc").$("txt9").css({"pointer-events":"none", "background-color":"rgba(0,0,0,1)", "border-radius":"5px", "padding":"8px", "border-width":"1px","border-style":"solid","border-color":"rgba(255,255,255,1"});
	txt[10] = sym.getSymbol("ballsMc").getSymbol("brazAllMc").$("txt10").css({"pointer-events":"none", "background-color":"rgba(0,0,0,1)", "border-radius":"5px", "padding":"8px", "border-width":"1px","border-style":"solid","border-color":"rgba(255,255,255,1"});
	txt[11] = sym.getSymbol("ballsMc").$("txt11").css({"pointer-events":"none", "background-color":"rgba(0,0,0,0.8)", "border-radius":"5px", "padding":"8px", "border-width":"1px","border-style":"solid","border-color":"rgba(255,255,255,1"});
	txt[12] = sym.getSymbol("ballsMc").$("txt12").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: xmlNo,
		dataType: "xml",
		success: function(xml) {
			custonCol = $(xml).find('customColour').text();
			sym.getSymbol("styleHead").$("headerBox").css("background-color",custonCol);
			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]);
			}
	
			sym.getSymbol("ballsMc").getSymbol("brazAllMc").$("txt9").animate({left:104 - sym.getSymbol("ballsMc").getSymbol("brazAllMc").$("txt9").width()/2}, 0);
			sym.getSymbol("ballsMc").getSymbol("brazAllMc").$("txt10").animate({left:104 - sym.getSymbol("ballsMc").getSymbol("brazAllMc").$("txt10").width()/2}, 0);
			sym.getSymbol("ballsMc").$("txt11").animate({top:136 - sym.getSymbol("ballsMc").$("txt11").height()+5}, 0);
		}
	}); // END XML
	
	
	//BUTTONS breakBall
	var toggle1 = 0;
	
	sym.$("btnRnd").on('touchstart click', function(e){
	e.stopPropagation(); e.preventDefault();
	if (toggle1 == 0) {
		sym.getSymbol("btnRnd").$("btnMinus").fadeIn(0);
		sym.getSymbol("btnRnd").$("btnPlus").fadeOut(0);   
		sym.getSymbol("ballsMc").getSymbol("brazAllMc").play();
		sym.getSymbol("ballsMc").$("txt12").fadeOut(100);
		sym.getSymbol("ballsMc").$("txt11").fadeOut(100);
		sym.getSymbol("ballsMc").$("pointers").fadeOut(100);
		toggle1 = 1;
	}else{
		sym.getSymbol("btnRnd").$("btnMinus").fadeOut(0);
		sym.getSymbol("btnRnd").$("btnPlus").fadeIn(0);
		sym.getSymbol("ballsMc").getSymbol("brazAllMc").playReverse();
		sym.getSymbol("ballsMc").$("txt12").delay(500).fadeIn(100);
		sym.getSymbol("ballsMc").$("txt11").delay(500).fadeIn(100);
		sym.getSymbol("ballsMc").$("pointers").delay(500).fadeIn(100);
		toggle1 = 0;
	}
	}); 
	sym.$("btnRnd").mouseover(function(){
	sym.getSymbol("btnRnd").$("btnRndOut").fadeOut(200);
	});
	sym.$("btnRnd").mouseout(function(){
	sym.getSymbol("btnRnd").$("btnRndOut").fadeIn(200);
	});
	
	
	

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


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

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

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

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

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

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

      });
      //Edge binding end

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

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

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 4740, function(sym, e) {
         sym.stop();
         
         sym.getSymbol("brazAllMc").play(1);

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 4740, function(sym, e) {
         sym.stop();
         
         sym.getSymbol("brazAllMc").play(1);

      });
      //Edge binding end

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

      });
      //Edge binding end

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

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