jQuery(document).ready(function()
{
  jQuery('a.edit-link').bind('click', function (event)
  {
    event.preventDefault();

    var link_id = jQuery(event.target).attr('id').split('_');
    var post_id = link_id[link_id.length - 1];

    post_editForm(post_id);
  });
});

var post_editForm = function (post_id)
{
  
  if (typeof(post_id) != "undefined")
  {
    jQuery('div#content_post_' + post_id).hide();
    jQuery('form#edit_post_form_' + post_id).show();
  }

  return false;
}

jQuery(document).ready(function()
{
  jQuery('.inline-edit-post-form').submit(function(event)
  {
	var form = jQuery(event.target);
	
	jQuery.ajax({
		url: form.attr('action'),
		type: 'POST',
		data: form.serialize(),
		success: function(data, textStatus, XMLHttpRequest)
		{
		  document.location.href = data;
		}
	});
	
	return false;
  });
});
