function edit(e, i)
{
	$('#'+e+' .'+i+'.view').hide();
	$('#'+e+' .'+i+'.edit').show();
}

function save(e, i)
{
	$('#'+e+' .'+i+'.view').show();
	$('#'+e+' .'+i+'.edit').hide();
}

function blurb()
{
	$('#blurbinfo').hide();
	$('#blurb').show();
}

function loader()
{
	$('#form').hide();
	$('#loading').show();
}

function imagedisplay(img)
{
	$('#imagedisplay').show();
	var html = '<img src="/uploads/blog/'+img+'" width="640" />';
	$('#imagedisplay').html(html);
}

function closeimagedisplay()
{
	$('#imagedisplay').hide();
}

function comment(entryid)
{
	$('#addcomment').hide();
	$.ajax({
		type: "POST",
		url: "/blog/comment",
		data: {body: $('#newcomment').val(), entry_id: entryid},
		dataType: "html",
		success: function(newpost)
		{
			$('#commentbottom').after(newpost);
			$('#addcomment').show();
			$('#newcomment').val('');
		},
		error: function(e, m)
		{
			$('#addcomment').show();
		}
	});
}
function deletecomment(commentid)
{
	$.ajax({
		type: "POST",
		url: "/blog/deletecomment",
		data: {comment_id: commentid},
		success: function()
		{
			$('#comment'+commentid).fadeOut('slow');
		},
		error: function(e, m)
		{
			$('#newcomment').val(m);
		}
	});
}

$(document).ready(function(){
	$("#entry_blurb").keyup(function() {
		$('#count').html($('#entry_blurb').val().split(/\b[\s,\.-:;]*/).length);
	});
});