jQuery.fn.deleteImg = function(options) {
   // instead of selecting a static container with 
   var container = this;
   
   var settings = jQuery.extend({
     imgid: 0,
	 postid: 0
	// put more defaults here
   }, options);
   
   // ... the code start here ...
   $.ajax({
   		type: "POST",
		url: "ajax/ajax.delete-post-image.php",
		data: "imgid=" + settings.imgid,
		beforeSend: function(){
			$(this).showOverlay();
		},
		complete: function(){
			$(this).removeOverlay();
		},
		success: function(del){
			//$('#imgid_'+settings.imgid).hide();
			$('#imgid_'+settings.imgid).fadeOut(function() { $('#imgid_'+settings.imgid).remove(); });
			if ( $('#postid_'+settings.postid+' .thumbs > li.upload-handler').length == 0 && $('#postid_'+settings.postid+' .thumbs > li.imgset').length < 7) {
				//$('#imgid_'+settings.imgid).before('<li class="upload-handler"><a onclick="showUploadPanel(\''+settings.postid+'\')">Upload Photo</a></li>');
				$('#postid_'+settings.postid+' .thumbs li:last-child').after('<li class="upload-handler"><a onclick="showUploadPanel(\''+settings.postid+'\')">Upload Photo</a></li>');
			}
			//location.reload(); // refresh page
		}
	}); 
	   	
   // if possible, return "this" to not break the chain
   return this;
};

jQuery.fn.deletePost = function(options) {
   // instead of selecting a static container with 
   var container = this;
   
   var settings = jQuery.extend({
     postid: 0
	 // put more defaults here
   }, options);
   
   // ... the code start here ...
   $.ajax({
		type: "POST",
		url: "ajax/ajax.delete-post.php",
		data: "postid=" + settings.postid,
		beforeSend: function(){
			$(this).showOverlay();
		},
		complete: function(){
			$(this).removeOverlay();
		},
		success: function(del){			
			$('#postid_'+settings.postid).fadeOut(function() { $('#postid_'+settings.postid).remove(); });
			//$('#postid_'+settings.postid+' .item-photo .thumbs').append('<li><a onclick="showUploadPanel(\''+settings.postid+'\')" style="margin-top:20px;"><span class="uploadBox">Upload Photo</span></a></li>');
			//$('#postid_'+settings.postid+' .item-photo .thumbs').append('test');
			//location.reload(); // refresh page
		}
	}); 
	
   // if possible, return "this" to not break the chain
   return this;
};