/***********************
* Acciones de composición de Adobe Edge Animate
*
* Editar este archivo con precaución, teniendo cuidado de conservar 
* las firmas de función y los comentarios que comienzan con "Edge" para mantener la 
* capacidad de interactuar con estas acciones en Adobe Edge Animate
*
***********************/
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // los alias más comunes para las clases de Edge

   //Edge symbol: 'stage'
   (function(symbolName) {
      
      
      

      Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
         var prefijo="IL_L_G01_U06_L04_01_01_0"
         var cur_file = 1;
         //Cambiar según el número de imágenes de la galería
         var Total_files = 8;
         // Mostrar primer elemento 
         sym.getSymbol("mainContainer").$("imagen").attr('src', "images/"+prefijo + cur_file +'.jpg');
         //ocultar botón
         if (cur_file <= 1){ 
         sym.setVariable("cur_file", 1);
         sym.$('bt_back_file').hide();
         }
         
         //slideshow
         $('mainContainer').css("overflow","hidden");
         $('img').css("max-width","100%");
         sym.showFile = function (fileDirection){
         	cur_file = cur_file + fileDirection;
         	if (cur_file < Total_files){
         	sym.$('bt_next_file').show();
         	}
         	if (cur_file > Total_files){ 
         	cur_file = Total_files;
         	}
           if (cur_file == Total_files){
         	sym.setVariable("cur_file", Total_files);
         	sym.$('bt_next_file').hide();
         	}
         	
         	if (cur_file <= 1){
         	sym.setVariable("cur_file", 1);
         	sym.$('bt_back_file').hide();
         	} else {
         	sym.$("bt_back_file").show();
         	}
         
             sym.$('mainContainer').fadeOut(300, function() {
         	 sym.getSymbol("mainContainer").$("imagen").attr('src', "images/"+prefijo + cur_file +'.jpg');
             sym.$('mainContainer').fadeIn(300);
         });
         
         }
         
         //acciones botones
         sym.$('bt_next_file').click(function(){
         sym.getComposition().getStage().showFile(1);
         });
         sym.$('bt_back_file').click(function(){
         sym.getComposition().getStage().showFile(-1);
         });

      });
      //Edge binding end

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

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

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

      

      

      

      

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         // introducir código aquí
      });
      //Edge binding end

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

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

      

      

      

      

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

      });
      //Edge binding end

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

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

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