//Delete Functions
var deleteItemLink = function (controller, itemId){
	if (confirm('Are you sure?')) {
//	var pERROR = document.getElementById('pageerrors');
	var pERROR = document.getElementById('row_'+itemId);
	//pERROR.style.display = 'block';
	//var oHTML = pERROR.innerHTML;
	
	new Ajax.Updater('row_'+itemId, 'index.php?controller='+controller+'&action=delete&format=ajax&id='+itemId, {onComplete:function(){deleteEffects(itemId, controller)},asynchronous:true, evalScripts:true});	

	//setTimeout(function(){pERROR.style.display='none'},7000);
//	setTimeout(function() {Effect.Fade('row_'+itemId, {duration:1.0});},1000);
	}
}

var deletePhotoLink = function (controller, childId, photoId){
	var pERROR = document.getElementById('pageerrors');
	var oHTML = pERROR.innerHTML;
	
	new Ajax.Updater('pageerrors', 'index.php?controller='+controller+'&action=deletephoto&format=ajax&child_id='+childId+'&photo_id='+photoId, {onComplete:function(){deleteEffects(photoId, controller)},asynchronous:true, evalScripts:true});	

	setTimeout(function(){pERROR.innerHTML = oHTML;},5000);
}


function deleteEffects(id, controller) {
	new Effect.Highlight('row_'+id, {duration:'5.0',startcolor:'#008888',endcolor:'#888888'});
	setTimeout(function() {Effect.Fade('row_'+id, {duration:2.0});},3000);
//	new Effect.Highlight('pageerrors',{duration:'5.0',startcolor:'#008888',endcolor:'#888888'});
}

