function deleteAttachment(id)
{
	if(confirm('Are you sure you want to delete this attachment?'))
	{
		document.location.href = 'admin_opportunities.php?action=delete&id=' + id;
	}
}

function deleteNews(id)
{
	if(confirm('Are you sure you want to delete this news item?'))
	{
		document.location.href = 'admin.php?page=news&action=delete&id=' + id;
	}
}

function deleteEvent(id)
{
	if(confirm('Are you sure you want to delete this event?'))
	{
		document.location.href = 'admin.php?page=events&action=delete&id=' + id;
	}
}

function deleteRecurringEvent(id)
{
	if(confirm('Are you sure you want to delete this event?'))
	{
		document.location.href = 'admin.php?page=recurring&action=delete&id=' + id;
	}
}

function deleteService(id)
{
	if(confirm('Are you sure you want to delete this Youth Service?'))
	{
		document.location.href = 'admin.php?page=directory&action=delete&id=' + id;
	}
}

function deleteNewsletter(id)
{
	if(confirm('Are you sure you want to delete this Newsletter?'))
	{
		document.location.href = 'admin.php?page=newsletter&action=delete&id=' + id;
	}
}

function deleteLink(id)
{
	if(confirm('Are you sure you want to delete this Link?'))
	{
		document.location.href = 'profile.php?page=links&action=delete&id=' + id;
	}
}

function deleteTopic(id)
{
	if(confirm('Are you sure you want to delete this Topic?\n\nAll of the replies to this topic will be deleted too.'))
	{
		document.location.href = 'profile.php?page=topics&action=delete&id=' + id;
	}
}

function deleteAlbum(id)
{
	if(confirm('Are you sure you want to delete this Album?\n\nAll of the photos in this album will be deleted too.'))
	{
		document.location.href = 'admin.php?page=gallery&action=delete&id=' + id;
	}	
}

function deleteMember(id)
{
	if(confirm('Are you sure you want to delete this User?\n\nThis will also delete all of their photos, videos, comments, etc.'))
	{
		document.location.href = 'admin.php?page=members&action=delete&id=' + id;
	}	
}

function adminDelete(id, type, back)
{
	if(confirm('Are you sure you want to delete this ' + type + '?'))
	{
		document.location.href = 'admin.php?page=delete&type=' + type + '&id=' + id + '&return=' + back;
	}
}

function countChars(txt, id)
{
	var obj = document.getElementById(txt);
	
	document.getElementById(id).innerHTML = (++obj.value.length) + ' of 500 Characters.';
}

function toggle(id)
{
	var obj = document.getElementById(id);

	if(obj.disabled == true)
		obj.disabled = false;
	else
		obj.disabled = true;
}

function toggleVisibility(id)
{
	var obj = document.getElementById(id);

	if(obj.style.display == 'none')
		obj.style.display = 'inherit';
	else
		obj.style.display = 'none'
}

function checkFields(id)
{
	switch(id.selectedIndex)
	{		
		case 1:
			document.getElementById('emailField').style.display = 'none';
			document.getElementById('categoryField').style.display = 'none';
			document.getElementById('note').style.display = '';
		break;
		
		case 2:
			document.getElementById('emailField').style.display = 'none';
			document.getElementById('categoryField').style.display = 'none';
			document.getElementById('note').style.display = '';
		break;
		
		case 3:
			document.getElementById('emailField').style.display = '';
			document.getElementById('categoryField').style.display = 'none';
			document.getElementById('note').style.display = 'none';
		break;
		
		case 4:
			document.getElementById('categoryField').style.display = '';
			document.getElementById('emailField').style.display = 'none';
			document.getElementById('note').style.display = '';
		break;
		
		default:
			document.getElementById('emailField').style.display = 'none';
			document.getElementById('categoryField').style.display = 'none';
			document.getElementById('note').style.display = 'none';
		break;
	}
}

function playVideo(id)
{
   var so = new SWFObject("http://www.youtube.com/v/" + id + "&rel=1", "menu", "425", "355", "8", "#FFFFFF");
   so.addParam("wmode", "transparent");
   so.write("videoplayer");
}

function showList(id)
{
	var alphabet = new Array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'misc');
	
	for(i = 0; i < 27; i++)
	{
		if(document.getElementById('cat_' + alphabet[i]))
			document.getElementById('cat_' + alphabet[i]).style.display = 'none';
	}
	
	document.getElementById('cat_' + id).style.display = 'inherit';
}