$(document).ready(function () {
    $('.side').each(function() {
        var id = $(this).attr('class').split(' ')[1].slice(1);
        $.get(
            'rpc-commentform-s9.cfm', 
            {id: id}, 
            function(data) {
                $('.side.c'+id).html(data); 
                activateForms('.f'+id);
            }
            
        );
    });
    
    $(function(){
        $("a[rel*='external']").click(function(){
            this.target = "_blank";
        });
    });
    
    // ScrollTo anchor
    $(function() {
        $('.scrollto').click(function(){
            $.scrollTo(this.href,2000);
            return false;
        });
    });

    // Back to top btn
	$(function () {
		$('#top-btn').hide();
		$(window).scroll(function () {
			if ($(this).scrollTop() >= 400) {
				$('#top-btn').fadeIn();
			} else {
				$('#top-btn').fadeOut();
			}
		});
	});
    
    // AddThis Toolbox Animation
    $(".addthis_toolbox a").hover(function() { // Mouse over
       $(this)
          .stop().fadeTo(500, 1)
          .siblings().stop().fadeTo(500, 0.2);
            
       $("span", this)
          .stop()
          .animate({
             opacity: 1,
             top: "-10px"
          }, 300);
         
    }, function() { // Mouse out
       $(this)
          .stop().fadeTo(500, 1)
          .siblings().stop().fadeTo(500, 1);
         
       $("span", this)
          .stop()
          .animate({
             opacity: 1,
             top: "-1px"
          }, 300);
    });
    
});
