Cufon.replace('h2, .readarticle, .navigation, #maincol .share dl, #searchform .bordered .borderinside, #filterlinks .bordered .borderinside, .nav-previous span, .nav-next span, #commentform label, .wpcf7-form label, #followus dd a, #newsletterside p, #browsemore, .tags strong, #topcrop .top li a, .followus, #followus dt, #related li, .gallery dt, .comment-author, #footnav .borderinside h3, #footnav #signupfor span', { hover: true });

var pagination_options = {
	num_edge_entries: 2,
	num_display_entries: 8,
	callback: pageselectCallback,
	items_per_page:50
}
function pageselectCallback(page_index, jq){
	var items_per_page = pagination_options.items_per_page;
	var offset = page_index * items_per_page;
	var new_content = $('#links li').slice(offset, offset + items_per_page).clone();
	$('#linkresults').empty().append(new_content);
	return false;
}
function initPagination() {
	var num_entries = $('#links li').length;
	$('#listpagination').pagination(num_entries, pagination_options);
}

$(document).ready(function(){
	$('#links').hide();
	initPagination();

	$('a').filter(function(){
		return this.hostname && this.hostname != location.hostname;
	}).attr('target', '_blank');

	$('input[type="submit"]').attr("disabled", "disabled");
	$('input[type="text"], textarea').focus(function() {
		$(this).addClass("focusField");
		$(this).parent().find('input[type="submit"]').removeAttr("disabled");
		if (this.value == this.defaultValue){
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('textarea#message').focus(function() {
		$(this).addClass("focusField");
		$(this).parent().parent().parent().find('input[type="submit"]').removeAttr("disabled");
	});
	$('input[type="text"], textarea').blur(function() {
		$(this).removeClass("focusField");
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});


	$('.latestarticle, .article, #browsemore').hover(function(){
		$(this).addClass('highlight');
	}, function(){
		$(this).removeClass('highlight');
	});

	$('.top-content').hide();
	$('ul.top li:first').addClass('active').show();
	$('.top-content:first').show();

	$('ul.top li').click(function() {
		$('ul.top li').removeClass('active');
		$(this).addClass('active');
		$('.top-content').hide();
		var activeTab = $(this).find("a").attr('href');
		$(activeTab).fadeIn();
		return false;
	});

	$('#more-cats ul').wrap('<div id="more-cat-contain" />');
	$('#more-cats').hover(function(){
		$('#more-cats ul').delay(300).animate({
			left: '0',
			width: '350px',
			opacity: '.9'
		}, {queue:false, duration:600});
	}, function(){
		$('#more-cats ul').delay(300).animate({
			left: '-350px',
			width: '0',
			opacity: '0'
		}, {queue:false, duration:300});
	});

	$("a[rel='colorbox']").colorbox();
});
