/***********************
* 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;
         
         
         //AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
         
         $.ajax({	
         	type: "GET",
         	url: "GN29594.xml",
         	dataType: "xml",
         	success: function(xml) {
         	
         		headline = $(xml).find('headline').text();
         		sym.$("headlineTxt").html(headline);
         		
         		//------ UNUSED CAPTIONS STARTS ------
         		//venue = $(xml).find('venue').text();
         		//sym.$("venueTxt").html(venue);
         		
         		//key01 = $(xml).find('key01').text();
         		//sym.$("key01Txt").html(key01);
         		
         		//key02 = $(xml).find('key02').text();
         		//sym.$("key02Txt").html(key02);
         		
         		//month01 = $(xml).find('month01').text();
         		//sym.$("month01Txt").html(month01);
         		
         		//month02 = $(xml).find('month02').text();
         		//sym.$("month02Txt").html(month02);
         		
         		//------ UNUSED CAPTIONS STARTS ------
         		
         		sources = $(xml).find('sources').text();
         		sym.$("sourcesTxt").html(sources);
         		
         		pictures = $(xml).find('pictures').text();
         		sym.$("picturesTxt").html(pictures);
         		
         		//cap1 = $(xml).find('cap1').text();
         		//sym.$("cap1Txt").html(cap1);
         		
         		 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("panel02").$("cap5Txt").html(cap5);
         	        
         	        cap6 = $(xml).find('cap6').text();
         	        sym.getSymbol("slider").getSymbol("panel02").$("cap6Txt").html(cap6);
         	        
         	        cap7 = $(xml).find('cap7').text();
         	        sym.getSymbol("slider").getSymbol("panel02").$("cap7Txt").html(cap7);
         	        
         	        cap8 = $(xml).find('cap8').text();
         	        sym.getSymbol("slider").getSymbol("panel02").$("cap8Txt").html(cap8);
         	        
         	        cap9 = $(xml).find('cap9').text();
         	        sym.getSymbol("slider").getSymbol("panel02").$("cap9Txt").html(cap9);
         		//cap1 = $(xml).find('cap1').text();
         		//sym.$("cap1Txt").html(cap1);
         		
         		//------ TABLE STARTS ------
         		
         		//tablesubhead01 = $(xml).find('tablesubhead01').text();
         		//sym.$("tablesubhead01Txt").html(tablesubhead01);
         		
         		//table01 = $(xml).find('table01').text();
         		//sym.$("table01Txt").html(table01);
         		
         		//table02 = $(xml).find('table02').text();
         		//sym.$("table02Txt").html(table02);
         		
         		//table03 = $(xml).find('table03').text();
         		//sym.$("table03Txt").html(table03);
         		
         		//table04 = $(xml).find('table04').text();
         		//sym.$("table04Txt").html(table04);
         		
         		//table05 = $(xml).find('table05').text();
         		//sym.$("table05Txt").html(table05);
         		
         		//tablesubhead02 = $(xml).find('tablesubhead02').text();
         		//sym.$("tablesubhead02Txt").html(tablesubhead02);
         		
         		//table06 = $(xml).find('table06').text();
         		//sym.$("table06Txt").html(table06);
         		
         		//table07 = $(xml).find('table07').text();
         		//sym.$("table07Txt").html(table07);
         		
         		//table08 = $(xml).find('table08').text();
         		//sym.$("table08Txt").html(table08);
         		
         		//table09 = $(xml).find('table09').text();
         		//sym.$("table09Txt").html(table09);
         		
         		//table10 = $(xml).find('table10').text();
         		//sym.$("table10Txt").html(table10);
         		
         		//------ TABLE ENDS ------
         		
         		
         	//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/GN00000.mp4' type='video/mp4' />" +
           "<source src='movies/GN00000.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: 'tab'
(function(symbolName) {
Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
// insert code here
sym.stop();
});
//Edge binding end

Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 1000, function(sym, e) {
// insert code here
sym.stop();
});
//Edge binding end












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

//=========================================================
   //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

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

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_forward_butt}", "touchstart", function(sym, e) {
         // insert code to be run when a user touches the object (for touch devices only)
         sym.play("p1");
         
         

      });
      //Edge binding end

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

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_back_butt}", "touchstart", function(sym, e) {
         // insert code to be run when a user touches the object (for touch devices only)
         sym.playReverse();

      });
      //Edge binding end

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

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

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

      });
      //Edge binding end

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 5224, 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", 7217, function(sym, e) {
         // insert code here
         (stop);

      });
      //Edge binding end

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

//=========================================================

//Edge symbol: 'backBtn'
(function(symbolName) {
Symbol.bindElementAction(compId, symbolName, "${_Rectangle}", "mouseover", function(sym, e) {
// insert code for mouse enter here
// stop the timeline at the given position (ms or label)
sym.stop("over");
});
//Edge binding end

Symbol.bindElementAction(compId, symbolName, "${_Rectangle}", "mouseout", function(sym, e) {
// insert code for mouse leave here
// stop the timeline at the given position (ms or label)
sym.stop("off");
});
//Edge binding end






Symbol.bindElementAction(compId, symbolName, "${_Rectangle}", "click", function(sym, e) {
// insert code for mouse clicks here
sym.stop("over");
});
//Edge binding end







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

//=========================================================

//Edge symbol: 'forwardBtn'
(function(symbolName) {
Symbol.bindElementAction(compId, symbolName, "${_Rectangle}", "mouseover", function(sym, e) {
// insert code for mouse enter here
// stop the timeline at the given position (ms or label)
sym.stop("over");
});
//Edge binding end

Symbol.bindElementAction(compId, symbolName, "${_Rectangle}", "mouseout", function(sym, e) {
// insert code for mouse leave here
// stop the timeline at the given position (ms or label)
sym.stop("off");
});
//Edge binding end






Symbol.bindElementAction(compId, symbolName, "${_Rectangle}", "click", function(sym, e) {
// insert code for mouse clicks here
sym.stop("over");
});
//Edge binding end







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

//=========================================================
   //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'

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