// Start jQuery
$(document).ready(function(){    
    
    $("#home_header div.taekdo").hover(
      function () {
        $(this).animate({opacity:1}, 500, function(){});                
        $(".title", this).animate({bottom:130}, 300, function(){});
        $("#home_header_left").animate({bottom:150}, 300, function(){});
        $(".title .description", this).animate({opacity:0}, 0, function(){});
        $(".title .description", this).css("display", "block");
        $(".title .description", this).animate({opacity:1}, 300, function(){});
        $("#home_header div.kickboxing img").animate({opacity:0.3}, 500, function(){});
        $("#home_header div.kid img").animate({opacity:0.3}, 500, function(){});
      }, 
      function () {
         placeImgNormalPositions();
      }
    );
        
    $("#home_header div.kickboxing").hover(
      function () {
        $(this).animate({opacity:1}, 500, function(){});
        $(".title", this).animate({bottom:135}, 300, function(){});
        $(".title .description", this).animate({opacity:0}, 0, function(){});
        $(".title .description", this).css("display", "block");
        $(".title .description", this).animate({opacity:1}, 300, function(){});
        $("#home_header div.taekdo img").animate({opacity:0.3}, 500, function(){});        
        $("#home_header div.kid img").animate({opacity:0.3}, 500, function(){});
      }, 
      function () {
         placeImgNormalPositions();
      });
        
    $("#home_header div.kid").hover(
      function () {
        $(this).animate({opacity:1}, 500, function(){});  
        $(".title", this).animate({bottom:135}, 300, function(){});
        $(".title .description", this).animate({opacity:0}, 0, function(){});
        $(".title .description", this).css("display", "block");
        $(".title .description", this).animate({opacity:1}, 300, function(){});
        $("#home_header div.kickboxing img").animate({opacity:0.3}, 500, function(){});        
        $("#home_header div.taekdo img").animate({opacity:0.3}, 500, function(){});
      }, 
      function () {
         placeImgNormalPositions();
      });
      
      
      function placeImgNormalPositions(){
        $("#home_header_left").animate({bottom:50}, 300, function(){});
        $("#home_header div.taekdo .title").animate({bottom:30}, 300, function(){});
        $("#home_header div.title div.description").animate({opacity:0}, 200, function(){});
        $("#home_header div.taekdo img").animate({opacity:1}, 200, function(){});
        $("#home_header div.kickboxing .title").animate({bottom:35}, 300, function(){});        
        $("#home_header div.kickboxing img").animate({opacity:1}, 200, function(){});
        $("#home_header div.kid .title").animate({bottom:35}, 300, function(){});       
        $("#home_header div.kid img").animate({opacity:1}, 200, function(){});
    };
    



    $(function() {
	    if (window.PIE) {
	        $('.rounded').each(function() {
	            PIE.attach(this);
	        });
	    }
	});


	jQuery('ul.innerfade').cycle({ 
		fx:      'fade', 
		speed:    300, 
		timeout:  5000 
	});



	jQuery.getJSON("https://graph.facebook.com/CardiffMartialArts?callback=?", function(json) { // send the request through the graph api
	        $(".num-fb").html(json.likes); //insert result into desired location
	});


	jQuery(function(){
	    $.ajax({
	        url: 'http://api.twitter.com/1/users/show.json',
	        data: {screen_name: 'CardiffMA'},
	        dataType: 'jsonp',
	        success: function(data) {
	            $('.num-tw').html(data.followers_count);
	        }
	    });
	});




});
        
