/***********************
* 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) {
//get the id of the clicked item         // insert code to be run when the composition is fully loaded here

         var headline;
         var headlinetxt = sym.$("headlineTxt").css("pointer-events","none");
         var stand;
         var standtxt = sym.$("standTxt").css("pointer-events","none");
         var source;
         var sourcetxt = sym.$("sourceTxt").css("pointer-events","none");
         var txt1;
         var txt1txt = sym.$("txt1").css("pointer-events","none");
         var txt2;
         var txt2txt = sym.$("txt2").css("pointer-events","none");
         var txt3;
         var txt3txt = sym.$("txt3").css("pointer-events","none");
         var txt4;
         var txt4txt = sym.$("txt4").css("pointer-events","none");
         var txt5;
         var txt5txt = sym.$("txt5").css("pointer-events","none");
         var txt6;
         var txt6txt = sym.$("txt6").css("pointer-events","none");
         var txt7;
         var txt7txt = sym.$("txt7").css("pointer-events","none");
         var txt8;
         var txt8txt = sym.$("txt8").css("pointer-events","none");
         var txt9;
         var txt9txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt9").css("pointer-events","none");
         var txt10;
         var txt10txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt10").css("pointer-events","none");
         var txt11;
         var txt11txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt11").css("pointer-events","none");
         var txt12;
         var txt12txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt12").css("pointer-events","none");
         var txt13;
         var txt13txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt13").css("pointer-events","none");
         var txt14;
         var txt14txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt14").css("pointer-events","none");
         var txt15;
         var txt15txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt15").css("pointer-events","none");
         var txt16;
         var txt16txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt16").css("pointer-events","none");
         var txt17;
         var txt17txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt17").css("pointer-events","none");
         var txt18;
         var txt18txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt18").css("pointer-events","none");
         var txt19;
         var txt19txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt19").css("pointer-events","none");
         var txt20;
         var txt20txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt20").css("pointer-events","none");
         var txt21;
         var txt21txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt21").css("pointer-events","none");
         var txt22;
         var txt22txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt22").css("pointer-events","none");
         var txt23;
         var txt23txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt23").css("pointer-events","none");
         var txt24;
         var txt24txt = sym.getSymbol("Arrow").$("txt24").css("pointer-events","none");
         var txt25;
         var txt25txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt25").css("pointer-events","none");
         var txt26;
         var txt26txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt26").css("pointer-events","none");
         var txt27;
         var txt27txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt27").css("pointer-events","none");
         var txt28;
         var txt28txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt28").css("pointer-events","none");
         var txt29;
         var txt29txt = sym.getSymbol("Arrow").getSymbol("headsComplete").$("txt29").css("pointer-events","none");
         var txt30;
         var txt30txt = sym.getSymbol("Arrow").$("txt30").css("pointer-events","none");
         var txt31;
         var txt31txt = sym.getSymbol("Arrow").$("txt31").css("pointer-events","none");
         var txt32;
         var txt32txt = sym.getSymbol("datesMc").$("txt32").css("pointer-events","none");
         var txt33;
         var txt33txt = sym.getSymbol("datesMc").$("txt33").css("pointer-events","none");
         var txt34;
         var txt34txt = sym.getSymbol("datesMc").$("txt34").css("pointer-events","none");
         var txt35;
         var txt35txt = sym.getSymbol("datesMc").$("txt35").css("pointer-events","none");
         var txt36;
         var txt36txt = sym.getSymbol("datesMc").$("txt36").css("pointer-events","none");
         var txt37;
         var txt37txt = sym.getSymbol("datesMc").$("txt37").css("pointer-events","none");
         var txt38;
         var txt38txt = sym.getSymbol("datesMc").$("txt38").css("pointer-events","none");
         var txt39;
         var txt39txt = sym.getSymbol("datesMc").$("txt39").css("pointer-events","none");
         var txt40;
         var txt40txt = sym.getSymbol("datesMc").$("txt40").css("pointer-events","none");
         var txt41;
         var txt41txt = sym.getSymbol("datesMc").$("txt41").css("pointer-events","none");
         var txt42;
         var txt42txt = sym.getSymbol("datesMc").$("txt42").css("pointer-events","none");
         var txt43;
         var txt43txt = sym.getSymbol("datesMc").$("txt43").css("pointer-events","none");
         var txt44;
         var txt44txt = sym.getSymbol("datesMc").$("txt44").css("pointer-events","none");
         var txt45;
         var txt45txt = sym.getSymbol("datesMc").$("txt45").css("pointer-events","none");
         var txt46;
         var txt46txt = sym.getSymbol("datesMc").$("txt46").css("pointer-events","none");
         var txt47;
         var txt47txt = sym.getSymbol("datesMc").$("txt47").css("pointer-events","none");
         var txt48;
         var txt48txt = sym.$("txt48").css("pointer-events","none");
         var txt49;
         var txt49txt = sym.$("txt49").css("pointer-events","none");
         var txt50;
         var txt50txt = sym.$("txt50").css("pointer-events","none");


           //AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
           $.ajax({	
         	type: "GET",
         	url: "GN30025.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);
         		txt1 = $(xml).find('txt1').text();
         		txt1txt.html(txt1);
         		txt2 = $(xml).find('txt2').text();
         		txt2txt.html(txt2);
         		txt3 = $(xml).find('txt3').text();
         		txt3txt.html(txt3);
         		txt4 = $(xml).find('txt4').text();
         		txt4txt.html(txt4)
         		txt5 = $(xml).find('txt5').text();
         		txt5txt.html(txt5);
         		txt6 = $(xml).find('txt6').text();
         		txt6txt.html(txt6);
         		txt7 = $(xml).find('txt7').text();
         		txt7txt.html(txt7);
         		txt8 = $(xml).find('txt8').text();
         		txt8txt.html(txt8);
         		txt9 = $(xml).find('txt9').text();
         		txt9txt.html(txt9);
         		txt10 = $(xml).find('txt10').text();
         		txt10txt.html(txt10);
         		txt11 = $(xml).find('txt11').text();
         		txt11txt.html(txt11);
         		txt12 = $(xml).find('txt12').text();
         		txt12txt.html(txt12);
         		txt13 = $(xml).find('txt13').text();
         		txt13txt.html(txt13);
         		txt14 = $(xml).find('txt14').text();
         		txt14txt.html(txt14);
         		txt15 = $(xml).find('txt15').text();
         		txt15txt.html(txt15);
         		txt16 = $(xml).find('txt16').text();
         		txt16txt.html(txt16);
         		txt17 = $(xml).find('txt17').text();
         		txt17txt.html(txt17);
         		txt18 = $(xml).find('txt18').text();
         		txt18txt.html(txt18);
         		txt19 = $(xml).find('txt19').text();
         		txt19txt.html(txt19);
         		txt20 = $(xml).find('txt20').text();
         		txt20txt.html(txt20);
         		txt21 = $(xml).find('txt21').text();
         		txt21txt.html(txt21);
         		txt22 = $(xml).find('txt22').text();
         		txt22txt.html(txt22);
         		txt23 = $(xml).find('txt23').text();
         		txt23txt.html(txt23);
         		txt24 = $(xml).find('txt24').text();
         		txt24txt.html(txt24);
         		txt25 = $(xml).find('txt25').text();
         		txt25txt.html(txt25);
         		txt26 = $(xml).find('txt26').text();
         		txt26txt.html(txt26);
         		txt27 = $(xml).find('txt27').text();
         		txt27txt.html(txt27);
         		txt28 = $(xml).find('txt28').text();
         		txt28txt.html(txt28);
         		txt29 = $(xml).find('txt29').text();
         		txt29txt.html(txt29);
         		txt30 = $(xml).find('txt30').text();
         		txt30txt.html(txt30);   
         		txt31 = $(xml).find('txt31').text();
         		txt31txt.html(txt31);   
         		txt32 = $(xml).find('txt32').text();
         		txt32txt.html(txt32);   
         		txt33 = $(xml).find('txt33').text();
         		txt33txt.html(txt33);    
         		txt34 = $(xml).find('txt34').text();
         		txt34txt.html(txt34);
         		txt35 = $(xml).find('txt35').text();
         		txt35txt.html(txt35);   
         		txt36 = $(xml).find('txt36').text();
         		txt36txt.html(txt36);   
         		txt37 = $(xml).find('txt37').text();
         		txt37txt.html(txt37);   
         		txt38 = $(xml).find('txt38').text();
         		txt38txt.html(txt38);   
         		txt39 = $(xml).find('txt39').text();
         		txt39txt.html(txt39);   
         		txt40 = $(xml).find('txt40').text();
         		txt40txt.html(txt40);   
         		txt41 = $(xml).find('txt41').text();
         		txt41txt.html(txt41);
         		txt42 = $(xml).find('txt42').text();
         		txt42txt.html(txt42);   
         		txt43 = $(xml).find('txt43').text();
         		txt43txt.html(txt43);   
         		txt44 = $(xml).find('txt44').text();
         		txt44txt.html(txt44);   
         		txt45 = $(xml).find('txt45').text();
         		txt45txt.html(txt45);   
         		txt46 = $(xml).find('txt46').text();
         		txt46txt.html(txt46);   
         		txt47 = $(xml).find('txt47').text();
         		txt47txt.html(txt47);   
         		txt48 = $(xml).find('txt48').text();
         		txt48txt.html(txt48);   
         		txt49 = $(xml).find('txt49').text();
         		txt49txt.html(txt49);   
         		txt50 = $(xml).find('txt50').text();
         		txt50txt.html(txt50);                 
         		}
         	}); // END XML

// STOP ELEMENTS INTERACTING WITH MOUSE
	sym.$("handMc").css("pointer-events","none");


// MAKE ELEMENTS INVISIBLE
	sym.$("handMc").animate({opacity: 0}, 0);
	sym.$("datesOver").fadeOut(0);
	sym.$("datesMc").fadeOut(0);

// MOVE HAND
	sym.$("handMc").delay(500).animate ({opacity:1, left:26, top:564}, 2000);
	sym.$("handMc").delay(200).animate ({left:755, top:41}, 2000);
	sym.$("handMc").fadeOut(500);

// TOGGLE BUTTON
	var btnShow = 0;
	Symbol.bindElementAction(compId, symbolName, "${_datesBtn}", "click", function(sym, e) {
		if (btnShow == 0) {
			sym.$("datesOver").fadeIn(500);
			sym.$("datesOut").fadeOut(500);
			sym.$("datesMc").fadeIn(500);
			btnShow = 1;
		}else{
			sym.$("datesOut").fadeIn(500);
			sym.$("datesOver").fadeOut(500);
			sym.$("datesMc").fadeOut(500);
			btnShow = 0;
		}
	});





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


      Symbol.bindElementAction(compId, symbolName, "${_Stage}", "mousemove", function(sym, e) {
         // check if being dragged
         //get the value of a Symbol variable
         var dragged = sym.getVariable("thumbDragged");
         
         if(dragged) {
         
         	// get thumb values
         	var thumbWidth = parseFloat( sym.$("Thumb").css("width") );
         
         	// get track values
         	var leftMargin  = parseFloat( sym.$("Track").css("left") ) + thumbWidth/1.9;
         	var trackWidth  = parseFloat( sym.$("Track").css("width") ) - thumbWidth;
         	var rightMargin = parseFloat( leftMargin + trackWidth ); 
         
         	//get the value of a Symbol variable
         	var symbolName = sym.getVariable("symbolName");
         
         
         	if(e.pageX >= leftMargin &&
         		e.pageX <= rightMargin &&
         		symbolName) {
         		// get the new position of the thumb
         		var newPos = e.pageX-thumbWidth/2;
         
         		// move the thumb
         		sym.$("Thumb").css("left", newPos);
         
         		// calculate percentage of rail
         		var percent = (e.pageX-leftMargin) / trackWidth;
         
         		// grab hold of arrow symbol
         		// Lookup the Edge Animate Symbol Javascript Object from an element that is
         		// an instance of a symbol. The symbol object can be used to invoke
         		// symbol functions like play, stop etc.
         		var arrow = sym.getSymbol(symbolName);
         
         		// get the symbol duration
         		var duration = arrow.getDuration();
         
         		// move the arrow playhead
         		arrow.stop(duration * percent);
         	}
         }
         

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         //set the value of a Symbol variable
         sym.setVariable("symbolName", "Arrow");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_Thumb}", "mousedown", function(sym, e) {
         //set the value of a Symbol variable
         sym.setVariable("thumbDragged", true);
         
         // cancel normal browser drag
         e.preventDefault();
         
         // add listener to the stage
         sym.$("Stage").bind("mouseup", function() { 
         	//set the value of a Symbol variable
         	sym.setVariable("thumbDragged", false);
         
         	// unbind the mouseup
         	sym.$("Stage").unbind("mouseup");
         });
         

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_Thumb}", "mouseup", function(sym, e) {
         //set the value of a Symbol variable
         sym.setVariable("thumbDragged", false);
         
         // unbind the mouseup
         sym.$("Stage").unbind("mouseup");

      });
      //Edge binding end

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

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

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

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

      });
      //Edge binding end

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

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

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

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

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