/***********************
* 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) {
         // insert code for compositionReady event here
         
         var menu_arr = ["table01Txt", "table02Txt", "table03Txt", "table04Txt", "table05Txt", "table06Txt", "table07Txt", "table08Txt", "table09Txt", "table10Txt"];
         $.each(menu_arr, function(index, value) {
         sym.$(value).css('line-height', '135%');
         });
         
         var headline;
         var headlinetxt = sym.$("headlineTxt");
         headlinetxt.css('font-weight', '900');
         var venue;
         var key01;
         var key02;
         var month01;
         var month02;
         var sources;
         var pictures;
         var tablesubhead01
         var table01;
         var table02;
         var table03;
         var table04;
         var table05;
         var cap1;
         var cap2;
         var cap3;
         var cap4;
         var cap5;
         var cap6;
         var cap7;
         var cap8;
         var cap9;
         var cap10;
         var cap11;
         var cap12;
         var cap13;
         var cap14;
         var cap15;
         var cap16;
         var cap17;
         var cap18;
         var cap19;
         var cap20;
         var cap21;
         var cap22;
         var cap23;
         var cap24;
         var cap25;
         var cap26;
         var cap27;
         var cap28;
         var cap29;
         var cap30;
         var cap31;
         var cap32;
         var cap33;
         var cap34;
         var cap35;
         var cap36;
         var cap37;
         var cap38;
         var cap39;
         var cap40;
         var cap41;
         var cap42;
         var cap43;
         var cap44;
         
         
         
         //AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
         
         $.ajax({	
         	type: "GET",
         	url: "GN29641.xml",
         	dataType: "xml",
         	success: function(xml) {
         	
         		headline = $(xml).find('headline').text();
         		sym.$("headlineTxt").html(headline);
         		
         		//sources = $(xml).find('sources').text();
         		//sym.$("sourcesTxt").html(sources);
         		
         		//pictures = $(xml).find('pictures').text();
         		//sym.$("picturesTxt").html(pictures);
         		
         		sources = $(xml).find('sources').text();
         		sym.getSymbol("slider").getSymbol("panel02").$("sourcesTxt").html(sources);
         		
         		//CAPTIONS ON PANEL01
         		
         		cap1 = $(xml).find('cap1').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap1Txt").html(cap1);
         	        
         	        cap2 = $(xml).find('cap2').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap2Txt").html(cap2);
         	        
         	        cap3 = $(xml).find('cap3').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap3Txt").html(cap3);
         	        
         	        cap4 = $(xml).find('cap4').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap4Txt").html(cap4);
         	        
         	        cap5 = $(xml).find('cap5').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap5Txt").html(cap5);
         	        
         	        cap6 = $(xml).find('cap6').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap6Txt").html(cap6);
         	        
         	        cap7 = $(xml).find('cap7').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap7Txt").html(cap7);
         	        
         	        cap8 = $(xml).find('cap8').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap8Txt").html(cap8);
         	        
         	        cap9 = $(xml).find('cap9').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap9Txt").html(cap9);
         	        
         	        cap10 = $(xml).find('cap10').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap10Txt").html(cap10);
         	        
         	        cap11 = $(xml).find('cap11').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap11Txt").html(cap11);
         	        
         	        cap12 = $(xml).find('cap12').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap12Txt").html(cap12);
         	        
         	        cap13 = $(xml).find('cap13').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap13Txt").html(cap13);
         	        
         	        cap14 = $(xml).find('cap14').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap14Txt").html(cap14);
         	        
         	        cap15 = $(xml).find('cap15').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap15Txt").html(cap15);
         	        
         	        cap16 = $(xml).find('cap16').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap16Txt").html(cap16);
         	        
         	        cap17 = $(xml).find('cap17').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap17Txt").html(cap17);
         	        
         	        cap18 = $(xml).find('cap18').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap18Txt").html(cap18);
         	        
         	        cap19 = $(xml).find('cap19').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap19Txt").html(cap19);
         	        
         	        cap20 = $(xml).find('cap20').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap20Txt").html(cap20);
         	        
         	        //Navigation buttons on Panel01
         	        cap41 = $(xml).find('cap41').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap41Txt").html(cap41);
         	        cap42 = $(xml).find('cap42').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap42Txt").html(cap42);
         	        cap43 = $(xml).find('cap43').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap43Txt").html(cap43);
         	        cap44 = $(xml).find('cap44').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap44Txt").html(cap44);
         	        
         	        //CAPTIONS FOR PHILIPPINES AND VIETNAM
         	        
         	        cap20 = $(xml).find('cap20').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap20Txt").html(cap20);
         	        
         	        cap21 = $(xml).find('cap21').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap21Txt").html(cap21);
         	        
         	        cap22 = $(xml).find('cap22').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap22Txt").html(cap22);
         	        
         	        cap23 = $(xml).find('cap23').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap23Txt").html(cap23);
         	        
         	        cap24 = $(xml).find('cap24').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap24Txt").html(cap24);
         	        
         	        cap25 = $(xml).find('cap25').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap25Txt").html(cap25);
         	        
         	        cap26 = $(xml).find('cap26').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap26Txt").html(cap26);
         	        
         	        cap27 = $(xml).find('cap27').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap27Txt").html(cap27);
         	        
         	        cap28 = $(xml).find('cap28').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap28Txt").html(cap28);
         	        
         	        cap29 = $(xml).find('cap29').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap29Txt").html(cap29);
         	        
         	        cap30 = $(xml).find('cap30').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap30Txt").html(cap30);
         	        
         	        cap31 = $(xml).find('cap31').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap31Txt").html(cap31);
         	        
         	        cap32 = $(xml).find('cap32').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap32Txt").html(cap32);
         	        
         	        cap33 = $(xml).find('cap33').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap33Txt").html(cap33);
         	        
         	        cap34 = $(xml).find('cap34').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap34Txt").html(cap34);
         	        
         	        cap35 = $(xml).find('cap35').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap35Txt").html(cap35);
         	        
         	        cap36 = $(xml).find('cap36').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap36Txt").html(cap36);
         	        
         	        cap37 = $(xml).find('cap37').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap37Txt").html(cap37);
         	        
         	        cap38 = $(xml).find('cap38').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap38Txt").html(cap38);
         	        
         	        cap39 = $(xml).find('cap39').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap39Txt").html(cap39);
         	        
         	        cap40 = $(xml).find('cap40').text();
         	        sym.getSymbol("slider").getSymbol("panel01").$("cap40Txt").html(cap40);
         	        
         	       
         	       
         
         		
         		
         		
         		
         		//cap1 = $(xml).find('cap1').text();
         		//sym.$("cap1Txt").html(cap1);
         		
         
         		
         		
         	//cap1 = $(xml).find('cap1').text();
         	//sym.getSymbol("panels").getSymbol("panel1").$("cap1Txt").html(cap1);
         	
         	//cap1 = $(xml).find('cap1').text();
         	//sym.getSymbol("panel1").$("cap1Txt").html(cap1);
         	
         
          
         
         		}
         	});
          
           // Embed a movie: create text variable 
         var vid = $("<video width='798' height='483'  id='vid1'>" +
           "<source src='movies/GN29641.mp4' type='video/mp4' />" +
           "<source src='movies/GN29641.ogg' type='video/ogg' />" +
           "This browser is not compatible with HTML 5" +
         "</video>");
         
         // stage symbol lookup, and append the above vid object to it;
         // in other words, get the div called 'videobox' (not a symbol) and attach the video control to it;
         sym.getSymbol("videoPanel").$("videobox").append(vid);
         
         // additional options for the video object
         //vid.attr('autoplay','autoplay');
         vid.attr('preload','auto');
         
         
         
         
         
         
         

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_slider}", "touchstart", function(sym, e) {
         // insert code to be run when a user touches the object (for touch devices only)
         if ( e.pageX == undefined ) {
         
         	var touch = e.originalEvent.touches [0] || e.originalEvent.changedTouches [0];
         	
         	this.swipeStartX = touch.pageX;
         }

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_slider}", "touchend", function(sym, e) {
         // insert code to be run when a user stops touching an object (for touch devices only)
         if ( e.pageX == undefined ) {
         	
         	var touch = e.originalEvent.touches [0] || e.originalEvent.changedTouches [0];
         	this.swipeEndX = touch.pageX;
         	this.onSwipe();
         }

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_video_btn}", "click", function(sym, e) {
         var videoShow = sym.$("videoPanel");
         
         if(videoShow.is(":hidden") ) { 
           videoShow.show();
           sym.getSymbol("videoPanel").play();
             document.getElementById('vid1').play();
             
         } else {
           videoShow.hide();
           document.getElementById('vid1').pause();
         }

      });
      //Edge binding end

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

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

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 1000, function(sym, e) {
         // insert code here
         sym.stop();
         sym.getSymbol("panel02").play();

      });
      //Edge binding end

      

      

      

      

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

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

      

      

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 9000, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      

      

      

      

      

      

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 13750, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      

      

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

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

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 12859, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 2500, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 2750, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      

      Symbol.bindElementAction(compId, symbolName, "${_reticule}", "click", function(sym, e) {
         // insert code for mouse click here
         // play the timeline from the given position (ms or label)
         sym.play("startMap2");

      });
      //Edge binding end

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 9000, function(sym, e) {
         // insert code here
         sym.stop();
         

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 10000, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goStartMap3}", "mouseover", function(sym, e) {
         // insert code to be run when the mouse hovers over the object
         sym.play("startMap3");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goStartMap2}", "click", function(sym, e) {
         // insert code for mouse click here
         sym.play("startMap2");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goZones}", "click", function(sym, e) {
         // insert code for mouse click here
         sym.play("startMap2");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goDisputes}", "click", function(sym, e) {
         // insert code for mouse click here
         sym.play("startMap3");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goPhilippines}", "click", function(sym, e) {
         // insert code for mouse click here
         //sym.getParentSymbol("slider").play("p1");
         sym.play("startPhilippines");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goVietnam}", "click", function(sym, e) {
         // insert code for mouse click here
         //sym.getParentSymbol("slider").play("p1");
         sym.play("startVietnam");

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 3500, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 13684, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 31242, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 22750, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 23589, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 27750, function(sym, e) {
         // insert code here
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 29166, function(sym, e) {
         // insert code here
         sym.play();

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_goStartChina}", "click", function(sym, e) {
         // insert code for mouse click here
         
         sym.play("goStartChina");

      });
      //Edge binding end

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

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

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

//=========================================================
   (function(symbolName) {

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 4000, function(sym, e) {
         // insert code here// play the timeline from the given position (ms or label)
         sym.play("glow");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_vid_icon}", "click", function(sym, e) {
         // play the timeline from the given position (ms or label)
         sym.play("start");
         // insert code for mouse click here

      });
      //Edge binding end

      

      Symbol.bindElementAction(compId, symbolName, "${_vid_back}", "click", function(sym, e) {
         // play the timeline from the given position (ms or label)
         sym.play("back");

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 6000, function(sym, e) {
         // insert code here
         // stop the timeline at the given position (ms or label)
         sym.stop("off");

      });
      //Edge binding end

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

//=========================================================
   (function(symbolName) {

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

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