/***********************
* 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 source;
         var sourcetxt = sym.$("sourceTxt").css("pointer-events","none");
         var source2;
         var source2txt = sym.$("source2Txt").css("pointer-events","none");
         var txt1;
         var txt1txt = sym.getSymbol("sliderMc").getSymbol("slideMc0").$("txt1").css("pointer-events","none");
         var txt2;
         var txt2txt = sym.getSymbol("sliderMc").getSymbol("slideMc1").$("txt2").css("pointer-events","none");
         var txt3;
         var txt3txt = sym.getSymbol("sliderMc").getSymbol("slideMc2").$("txt3").css("pointer-events","none");
         var txt4;
         var txt4txt = sym.getSymbol("sliderMc").getSymbol("slideMc2").$("txt4").css("pointer-events","none");
         var txt5;
         var txt5txt = sym.getSymbol("sliderMc").getSymbol("slideMc2").$("txt5").css("pointer-events","none");
         var txt6;
         var txt6txt = sym.getSymbol("sliderMc").getSymbol("slideMc3").$("txt6").css("pointer-events","none");
         var txt7;
         var txt7txt = sym.getSymbol("sliderMc").getSymbol("slideMc3").$("txt7").css("pointer-events","none");
         var txt8;
         var txt8txt = sym.getSymbol("sliderMc").getSymbol("slideMc3").$("txt8").css("pointer-events","none");
         var txt9;
         var txt9txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt9").css("pointer-events","none");
         var txt10;
         var txt10txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt10").css("pointer-events","none");
         var txt11;
         var txt11txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt11").css("pointer-events","none");
         var txt12;
         var txt12txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt12").css("pointer-events","none");
         var txt13;
         var txt13txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt13").css("pointer-events","none");
         var txt14;
         var txt14txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt14").css("pointer-events","none");
         var txt15;
         var txt15txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt15").css("pointer-events","none");
         var txt16;
         var txt16txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt16").css("pointer-events","none");
         var txt17;
         var txt17txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt17").css("pointer-events","none");
         var txt18;
         var txt18txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt18").css("pointer-events","none");
         var txt19;
         var txt19txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt19").css("pointer-events","none");
         var txt20;
         var txt20txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt20").css("pointer-events","none");
         var txt21;
         var txt21txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt21").css("pointer-events","none");
         var txt22;
         var txt22txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt22").css("pointer-events","none");
         var txt23;
         var txt23txt = sym.getSymbol("sliderMc").getSymbol("slideMc4").$("txt23").css("pointer-events","none");
         var txt24;
         var txt24txt = sym.$("txt24").css("pointer-events","none");
         var txt25;
         var txt25txt = sym.$("txt25").css("pointer-events","none");
         var txt26;
         var txt26txt = sym.$("txt26").css("pointer-events","none");
         var txt27;
         var txt27txt = sym.$("txt27").css("pointer-events","none");
         var txt28;
         var txt28txt = sym.$("txt28").css("pointer-events","none");
         var txt29;
         var txt29txt = sym.$("txt29").css("pointer-events","none");
         var txt30;
         var txt30txt = sym.$("txt30").css("pointer-events","none");
         var txt31;
         var txt31txt = sym.$("txt31").css("pointer-events","none");
         var txt32;
         var txt32txt = sym.$("txt32").css("pointer-events","none");
         var txt33;
         var txt33txt = sym.$("txt33").css("pointer-events","none");
         var txt34;
         var txt34txt = sym.$("txt34").css("pointer-events","none");
         var txt35;
         var txt35txt = sym.$("txt35").css("pointer-events","none");
         var txt36;
         var txt36txt = sym.$("txt36").css("pointer-events","none");
         var txt37;
         var txt37txt = sym.$("txt37").css("pointer-events","none");
         var txt38;
         var txt38txt = sym.$("txt38").css("pointer-events","none");
         var txt39;
         var txt39txt = sym.$("txt39").css("pointer-events","none");
         var txt40;
         var txt40txt = sym.$("txt40").css("pointer-events","none");
         var txt41;
         var txt41txt = sym.$("txt41").css("pointer-events","none");


           //AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
           $.ajax({	
         	type: "GET",
         	url: "GN30721.xml",
         	dataType: "xml",
         	success: function(xml) {
					headline = $(xml).find('headline').text();
         		headlinetxt.html(headline);
         		source = $(xml).find('source').text();
         		sourcetxt.html(source);
         		//source2 = $(xml).find('source2').text();
         		//source2txt.html(source2);
         		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); 
         		$(".whitebg").css({'color':'rgb(100,100,100)', 'background-color':'rgb(100,100,100)', 'margin':'1em 0.1em', 'height':'1px', 'border':0});                         		
         		$(".blackbg").css({'color':'rgb(100,100,100)', 'background-color':'rgb(100,100,100)', 'margin':'1em 0.1em', 'height':'1px', 'border':0});                

         		}
         	}); // END XML

	var slide = 0; // NUMBER FOR SCENES
	var move = -800; // AMOUNT SCENES SLIDE

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

// MAKE ELEMENTS INVISIBLE
	sym.$("handMc").animate({opacity: 0}, 0);
	sym.$("btnNextMc").animate({opacity: 0}, 0);
	sym.$("btnBackMc").animate({opacity: 0}, 0);
	sym.getSymbol("sliderMc").$("slideMc1").animate({left: 800}, 0);
	sym.getSymbol("sliderMc").$("slideMc2").animate({left: 1600}, 0);
	sym.getSymbol("sliderMc").$("slideMc3").animate({left: 2400}, 0);
	sym.getSymbol("sliderMc").$("slideMc4").animate({left: 3200}, 0);
	sym.getSymbol("sliderMc").$("slideMc5").animate({left: 4000}, 0);
	sym.$("btnBackMc").fadeOut(0);

// MOVE HAND
	sym.$("handMc").delay(500).animate ({opacity:1, left:763, top:342}, 2000);
	sym.$("btnNextMc").delay(2500).animate({opacity: 1}, 200);

function hideDots() {
		var dot_arr = ["dot0","dot1","dot2","dot3","dot4"];
		$.each(dot_arr, function(index, value) {
		sym.$(value).fadeOut(0);
		});
		sym.$("dot"+slide).fadeIn(0);
}
	hideDots();	

function showSlides() {
		sym.$("sliderMc").animate ({left:move*slide}, 700, 'easeOutCubic');
		sym.$("handMc").fadeOut(0);
		if (slide == 0) {
			sym.$("btnBackMc").fadeOut(0);
		}else{
			sym.$("btnBackMc").fadeIn(0);
		}
		if (slide == 4) {
			sym.$("btnNextMc").fadeOut(0);
		}else{
			sym.$("btnNextMc").fadeIn(0);
		}
		hideDots();
		resetmenu();
		sym.getSymbol("btnsMc").getSymbol("dot"+slide).$("btnClick").fadeIn(0);
		}

// GLASS BUTTON
	Symbol.bindElementAction(compId, symbolName, "${_btnNextMc}", "click", function(sym, e) {
	slide++;
	showSlides();
	});

	Symbol.bindElementAction(compId, symbolName, "${_btnNextMc}", "mouseover", function(sym, e) {
	sym.$("handMc").fadeOut(0);
	sym.$("btnNextMc").animate({opacity: 1}, 200);
	});
	Symbol.bindElementAction(compId, symbolName, "${_btnNextMc}", "mouseout", function(sym, e) {
	sym.$("btnNextMc").animate({opacity: 0}, 0);
	});

	Symbol.bindElementAction(compId, symbolName, "${_btnBackMc}", "click", function(sym, e) {
	slide--;
	showSlides();
	sym.$("sliderMc").animate ({left:move*slide}, 700, 'easeOutCubic');
	});
	Symbol.bindElementAction(compId, symbolName, "${_btnBackMc}", "mouseover", function(sym, e) {
	sym.$("handMc").fadeOut(0);
	sym.$("btnBackMc").animate({opacity: 1}, 200);
	});
	Symbol.bindElementAction(compId, symbolName, "${_btnBackMc}", "mouseout", function(sym, e) {
	sym.$("btnBackMc").animate({opacity: 0}, 0);
	});


// MENU BUTTONS --------------------------------------------	
         menuArray = []; //the array that will hold references to the buttons.

         for (var h = 0; h < 5; h++){
         	 // Create an instance element of a symbol as a child of the given parent element
         	 var menuBtnSymbols = sym.getSymbol("btnsMc").getSymbol("dot" +h);
         	 //set the value of a Symbol variable
         	 menuBtnSymbols.setVariable("menuId", h);
         	 //push it into the array
         	 menuArray.push(menuBtnSymbols);
         }

         //a 'for each' loop through the newly populated array.
         $.each(menuArray, function( count, menuInTheArray ){
         	 //create jQuery reference to the item.
         	 var menuBtnItem = $(menuInTheArray); 
         	 //create a jQuery reference to the DIV element inside the symbol.
         	 var menuBtnElement = menuInTheArray.getSymbolElement();
         	 //now you can bind interactivity to the menu items' DIVs
         	 menuBtnElement.bind ("click", {menuId:count}, menuBtnClick);
         	 menuBtnElement.bind ("mouseover", {menuId:count}, menuShow);
         	 menuBtnElement.bind ("mouseout", {menuId:count}, menuHide);
         	}
         )

	function resetmenu(){
		for (var h=0; h<menuArray.length; h++){
         	menuArray[h].$("btnClick").fadeOut(0);
         	menuArray[h].$("btnOver").fadeOut(0);
		}
	}
	resetmenu();

	function menuBtnClick (e){
		sym.$("btnNextMc").animate({opacity: 0}, 200);
		var menuMenu_id = (e.data.menuId); //get the id of the clicked item
		sym.getSymbol("btnsMc").getSymbol("dot" + menuMenu_id).$("btnClick").fadeIn(0);
		slide = menuMenu_id;
		showSlides();
		sym.$("sliderMc").animate ({left:move*menuMenu_id}, 700, function() {
		sym.getSymbol("btnsMc").getSymbol("dot"+menuMenu_id).$("btnClick").fadeIn(0);
	});
	}

	function menuShow (e){
         	var menuMenu_id = (e.data.menuId); //get the id of the over button
         	sym.$('handMc').hide();
         	sym.$("btnNextMc").animate({opacity: 0}, 200);
				sym.getSymbol("btnsMc").getSymbol("dot" + menuMenu_id).$("btnOver").fadeIn(0);
	}
	function menuHide (e){
         	var menuMenu_id = (e.data.menuId); //get the id of the out button
				sym.getSymbol("btnsMc").getSymbol("dot" + menuMenu_id).$("btnOver").fadeOut(0);
	}

// MAKE MENU 0 VISIBLE
	sym.getSymbol("btnsMc").getSymbol("dot0").$("btnClick").fadeIn(0);





   });//Edge binding end	
		

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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