/***********************
* Adobe Edge Animate 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 Animate
*
***********************/
(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) {
         
         //supbtn  -- put -- mix
         var buck = sym.$("bucket");
         var bucksym = sym.getSymbol("bucket");
         /*
         	cone_animate --animate
         	waterspoil
         	beaker  -- a0 -> a4
         	single_ice  - animate
         */
         var table = sym.getSymbol("sym_table");
         var checkaction = false;
         var j = 1;
         var tempArray =[];
         var firstTime =false;
         var countryText="";
         var nightText="";
         var dayText="";
         var d = 0;
         
         
         function playAnim(){
          console.log("play anim");
         	if(!checkaction){
         			if(d<4){
         			bucksym.getSymbol("single_ice").play("animate");
         			myVar=setTimeout(function(){
         				d++;
         				console.log(j);
         				bucksym.getSymbol("beaker").stop("a1");
         				checkaction = true;
         				clearTimeout(myVar)
         				times=setTimeout(function(){playAnim();clearTimeout(times);},1000)
         			},2000)
         
         		}
         	}else{
         
         				bucksym.getSymbol("cone_animate").play("animate");
         				bucksym.getSymbol("spinbaker").play("animate");
         				if(d ==4){
         					bucksym.getSymbol("socool").play("animate");
         				}
         				
         				myVar=setTimeout(function(){
         				switch(d){
         				case 1: 
         				bucksym.getSymbol("text_temp").$("text").html("24");
         				break;
         				case 2: 
         				bucksym.getSymbol("text_temp").$("text").html("23");
         				break;
         				case 3: 
         				bucksym.getSymbol("text_temp").$("text").html("22");
         				break;
         				case 4: 
         				bucksym.getSymbol("text_temp").$("text").html("21");
         				
         				}
         
         						bucksym.getSymbol("spinbaker").stop(0);
         						bucksym.getSymbol("beaker").stop("a0");
         						checkaction = false;
         						clearTimeout(myVar);
         						if(d<4){
         							playAnim();
         						}else if(d==4){
         							console.log("notplay");
         						}
         
         				},2000)
         	}
         
         
         };
         
         
         Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 1800, function(sym, e) {
         	playAnim();
         });
         
         
         
         
         
         

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 1500, function(sym, e) {
         

      });
      //Edge binding end

      Symbol.bindSymbolAction(compId, symbolName, "creationComplete", function(sym, e) {
         // insert code to be run when the symbol is created here
         
         yepnope({
             load: [
         		"js/energize.js"
         	],
         	complete: function () {
              console.log("allscript complete");
          
           }
         });

      });
      //Edge binding end

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

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

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 2000, function(sym, e) {
         sym.stop(0);

      });
      //Edge binding end

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

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

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 2978, function(sym, e) {
         sym.stop(0);

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 395, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 674, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 932, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

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

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

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 2500, function(sym, e) {
         sym.stop(0);

      });
      //Edge binding end

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

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