/***********************
* 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.getSymbol("styleMc").$("headlineTxt").css("pointer-events","none");
         var stand;
         var standtxt = sym.getSymbol("styleMc").$("standTxt").css("pointer-events","none");
         var source;
         var sourcetxt = sym.getSymbol("styleMc").$("sourceTxt").css("pointer-events","none");
         var menu0;
         var menu0txt = sym.getSymbol("styleMc").$("menuTxt0").css("pointer-events","none");
         var menu1;
         var menu1txt = sym.getSymbol("styleMc").$("menuTxt1").css("pointer-events","none");
         var btn0txt;
         var btn0text = sym.getSymbol("styleMc").getSymbol("menuBtn0").$("btnTxt").css("pointer-events","none");
         var btn1txt;
         var btn1text = sym.getSymbol("styleMc").getSymbol("menuBtn1").$("btnTxt").css("pointer-events","none");
         var btn2txt;
         var btn2text = sym.getSymbol("styleMc").getSymbol("menuBtn2").$("btnTxt").css("pointer-events","none");
         var btn3txt;
         var btn3text = sym.getSymbol("styleMc").getSymbol("menuBtn3").$("btnTxt").css("pointer-events","none");
         var btn4txt;
         var btn4text = sym.getSymbol("styleMc").getSymbol("menuBtn4").$("btnTxt").css("pointer-events","none");
         var txt1;
         var txt1txt = sym.getSymbol("preludeMc").$("txt1").css("pointer-events","none");
         var txt2;
         var txt2txt = sym.getSymbol("preludeMc").$("txt2").css("pointer-events","none");
         var txt3;
         var txt3txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt3").css("pointer-events","none");
         var txt4;
         var txt4txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt4").css("pointer-events","none");
         var txt5;
         var txt5txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt5").css("pointer-events","none");
         var txt6;
         var txt6txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt6").css("pointer-events","none");
         var txt7;
         var txt7txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt7").css("pointer-events","none");
         var txt8;
         var txt8txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt8").css("pointer-events","none");
         var txt9;
         var txt9txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt9").css("pointer-events","none");
         var txt10;
         var txt10txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt10").css("pointer-events","none");
         var txt11;
         var txt11txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt11").css("pointer-events","none");
         var txt12;
         var txt12txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt12").css("pointer-events","none");
         var txt13;
         var txt13txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt13").css("pointer-events","none");
         var txt14;
         var txt14txt = sym.getSymbol("mainMapMc").getSymbol("kaabaMc").$("txt14").css("pointer-events","none");
         var txt15;
         var txt15txt = sym.getSymbol("mainMapMc").getSymbol("mapMc").$("txt15").css("pointer-events","none");
         var txt16;
         var txt16txt = sym.getSymbol("mainMapMc").getSymbol("mapMc").$("txt16").css("pointer-events","none");
         var txt17;
         var txt17txt = sym.getSymbol("mainMapMc").getSymbol("mapMc").$("txt17").css("pointer-events","none");
         var txt18;
         var txt18txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt18").css("pointer-events","none");
         var txt19;
         var txt19txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt19").css("pointer-events","none");
         var txt20;
         var txt20txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt20").css("pointer-events","none");
         var txt21;
         var txt21txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt21").css("pointer-events","none");
         var txt22;
         var txt22txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt22").css("pointer-events","none");
         var txt23;
         var txt23txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt23").css("pointer-events","none");
         var txt24;
         var txt24txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt24").css("pointer-events","none");
         var txt25;
         var txt25txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt25").css("pointer-events","none");
         var txt26;
         var txt26txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt26").css("pointer-events","none");
         var txt27;
         var txt27txt = sym.getSymbol("mainMapMc").getSymbol("mosqueMapMc").$("txt27").css("pointer-events","none");
         var txt28;
         var txt28txt = sym.getSymbol("mainMapMc").getSymbol("routeMc").$("txt28").css("pointer-events","none");
         var txt29;
         var txt29txt = sym.getSymbol("mainMapMc").getSymbol("routeMc").$("txt29").css("pointer-events","none");
         var txt30;
         var txt30txt = sym.getSymbol("mainMapMc").getSymbol("routeMc").$("txt30").css("pointer-events","none");
         var txt31;
         var txt31txt = sym.getSymbol("mainMapMc").getSymbol("routeMc").$("txt31").css("pointer-events","none");
         var txt32;
         var txt32txt = sym.getSymbol("mainMapMc").getSymbol("routeMc").$("txt32").css("pointer-events","none");
         var txt33;
         var txt33txt = sym.getSymbol("mainMapMc").getSymbol("day1").$("txt33").css("pointer-events","none");
         var txt34;
         var txt34txt = sym.getSymbol("mainMapMc").getSymbol("day1").$("txt34").css("pointer-events","none");
         var txt35;
         var txt35txt = sym.getSymbol("mainMapMc").getSymbol("day2").$("txt35").css("pointer-events","none");
         var txt36;
         var txt36txt = sym.getSymbol("mainMapMc").getSymbol("day2").$("txt36").css("pointer-events","none");
         var txt37;
         var txt37txt = sym.getSymbol("mainMapMc").getSymbol("day3").$("txt37").css("pointer-events","none");
         var txt38;
         var txt38txt = sym.getSymbol("mainMapMc").getSymbol("day3").$("txt38").css("pointer-events","none");
         var txt39;
         var txt39txt = sym.getSymbol("mainMapMc").getSymbol("routeMc").$("txt39").css("pointer-events","none");
         var txt40;
         var txt40txt = sym.getSymbol("mainMapMc").getSymbol("day4").$("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: "GN29802.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);
         		menu0 = $(xml).find('menu0').text();
         		menu0txt.html(menu0);
         		btn0txt = $(xml).find('btn0txt').text();
         		btn0text.html(btn0txt);
         		btn1txt = $(xml).find('btn1txt').text();
         		btn1text.html(btn1txt);
         		btn2txt = $(xml).find('btn2txt').text();
         		btn2text.html(btn2txt);
         		btn3txt = $(xml).find('btn3txt').text();
         		btn3text.html(btn3txt);
         		btn4txt = $(xml).find('btn4txt').text();
         		btn4text.html(btn4txt);
         		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);                 
         		}
         	}); // END XML
         	
// STOP ELEMENTS INTERACTING WITH MOUSE
	sym.$("handMc").css("pointer-events","none");
	
// HIDE ELEMENTS
	sym.getSymbol("rollBtn0").$("minus").fadeOut(0);
	var menu_arr = ["day1","day2","day3","day4","routeMc","kaabaMc"];
		$.each(menu_arr, function(index, value) {
		sym.getSymbol("mainMapMc").$(value).fadeOut(0);
		});
        	
// MAKE ELEMENTS INVISIBLE
	sym.$("handMc").animate({opacity: 0}, 0);
	
// MOVE HAND
	sym.$("handMc").delay(500).animate ({opacity:1, left:640, top:450}, 2000);
	sym.$("handMc").delay(200).animate ({left:665, top:20}, 2000);
	
// MOSQUE BUTTON
	var kaabaShow = 0;
	Symbol.bindElementAction(compId, symbolName, "${_rollBtn0}", "click", function(sym, e) {
		if (kaabaShow == 0) {
			sym.getSymbol("rollBtn0").$("minus").fadeIn(0);
			sym.getSymbol("rollBtn0").$("plus").fadeOut(0);
			sym.getSymbol("mainMapMc").$("kaabaMc").fadeIn(600);
			kaabaShow = 1;
		}else{
			sym.getSymbol("rollBtn0").$("minus").fadeOut(0);
			sym.getSymbol("rollBtn0").$("plus").fadeIn(0);
			sym.getSymbol("mainMapMc").$("kaabaMc").fadeOut(600);
			kaabaShow = 0;
		}
	});
	
// MENU BUTTONS --------------------------------------------	
         //the array that will hold references to the buttons.
         menuArray = [];

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

         //a 'for each' loop through the newly populated array.
         $.each(menuArray, function( count, btnInTheArray ){
         	 //create jQuery reference to the item.
         	 var menuBtnItem = $(btnInTheArray); 
         	 //create a jQuery reference to the DIV element inside the symbol.
         	 var menuBtnElement = btnInTheArray.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 (){
        		sym.getSymbol("rollBtn0").$("minus").fadeOut(0);
			sym.getSymbol("rollBtn0").$("plus").fadeIn(0);
			kaabaShow = 0;
		for (var m=0; m<menuArray.length; m++){
			var menu_arr = ["day1","day2","day3","day4","kaabaMc"];
			$.each(menu_arr, function(index, value) {
			sym.getSymbol("mainMapMc").$(value).fadeOut(300);
			});
         	menuArray[m].$("menuBtnOverClick").fadeOut(0);
         	menuArray[m].$("menuBtnOver").fadeOut(0);
		}
         }
	resetMenu();
	
	sym.getSymbol("styleMc").getSymbol("menuBtn0").$("menuBtnOverClick").fadeIn(0); // Make button 0 visible
	
        function menuBtnClick (e){
         	resetMenu(); //set them all back to normal state
         	var selectedMenu_id = (e.data.menuId); //get the id of the clicked item
			sym.getSymbol("styleMc").getSymbol("menuBtn"+ selectedMenu_id).$("menuBtnOverClick").fadeIn(0);
		if (selectedMenu_id == 0){
			sym.getSymbol("mainMapMc").$("routeMc").fadeOut(200);
			sym.getSymbol("mainMapMc").$("day"+selectedMenu_id).fadeOut(600);
			sym.getSymbol("mainMapMc").$("mapMc").animate ({left: 0}, 600);
			sym.getSymbol("mainMapMc").$("mosqueMapMc").animate ({left: -54}, 600);
			sym.$("preludeMc").fadeIn(600);
			sym.$("rollBtn0").delay(700).fadeIn(300);
		}else{
			sym.getSymbol("mainMapMc").$("mapMc").animate ({left:-490}, 600);
			sym.getSymbol("mainMapMc").$("mosqueMapMc").animate ({left: -560}, 600);
			sym.$("preludeMc").fadeOut('slow', function() {
				sym.getSymbol("mainMapMc").$("day"+selectedMenu_id).fadeIn(600);
				sym.getSymbol("mainMapMc").$("routeMc").delay(100).fadeIn(600);
    				});
    				sym.$("rollBtn0").fadeOut(0);
			}	
		}
         function menuShow (e){
         	var selectedMenu_id = (e.data.menuId); //get the id of the over button
         	sym.$('handMc').hide();
		sym.getSymbol("styleMc").getSymbol("menuBtn" + selectedMenu_id).$("menuBtnOver").fadeIn(0);
         }
         function menuHide (e){
         	var selectedMenu_id = (e.data.menuId); //get the id of the out button
		sym.getSymbol("styleMc").getSymbol("menuBtn" + selectedMenu_id).$("menuBtnOver").fadeOut(0);
         }
         
         

         
         
         
         

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


   })("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: 'menuBtn'
   (function(symbolName) {   
   
   })("menuBtn");
   //Edge symbol end:'menuBtn'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

})(jQuery, AdobeEdge, "EDGE-6774367");