$(document).ready(function() {
	$('#primary-nav li:last-child, .dt-list li:nth-child(4n)').addClass('endright');

	$('#primary-nav li a').each(function(){
		var _text = $(this).text();
		$(this).empty().append('<span>'+_text+'</span>');
	})
	
	jQuery('.dt-list').jcarousel();
	
	$('.dt-left a').click(function(){
		$('.jcarousel-prev').trigger('click');
		return false;
	})

	$('.dt-right a').click(function(){
		$('.jcarousel-next').trigger('click');
		return false;
	})

	$('.commentlist li').each(function(){
		$(this).addClass('entry');
		
	})

	$('.commentlist li .comment-body').each(function(){
		$(this).find('.comment-author').remove().clone().insertBefore($(this)).addClass('avatar').find('.says').remove();
		$(this).find('.commentmetadata, .reply').wrapAll("<div class='thecommsup'>");
		$(this).find('p').wrapAll("<div class='thecomm'>").insertBefore($(this).find('.thecommsup'));
		$(this).children().wrapAll("<div class='commww'>");
	})

	$('.commentlist > li:nth-child(1n) > .comment-body').each(function(){
		$(this).addClass('commw').width(($(this).width()) - (1) * 50 + 50);
		$(this).find('.commww').width(($(this).width() - 30));
	})

	$('.commentlist li:nth-child(1n) > ul > li:nth-child(1n) .comment-body').each(function(){
		$(this).addClass('commw').width(($(this).width()) - (2) * 50 + 50);
		$(this).find('.commww').width(($(this).width() - 30));
		$(this).parents('li.depth-1').css('margin-bottom','-10px');
	})

	$('.commentlist li:nth-child(1n) > ul > li:nth-child(1n) > ul > li:nth-child(1n) .comment-body').each(function(){
		$(this).addClass('commw').width(($(this).width()) - (2) * 50 + 50);
		$(this).find('.commww').width(($(this).width() - 30));
		$(this).parents('li.depth-1').css('margin-bottom','-20px');
	})

	$('.commentlist li:nth-child(1n) > ul > li:nth-child(1n) > ul > li:nth-child(1n) > ul > li:nth-child(1n) .comment-body').each(function(){
		$(this).addClass('commw').width(($(this).width()) - (2) * 50 + 50);
		$(this).find('.commww').width(($(this).width() - 30));
		$(this).parents('li.depth-1').css('margin-bottom','-30px');
	})

	$('.commentlist li:nth-child(1n) > ul > li:nth-child(1n) > ul > li:nth-child(1n) > ul > li:nth-child(1n) > ul > li:nth-child(1n) .comment-body').each(function(){
		$(this).addClass('commw').width(($(this).width()) - (2) * 50 + 50);
		$(this).find('.commww').width(($(this).width() - 30));
		$(this).parents('li.depth-1').css('margin-bottom','-40px');
	})

});


