
$(function() {
    $('img.image1').data('ad-desc', 'Whoa! This description is set through elm.data("ad-desc") instead of using the longdesc attribute.<br>And it contains <strong>H</strong>ow <strong>T</strong>o <strong>M</strong>eet <strong>L</strong>adies... <em>What?</em> That aint what HTML stands for? Man...');
    $('img.image1').data('ad-title', 'Title through $.data');
    $('img.image4').data('ad-desc', 'This image is wider than the wrapper, so it has been scaled down');
    $('img.image5').data('ad-desc', 'This image is higher than the wrapper, so it has been scaled down');
    var galleries = $('.ad-gallery').adGallery({
     slideshow: {
    enable: true,
    autostart: true,
    speed: 10000,
    start_label: 'Start',
    stop_label: 'Stop',
    stop_on_scroll: true    },
  
    callbacks: {

    afterImageVisible: function() {
       
    	$('#mma').hide();
    	 $('#thai').hide();
    	 $('#box').hide();
    	 $('#kickbox').hide();
    	 $('#fitness').hide();
    	
    	
    	if(this.current_index == 0) $('#mma').show();
    	if(this.current_index == 1) $('#thai').show();
    	if(this.current_index == 2) $('#box').show();
    	if(this.current_index == 3) $('#kickbox').show();
    	if(this.current_index == 4) $('#fitness').show();
    	  
    }

    	
    }
    
    });
    
    $('#switch-effect').click(
      function() {

        if($(this).is('.slide')) {
          galleries[0].settings.effect = 'fade';
          $(this).text('Switch to slide effect');
          $(this).removeClass('slide');
          $(this).addClass('fade');
        } else {
          galleries[0].settings.effect = 'slide';
          $(this).text('Switch to fade effect');
          $(this).removeClass('fade');
          $(this).addClass('slide');
        }
        return false;
      }
    );
    $('#toggle-slideshow').click(
      function() {
        galleries[0].toggleSlideshow();
        return false;
      }
    );
  });
  
  function showDic(let){
  	
  	for(var x=0;x<dicFieald.length;x++){
  		
  		$("#let_"+dicFieald[x]).attr("class","");
  		$("#let_text_"+dicFieald[x]).hide();
  		
  	}
  	
  	actLetter = let;
  	
  	$("#let_"+let).attr("class","active");
  	$("#let_text_"+let).show();
  	
  }
  
  function showDicS(direct){
  	
    for(var x=0;x<dicFieald.length;x++){
  		
  		if(actLetter == dicFieald[x]) break;
  		
  	}
  		
  		 
  	if(direct == 'prev' && x != 0){
  		
        showDic(dicFieald[x-1]);
  		
  	}
  	else if(direct == 'next' && x != (dicFieald.length-1)){

  		showDic(dicFieald[x+1]);
  		
  	}
  }