var initList = initList || [];
initList.push(function() {
    // TAB1
    $('.content.tab1 .imgs img').hide().eq(0).show();
    var btnZoomIn1 = $('.content.tab1 .btn_zoom_in');
    var btnZoomOut1 = $('.content.tab1 .btn_zoom_out');

    btnZoomOut1.click(function(){
    	var imgs = $('.content.tab1 .imgs');
    	var currentImg = imgs.find('.zoomIn');
    	var keyImg = parseInt(currentImg.attr('data-sg-key'));
    	imgs.find('.zoomOut').removeClass('zoomOut');

    	if(keyImg == 2){
    		btnZoomOut1.addClass('off').removeClass('on');
    	}
		currentImg.removeClass('zoomIn');
		currentImg.addClass('zoomOut').hide();
		var nextImg = $('.content.tab1 .imgs').find('[data-sg-key="' + (keyImg - 1) + '"]');
		nextImg.addClass('zoomIn').show();
    });
    btnZoomIn1.click(function(){
    	var imgs = $('.content.tab1 .imgs');
    	var currentImg = imgs.find('.zoomIn');
    	var keyImg = parseInt(currentImg.attr('data-sg-key'));
		imgs.find('.zoomOut').removeClass('zoomOut');

    	if(keyImg == 5){
    		$('[href="#tabs2"]').click();
    		return;
    	}else{
    		if(keyImg == 1){
    			btnZoomOut1.addClass('on').removeClass('off');
    		}
    		currentImg.removeClass('zoomIn');
    		currentImg.addClass('zoomOut').hide();
    		var nextImg = $('.content.tab1 .imgs').find('[data-sg-key="'+(keyImg + 1)+'"]');
    		nextImg.addClass('zoomIn').show();
		}
    });

	$('[data-sg-id=elem-tab]')
		.bind("easytabs:before", function(e, $targetPanel, settings) {
			sg.pause();
		}).easytabs();

	sg.pause = function() {
		$('audio').each(function(value, index) {
			var $this = $(this);
			$this[0].pause();
		});
	}

	requirejs(['jquery', 'sgSlider'], function($, sgSlider) {
		sgSlider.pageEffectBool = true;
		sgSlider.pageEffect = function(elem) {
			elem.show();

			var pageGroup = elem.attr('data-sg-group');
			var page = elem.attr('data-sg-key');

			$('.buttons'+ pageGroup +' .btn-hover').removeClass('active');
			var idButton = '.buttons'+ pageGroup +' .btn' + page;
			$(idButton).addClass('active');

			sg.pause();
		}
	});



   /* var $this = $(btn);
                if($this.hasClass('active')) return;
                $this.parent().children().removeClass('active');
                $this.addClass('active');
                var classStep = '.step.s'+step;

                var steps = $this.parent().parent();

                var nextStep=steps.find(classStep);

                nextStep.unbind('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
                var beforeStep=steps.find('.flipInX');
                beforeStep.addClass('flipOutX');
                    
                    
                beforeStep.bind('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
                    beforeStep.removeClass('flipOutX').hide();
                    steps.find('.flipInX').removeClass('flipInX');
                    nextStep.addClass('flipInX').show();               
                });*/


});