jQuery(function(){
	
	jQuery('#blog .post .more a').click(function(){
		jQuery('#blog .post .more').show()
		jQuery(this).parent().hide()

		jQuery('.post-content').find('.more-content').hide()
		
		//jQuery('#comments-form').insertBefore(jQuery(this).parents('.post-content').find('.more-collapse')).show()
		
		jQuery(this).parents('.post-content').find('.more-content').show()
		
		
		//var hidden_comments = jQuery(this).parents('div.post').find('.comments-hidden');
		
		//if(!hidden_comments.length)
		//	return false;
		//else
		//	hidden_comments.show('fast');
		
		var post = jQuery(this).parents('.post')[0]

		jQuery('div.comments').each(function()
		{
			comments_post = jQuery(this).parents('.post')[0]
			if(comments_post.id != post.id)
				jQuery(this).hide()
			else
			{
				//console.info(post.id)
				jQuery(this).show()
				post_id = parseInt(post.id.substr(5))
				jQuery('#comments-form #error').html('')
				jQuery('#commentform textarea, #commentform p.input input').val('')
				
				//jQuery('#comments-form').insertAfter('#' + post.id + ' #commentlist' + post_id)
				//jQuery('#comments-form').appendTo('#' + post.id + ' div.comments')
				//jQuery('#comments-form').appendTo('#' + post.id + ' div.comments')
				jQuery('#comments-form').insertBefore(jQuery(this).parents('.post-content').find('.more-collapse')).show()
				jQuery('#commentform').show('')
				
				jQuery('#comment_post_ID').val(post_id)
				jQuery('#comments-form').show()
				
			}
		})
		
		return false
	})

	jQuery('#blog .post .more-collapse a').click(function(){
		jQuery(this).parents('.post').find('.more').show()
		jQuery(this).parents('.more-content').hide()
		return false
	})
	
	jQuery('#blog .post-meta .comments-count').click(function(){
		jQuery(this).parents('.post').find('.more a').click()
		//return false
	})
})
