(function($) {
	$.fn.ooohfilter = function(settings) {
		$(this).unbind('click').bind('click',function(){
			$(this).addClass('loading');
			$('.page-numbers-load').show();
			$('.back-to-all').hide();
			var url = $(this).attr('href');
			var d1 = {
				action: 'get_paged',
				is_home: filters.is_home
			};
			$.ajax({
				url:url,
				type:'POST',
				data:d1,
				dataType:'json',
				success: function(msg){
					$('#queries').html(msg.paged);
					$('#filter-nav').html(msg.filter_nav);
					$('#blog-filter-nav').html(msg.blogfilter_nav);
					reloadanchors($);
					$(document).scrollTo("#queries",500);
					$('a').removeClass('loading');
				}
			});
				
			return false;
		});
	};
})(jQuery);

function reloadanchors($){
	$(".wp_page_numbers a, .article-block a[rel*='tag'], .artist-block a[rel*='tag'], .author a, .back-to-all, #filter-nav a, #blog-filter-nav a").each(function(){
		$(this).ooohfilter();									
	});
	if(filters.is_home=="true" || (filters.is_archive=="true" && filters.is_artist=="false")){
		$("#wp-calendar table[class!='nav'] caption a, #wp-calendar table[class!='nav'] tbody a").each(function(){
			$(this).ooohfilter();									
		});
	}
	$(".back-to-all").each(function(){
		$(this).show();								
	});
}

jQuery(document).ready(function($){
	reloadanchors($);
});