
function toggleBlockDisplay(elementId)
{

	var element = $(elementId);
	
	if (element != null)
	{
		if (element.style.display == 'block')
		{
			element.style.display = 'none';
		}
		else
		{
			element.style.display = 'block';
		}
	}

}

function deleteComment(formName, updateId, commentId)
{

	if (confirm("Do you want to delete this comment?"))
	{

		var form = document.getElementById(formName);

		form.update_id.value  = updateId;
		form.comment_id.value = commentId;
		form.action.value     = 'delete_comment';

		if (form.onsubmit())
		{
			form.submit();
		}
	
	}

}

function deleteUpdate(formName, updateId)
{

	if (confirm("Do you want to delete this update?"))
	{
	
		var form = document.getElementById(formName);

		form.update_id.value  = updateId;
		form.action.value     = 'delete_update';

		if (form.onsubmit())
		{
			form.submit();
		}

	}
	
}

function editUpdate(formName, updateId)
{

	var form = document.getElementById(formName);

	form.update_id.value  = updateId;
	form.action.value     = 'edt_update';

	if (form.onsubmit())
	{
		form.submit();
	}
	
}

function attachAnotherPhoto(areaName)
{
	
	var area = document.getElementById(areaName);
	
	var html = area.innerHTML;
	html += "<div><input type='file' name='attach_photo[]'/></div>";
	
	area.innerHTML = html;
	
}