jQuery( function() {
	jQuery( '.category' ).click( function() {
		jQuery( this ).toggleClass( 'active' )
		jQuery( this ).siblings( '.dropdown' ).toggle();
		jQuery( this ).find( '.indicator' ).toggleClass( 'indicator-active' );
		return false;
	} );
			
	jQuery( '#dock > li' ).hover( function() {
		jQuery( '.latest' ).fadeOut( 'fast' );
		jQuery( this ).addClass( 'dock-active' );
		jQuery( this ).children( 'span' ).fadeIn( 200 );
	}).bind( "mouseleave", function() {
		jQuery( this ).removeClass( 'dock-active' );
		jQuery( this ).children( 'span' ).fadeOut( 200 );
	} );

	jQuery( '#dock' ).bind( "mouseleave", function() {
		jQuery( '.latest' ).fadeIn( 1000 );
	} );


	jQuery( '#filter-teaser > li' ).hover( function() {
		jQuery( '.latest' ).fadeOut( 'fast' );
		jQuery( this ).addClass( 'dock-active' );
		jQuery( this ).children( 'span' ).fadeIn( 200 );
	}).bind( "mouseleave", function() {
		jQuery( this ).removeClass( 'dock-active' );
		jQuery( this ).children( 'span' ).fadeOut( 200 );
	} );

	jQuery( '#filter-teaser' ).bind( "mouseleave", function() {
		jQuery( '.latest' ).fadeIn( 1000 );
	} );



            var offset = jQuery("#socialnetwork").offset();
			var offsetArticle = jQuery(".post-box").offset();
            var topPadding = 15;
            jQuery(window).scroll(function() {
                if ((jQuery(window).scrollTop() > offset.top) && ( (jQuery(window).scrollTop()  - jQuery("#socialnetwork").height() +40 ) < jQuery(".post-box").height())  ){
                    jQuery("#socialnetwork").stop().animate({
                        marginTop: jQuery(window).scrollTop() - offset.top + topPadding
                    });
				} else if ( (jQuery(window).scrollTop()  - jQuery("#socialnetwork").height() + 40 ) > jQuery(".post-box").height()) {
					
					
                } else {
                    jQuery("#socialnetwork").stop().animate({
                        marginTop: 0
                    });
                };
            });



jQuery('#s').click(function() {
   //jQuery('#advanced_search').show();
});
jQuery('#searchform-header').mouseleave(function() {
   jQuery('#advanced_search').hide();
});
jQuery('#advanced_search li').prepend('<label><input type="checkbox" class="sub-cat" checked="" value="1" name="categories[site-templates]" disabled=""><span>');
jQuery('#advanced_search li').append('</span><label>');
jQuery('li.categories input').removeAttr("disabled");

jQuery("li.categories input").toggle(
function ()
{
    jQuery('.cat-item input').removeAttr("disabled");
    jQuery('li.categories input').attr('checked', false);
},
function ()
{
    jQuery('.cat-item input').attr("disabled", true);
    jQuery('li.categories input').attr('checked', true);
    jQuery('.cat-item input').attr("checked", true);

});




} );
