function _PhotoDeleteResponse(json) { 
	if (json.error) var text = json.error;
    if (json.message) {
    	var text = json.message; 
    	$("#PhotoBox_"+ json.fileId).remove();   
    }    
    if (text) alert(text);
}

function _PhotoDelete2(json) { 
	if (json.error) var text = json.error;
    if (json.message) {
    	var text = json.message; 
    	$("#PhotoBox_"+ json.fileId).remove();
    	$("#sthumb_"+ json.fileId).remove();   
    }    
    if (text) alert(text);
}

function _PhotoDelete3(json, params) { 
	if (json.error) alert(json.error);
    if (json.message) {
    	alert(json.message);
    	window.location = params.redirect; 
    }
}



function _AlbumDeleteResponse(json) { 
	if (json.error) var text = json.error;
    if (json.message) {
    	var text = json.message; 
    	$("#AlbumBox_"+ json.albumId).remove();   
    }    
    if (text) alert(text);
}

function _AlbumDelete2(json) { 
	if (json.error) alert(json.error);
    if (json.message) {
    	alert(json.message);
    	window.location = '/gallery/albums'; 
    }
}

function AjaxAction(self, callback, params) {      
    if (!self.href) return;	
    if (!callback) callback = _AlbumDeleteResponse;
    $(self).attr('title', $(self).text()).text("Please wait..");
	$.getJSON(self.href, function(json){
	    $(self).text($(self).attr('title'));
  		callback(json, params);  		
	});
}

function InitAjaxLinks(el) {      
    el.each(function() { 
		$(this).click(function(){ 
		    $(this).attr('title', $(this).text()).text("Please wait..");
			AjaxAction(this);
			return false; 
		});
	});
}


