(function($){
    $(document).ready(function(){

        /*
     * go to top anchor
     */
    $('body').removeClass('no-js').addClass('js');
        $('a#gototop').click(function(){
            $('html, body').animate({
                scrollTop:0
            }, 'slow');
            return false;
        });
        $('.hr').click(function(){
            $('html, body').animate({
                scrollTop:0
            }, 'slow');
            return false;
        });



        /*
     * dropdown menu
     */
        $(".menu li").hover(
            function () {
                $(this).has('ul').addClass("active");
                $(this).find('ul:first').css({
                    visibility: "visible",
                    display: "none"
                }).stop(true, true).slideDown('fast');
            },
            function () {
                $(this).removeClass("active");
                $(this).find('ul:first').css({
                    visibility: "visible",
                    display: "block"
                }).stop(true, true).slideUp('fast');
            }
            );
        /*
         * ajax more
         */




        $('.post').hover(function(){
            $(this).stop().animate({marginTop: '20', paddingBottom: '23'});
            $(this).find('.shadow').stop().animate({height:'24',opacity: '0.8'});
            $(this).find('img').stop().animate({opacity: '0.9'});
            $(this).find('p').stop().animate({opacity: '0'});
        },
        function(){
            $(this).stop().animate({marginTop: '27',paddingBottom:'18'});
            $(this).find('.shadow').stop().animate({height:'18',opacity: '1'});
            $(this).find('img').stop().animate({opacity: '1'});
            $(this).find('p').stop().animate({opacity: '1'});
        })


//       $("body.home .posts-navigation a").live('click', function(event) {
//            event.preventDefault();
//
//            var link = $(this).attr('href');
//            var h = $('#content').height();
//            $('#content').css('height',h).fadeOut(500).load(link + ' #content', function(){
//                $('#content').fadeIn(500);
//            });
//        });

/*
 * shortcodes - tabs, accordion
 */

        $('.tabs-content .tab:first').show();
        $('.tabs li:first').addClass('active');
        $.each($('.tabs li'),function(i,el){
            $(el).click(function(){
                $('.tabs-content .tab').css('display','none');
                $('.tabs-content .tab').eq(i).css('display','block');
                $('.tabs li').removeClass('active');
                $(this).addClass('active');
                return false;
            });
        });


        $("div.accordion div:not(:first)").hide();
        $("div.accordion h4").click(function() {
            if ($(this).next().is(":hidden")) {
                $("div.accordion div:visible").slideUp();
                $(this).next().slideDown();
            }
            return false;
        });

        $(".toggle-container").hide();
        $(".toggle-trigger").click(function(){
            $(this).toggleClass("active").next().slideToggle();
            return false;
        });

 
    

/*
 * clickable elements
 */
//
        $(".row .post.photo,.row .post.text, #prev_post, #next_post" ).bind('click',function(){
	 	window.location=$(this).find("a").attr("href");
		return false;
	});
        $(".blogpost-inside" ).bind('click',function(){
	 	window.location=$(this).find("h2 a").attr("href");
		return false;
	});



    });

})(this.jQuery);



  




